1
0
Fork 0
mirror of https://github.com/voltbonn/profile-picture-generator.git synced 2024-12-21 23:35:05 +00:00

added language logging

(To see, which locales should be added)
This commit is contained in:
thomasrosen 2021-04-21 01:01:04 +02:00
parent 3eb4429fe9
commit 431bcc59dc

View file

@ -1,4 +1,4 @@
import { useState, useCallback } from 'react'
import { useState, useEffect, useCallback } from 'react'
import './App.css'
import { useDropzone } from 'react-dropzone'
import mergeImages from 'merge-images'
@ -363,6 +363,15 @@ function AppWrapper() {
const [userLocales, setUserLocales] = useState(navigator.languages)
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 => {
setUserLocales([event.target.dataset.locale])
}, [setUserLocales])