diff --git a/src/components/App/app.tsx b/src/components/App/app.tsx index 3d3ae02..3c1b2ec 100644 --- a/src/components/App/app.tsx +++ b/src/components/App/app.tsx @@ -13,6 +13,7 @@ import { CardErrorBoundary, fetchConfigParameter, fetchConfigParameters, + getComputedLanguage, NotificationsUrlKeys, useNotificationsListener, useSnackMessage, @@ -21,7 +22,6 @@ import { selectComputedLanguage, selectLanguage, selectTheme } from '../../redux import { AppState } from '../../redux/reducer'; import { ConfigParameters } from '../../services'; import { APP_NAME, COMMON_APP_NAME, PARAM_LANGUAGE, PARAM_THEME } from '../../utils/config-params'; -import { getComputedLanguage } from '../../utils/language'; import AppTopBar from './app-top-bar'; import { useDebugRender } from '../../utils/hooks'; import { AppDispatch } from '../../redux/store'; diff --git a/src/redux/local-storage.ts b/src/redux/local-storage.ts index af0574b..535bb03 100644 --- a/src/redux/local-storage.ts +++ b/src/redux/local-storage.ts @@ -5,8 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -import { DARK_THEME, GsLang, GsTheme, LANG_SYSTEM } from '@gridsuite/commons-ui'; -import { getComputedLanguage } from '../utils/language'; +import { DARK_THEME, getComputedLanguage, GsLang, GsTheme, LANG_SYSTEM } from '@gridsuite/commons-ui'; import { APP_NAME } from '../utils/config-params'; const LOCAL_STORAGE_THEME_KEY = (APP_NAME + '_THEME').toUpperCase(); diff --git a/src/utils/language.ts b/src/utils/language.ts deleted file mode 100644 index cb9f52a..0000000 --- a/src/utils/language.ts +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (c) 2021, RTE (http://www.rte-france.com) - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -import { GsLang, GsLangUser, LANG_ENGLISH, LANG_FRENCH, LANG_SYSTEM } from '@gridsuite/commons-ui'; - -const supportedLanguages: string[] = [LANG_FRENCH, LANG_ENGLISH]; - -export function getSystemLanguage(): GsLangUser { - const systemLanguage = navigator.language.split(/[-_]/)[0]; - return supportedLanguages.includes(systemLanguage) ? (systemLanguage as GsLangUser) : LANG_ENGLISH; -} - -export function getComputedLanguage(language: GsLang): GsLangUser { - return language === LANG_SYSTEM ? getSystemLanguage() : language; -}