From f60c6639138a7f2737ccf9220d909fba4b76d9e0 Mon Sep 17 00:00:00 2001 From: Alla Doroshkevych Date: Thu, 9 Nov 2023 14:22:39 -0500 Subject: [PATCH] Locale fix for ie (#339) --- packages/terra-application/CHANGELOG.md | 1 + .../src/application-base/private/getBrowserLocale.js | 4 ++++ .../utility-menu/__snapshots__/UtilityMenu.test.jsx.snap | 6 +++--- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/terra-application/CHANGELOG.md b/packages/terra-application/CHANGELOG.md index 9f5602e1d..08cd3ae21 100644 --- a/packages/terra-application/CHANGELOG.md +++ b/packages/terra-application/CHANGELOG.md @@ -3,6 +3,7 @@ ## Unreleased * Changed + * Updated `getBrowserLocale` method for IE. * Updated jest snapshots for terra-icon and terra-button changes. * Updated size explanations for ModalManager managed by DisclosureManagerContext. * Locked `uuid` dependency to `3.4.0`. diff --git a/packages/terra-application/src/application-base/private/getBrowserLocale.js b/packages/terra-application/src/application-base/private/getBrowserLocale.js index 147b5c107..3ea880a7f 100644 --- a/packages/terra-application/src/application-base/private/getBrowserLocale.js +++ b/packages/terra-application/src/application-base/private/getBrowserLocale.js @@ -49,6 +49,10 @@ const getBrowserLocale = () => { if (preferredLocale) { return preferredLocale; } + /* for IE support, as languages and language in IE return undefined, and userLanguage and browserLanguage return "en-US" */ + if (isSupported(navigator.systemLanguage)) { + return navigator.systemLanguage; + } if (isSupported(navigator.language)) { return navigator.language; diff --git a/packages/terra-application/tests/jest/application-navigation/private/utility-menu/__snapshots__/UtilityMenu.test.jsx.snap b/packages/terra-application/tests/jest/application-navigation/private/utility-menu/__snapshots__/UtilityMenu.test.jsx.snap index e55110341..c7cece8d5 100644 --- a/packages/terra-application/tests/jest/application-navigation/private/utility-menu/__snapshots__/UtilityMenu.test.jsx.snap +++ b/packages/terra-application/tests/jest/application-navigation/private/utility-menu/__snapshots__/UtilityMenu.test.jsx.snap @@ -867,7 +867,7 @@ exports[`UtilityMenu should render with function callbacks 1`] = ` type="button" >