@trackunit/i18n-library-translation 1.0.6 → 1.0.8

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.cjs.js CHANGED
@@ -72,14 +72,13 @@ const registerTranslations = (resource) => {
72
72
  * Pass the apps/extensions TranslationResource to this function for them to be available as well.
73
73
  */
74
74
  const initializeTranslationsForApp = () => {
75
- var _a, _b, _c;
76
75
  // Get selected language from url or fallback to english
77
76
  const queryString = window.location.search;
78
77
  const urlParams = new URLSearchParams(queryString);
79
78
  const savedLanguage = localStorage.getItem(LANG_STORAGE_KEY);
80
79
  const i18nextLanguage = i18next.language;
81
80
  const defaultLanguage = navigator.language;
82
- const selectedLanguage = (_c = (_b = (_a = urlParams.get("lang")) !== null && _a !== void 0 ? _a : i18nextLanguage) !== null && _b !== void 0 ? _b : savedLanguage) !== null && _c !== void 0 ? _c : defaultLanguage;
81
+ const selectedLanguage = urlParams.get("lang") ?? i18nextLanguage ?? savedLanguage ?? defaultLanguage;
83
82
  // Collect default (English) translations for all namespaces
84
83
  const defaultTranslations = Object.fromEntries(Object.entries(availableTranslations).map(([namespace, value]) => [namespace, value.default]));
85
84
  const init = {
package/index.esm.js CHANGED
@@ -52,14 +52,13 @@ const registerTranslations = (resource) => {
52
52
  * Pass the apps/extensions TranslationResource to this function for them to be available as well.
53
53
  */
54
54
  const initializeTranslationsForApp = () => {
55
- var _a, _b, _c;
56
55
  // Get selected language from url or fallback to english
57
56
  const queryString = window.location.search;
58
57
  const urlParams = new URLSearchParams(queryString);
59
58
  const savedLanguage = localStorage.getItem(LANG_STORAGE_KEY);
60
59
  const i18nextLanguage = i18next.language;
61
60
  const defaultLanguage = navigator.language;
62
- const selectedLanguage = (_c = (_b = (_a = urlParams.get("lang")) !== null && _a !== void 0 ? _a : i18nextLanguage) !== null && _b !== void 0 ? _b : savedLanguage) !== null && _c !== void 0 ? _c : defaultLanguage;
61
+ const selectedLanguage = urlParams.get("lang") ?? i18nextLanguage ?? savedLanguage ?? defaultLanguage;
63
62
  // Collect default (English) translations for all namespaces
64
63
  const defaultTranslations = Object.fromEntries(Object.entries(availableTranslations).map(([namespace, value]) => [namespace, value.default]));
65
64
  const init = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/i18n-library-translation",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -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.4",
16
- "@trackunit/iris-app-api": "^1.0.3",
16
+ "@trackunit/iris-app-api": "^1.0.5",
17
17
  "@trackunit/react-core-hooks": "^1.0.5"
18
18
  },
19
19
  "module": "./index.esm.js",