From 431bcc59dc1b7a2edcc60a24ae6cdfc0f8239a67 Mon Sep 17 00:00:00 2001 From: thomasrosen Date: Wed, 21 Apr 2021 01:01:04 +0200 Subject: [PATCH] added language logging (To see, which locales should be added) --- src/App.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/App.js b/src/App.js index 0a4fea2..df45bd8 100644 --- a/src/App.js +++ b/src/App.js @@ -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])