mirror of
https://github.com/voltbonn/profile-picture-generator.git
synced 2024-12-22 07:45:04 +00:00
added language logging
(To see, which locales should be added)
This commit is contained in:
parent
3eb4429fe9
commit
431bcc59dc
1 changed files with 10 additions and 1 deletions
11
src/App.js
11
src/App.js
|
@ -1,4 +1,4 @@
|
||||||
import { useState, useCallback } from 'react'
|
import { useState, useEffect, useCallback } from 'react'
|
||||||
import './App.css'
|
import './App.css'
|
||||||
import { useDropzone } from 'react-dropzone'
|
import { useDropzone } from 'react-dropzone'
|
||||||
import mergeImages from 'merge-images'
|
import mergeImages from 'merge-images'
|
||||||
|
@ -363,6 +363,15 @@ function AppWrapper() {
|
||||||
const [userLocales, setUserLocales] = useState(navigator.languages)
|
const [userLocales, setUserLocales] = useState(navigator.languages)
|
||||||
const [currentLocale, setCurrentLocale] = useState(null)
|
const [currentLocale, setCurrentLocale] = useState(null)
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
let systemLocales = navigator.languages
|
||||||
|
if (!!systemLocales || Array.isArray(systemLocales)) {
|
||||||
|
for (const locale of systemLocales) {
|
||||||
|
window.umami.trackEvent('L: ' + locale) // Log Locale / Languages
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, [])
|
||||||
|
|
||||||
const handleLanguageChange = useCallback(event => {
|
const handleLanguageChange = useCallback(event => {
|
||||||
setUserLocales([event.target.dataset.locale])
|
setUserLocales([event.target.dataset.locale])
|
||||||
}, [setUserLocales])
|
}, [setUserLocales])
|
||||||
|
|
Loading…
Reference in a new issue