@okta/odyssey-react-mui 1.9.13 → 1.9.14
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/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.9.14](https://github.com/okta/odyssey/compare/v1.9.13...v1.9.14) (2024-01-05)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @okta/odyssey-react-mui
|
|
9
|
+
|
|
6
10
|
## [1.9.13](https://github.com/okta/odyssey/compare/v1.9.12...v1.9.13) (2024-01-04)
|
|
7
11
|
|
|
8
12
|
**Note:** Version bump only for package @okta/odyssey-react-mui
|
|
@@ -36,7 +36,7 @@ export const OdysseyTranslationProvider = _ref => {
|
|
|
36
36
|
const changeHtmlElementLanguageAttribute = () => {
|
|
37
37
|
window.document.documentElement.setAttribute("lang", normalizedLanguageCode || "en");
|
|
38
38
|
};
|
|
39
|
-
i18n.changeLanguage(
|
|
39
|
+
i18n.changeLanguage(languageCode || window.navigator.language, changeHtmlElementLanguageAttribute);
|
|
40
40
|
}, [languageCode]);
|
|
41
41
|
useEffect(() => {
|
|
42
42
|
if (translationOverrides) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OdysseyTranslationProvider.js","names":["useEffect","i18n","defaultNS","resources","I18nextProvider","getTypedObjectKeys","jsx","_jsx","odysseyI18nResourceKeysList","mergeBundleOverrides","languageCode","translationOverrides","translationStrings","translationStringOverrides","formatLanguageCodeToHyphenated","replaceAll","OdysseyTranslationProvider","_ref","children","normalizedLanguageCode","changeHtmlElementLanguageAttribute","window","document","documentElement","setAttribute","changeLanguage","navigator","language","forEach","bundle","addResourceBundle"],"sources":["../src/OdysseyTranslationProvider.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2023-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { ReactNode, useEffect } from \"react\";\n\nimport { DefaultSupportedLanguages } from \"./OdysseyTranslationProvider.types\";\n\nimport { i18n, defaultNS, resources } from \"./i18n\";\nimport { I18nextProvider } from \"react-i18next\";\nimport { getTypedObjectKeys } from \"./getTypedObjectKeys\";\n\nexport type OdysseyI18nResourceKeys = (typeof resources)[\"en\"];\nexport const odysseyI18nResourceKeysList = getTypedObjectKeys(resources[\"en\"]);\n\nexport type TranslationOverrides<\n SupportedLanguages extends string = DefaultSupportedLanguages\n> = Record<SupportedLanguages, Partial<OdysseyI18nResourceKeys>>;\n\nconst mergeBundleOverrides = <SupportedLanguages extends string>(\n languageCode: SupportedLanguages,\n translationOverrides: TranslationOverrides<SupportedLanguages>\n) => {\n const translationStrings = resources[languageCode] || {};\n const translationStringOverrides = translationOverrides[languageCode];\n return {\n ...translationStrings,\n ...translationStringOverrides,\n };\n};\n\nexport type OdysseyTranslationProviderProps<\n SupportedLanguages extends string = DefaultSupportedLanguages\n> = {\n children: ReactNode;\n languageCode?: SupportedLanguages | DefaultSupportedLanguages;\n translationOverrides?: TranslationOverrides<SupportedLanguages>;\n};\n\nconst formatLanguageCodeToHyphenated = <SupportedLanguages extends string>(\n languageCode: OdysseyTranslationProviderProps<SupportedLanguages>[\"languageCode\"]\n) => languageCode?.replaceAll(\"_\", \"-\");\n\nexport const OdysseyTranslationProvider = <SupportedLanguages extends string>({\n children,\n languageCode,\n translationOverrides,\n}: OdysseyTranslationProviderProps<SupportedLanguages>) => {\n useEffect(() => {\n const normalizedLanguageCode =\n formatLanguageCodeToHyphenated<SupportedLanguages>(languageCode);\n\n const changeHtmlElementLanguageAttribute = () => {\n window.document.documentElement.setAttribute(\n \"lang\",\n normalizedLanguageCode || \"en\"\n );\n };\n // Defaults to the browser's language if available otherwise `en` will be used\n i18n.changeLanguage(\n
|
|
1
|
+
{"version":3,"file":"OdysseyTranslationProvider.js","names":["useEffect","i18n","defaultNS","resources","I18nextProvider","getTypedObjectKeys","jsx","_jsx","odysseyI18nResourceKeysList","mergeBundleOverrides","languageCode","translationOverrides","translationStrings","translationStringOverrides","formatLanguageCodeToHyphenated","replaceAll","OdysseyTranslationProvider","_ref","children","normalizedLanguageCode","changeHtmlElementLanguageAttribute","window","document","documentElement","setAttribute","changeLanguage","navigator","language","forEach","bundle","addResourceBundle"],"sources":["../src/OdysseyTranslationProvider.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2023-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { ReactNode, useEffect } from \"react\";\n\nimport { DefaultSupportedLanguages } from \"./OdysseyTranslationProvider.types\";\n\nimport { i18n, defaultNS, resources } from \"./i18n\";\nimport { I18nextProvider } from \"react-i18next\";\nimport { getTypedObjectKeys } from \"./getTypedObjectKeys\";\n\nexport type OdysseyI18nResourceKeys = (typeof resources)[\"en\"];\nexport const odysseyI18nResourceKeysList = getTypedObjectKeys(resources[\"en\"]);\n\nexport type TranslationOverrides<\n SupportedLanguages extends string = DefaultSupportedLanguages\n> = Record<SupportedLanguages, Partial<OdysseyI18nResourceKeys>>;\n\nconst mergeBundleOverrides = <SupportedLanguages extends string>(\n languageCode: SupportedLanguages,\n translationOverrides: TranslationOverrides<SupportedLanguages>\n) => {\n const translationStrings = resources[languageCode] || {};\n const translationStringOverrides = translationOverrides[languageCode];\n return {\n ...translationStrings,\n ...translationStringOverrides,\n };\n};\n\nexport type OdysseyTranslationProviderProps<\n SupportedLanguages extends string = DefaultSupportedLanguages\n> = {\n children: ReactNode;\n languageCode?: SupportedLanguages | DefaultSupportedLanguages;\n translationOverrides?: TranslationOverrides<SupportedLanguages>;\n};\n\nconst formatLanguageCodeToHyphenated = <SupportedLanguages extends string>(\n languageCode: OdysseyTranslationProviderProps<SupportedLanguages>[\"languageCode\"]\n) => languageCode?.replaceAll(\"_\", \"-\");\n\nexport const OdysseyTranslationProvider = <SupportedLanguages extends string>({\n children,\n languageCode,\n translationOverrides,\n}: OdysseyTranslationProviderProps<SupportedLanguages>) => {\n useEffect(() => {\n const normalizedLanguageCode =\n formatLanguageCodeToHyphenated<SupportedLanguages>(languageCode);\n\n const changeHtmlElementLanguageAttribute = () => {\n window.document.documentElement.setAttribute(\n \"lang\",\n normalizedLanguageCode || \"en\"\n );\n };\n // Defaults to the browser's language if available otherwise `en` will be used\n i18n.changeLanguage(\n languageCode || window.navigator.language,\n changeHtmlElementLanguageAttribute\n );\n }, [languageCode]);\n\n useEffect(() => {\n if (translationOverrides) {\n getTypedObjectKeys(translationOverrides).forEach((language) => {\n const bundle = mergeBundleOverrides<SupportedLanguages>(\n language,\n translationOverrides\n );\n i18n.addResourceBundle(language, defaultNS, bundle);\n });\n }\n }, [translationOverrides]);\n\n return <I18nextProvider i18n={i18n}>{children}</I18nextProvider>;\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAAoBA,SAAS,QAAQ,OAAO;AAAC,SAIpCC,IAAI,EAAEC,SAAS,EAAEC,SAAS;AACnC,SAASC,eAAe,QAAQ,eAAe;AAAC,SACvCC,kBAAkB;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAG3B,O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