@trackunit/i18n-library-translation 0.0.26 → 0.0.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +3 -2
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -55,12 +55,13 @@ const registerTranslations = (resource) => {
|
|
|
55
55
|
* @param initialResource {TranslationResource}
|
|
56
56
|
*/
|
|
57
57
|
const initializeTranslationsForApp = () => {
|
|
58
|
-
var _a, _b, _c;
|
|
58
|
+
var _a, _b, _c, _d;
|
|
59
59
|
// Get selected language from url or fallback to english
|
|
60
60
|
const queryString = window.location.search;
|
|
61
61
|
const urlParams = new URLSearchParams(queryString);
|
|
62
62
|
const savedLanguage = localStorage.getItem(LANG_STORAGE_KEY);
|
|
63
|
-
const
|
|
63
|
+
const defaultLanguage = (_a = navigator.language) !== null && _a !== void 0 ? _a : "en";
|
|
64
|
+
const selectedLanguage = (_d = (_c = (_b = urlParams.get("lang")) !== null && _b !== void 0 ? _b : i18next.language) !== null && _c !== void 0 ? _c : savedLanguage) !== null && _d !== void 0 ? _d : defaultLanguage;
|
|
64
65
|
// Collect default (English) translations for all namespaces
|
|
65
66
|
const defaultTranslations = Object.fromEntries(Object.entries(availableTranslations).map(([namespace, value]) => [namespace, value.default]));
|
|
66
67
|
const init = {
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@trackunit/i18n-library-translation",
|
|
3
3
|
"repository": "https://github.com/Trackunit/manager",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
|
-
"version": "0.0.
|
|
5
|
+
"version": "0.0.28",
|
|
6
6
|
"module": "./index.js",
|
|
7
7
|
"main": "./index.js",
|
|
8
8
|
"type": "module",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"i18next": "21.10.0",
|
|
14
14
|
"i18next-browser-languagedetector": "6.1.8",
|
|
15
15
|
"i18next-resources-to-backend": "1.1.0",
|
|
16
|
-
"@trackunit/iris-app-api": "0.0.
|
|
16
|
+
"@trackunit/iris-app-api": "0.0.78",
|
|
17
17
|
"@sentry/browser": "7.24.2"
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {}
|