Remove access to global state from i18n/i18n (#26750)

Этот коммит содержится в:
Harrison Healey
2024-04-22 13:32:55 -04:00
коммит произвёл GitHub
родитель f3b80f77a6
Коммит b091ef5686
8 изменённых файлов: 62 добавлений и 27 удалений

Просмотреть файл

@@ -15,10 +15,10 @@ export function getCurrentLocale(state: GlobalState): string {
// If locale is provided in query parameter and the user is not logged in, we try get locale from param
const localeFromParam: string | null = (new URLSearchParams(window.location?.search)).get('locale');
const defaultLocale: string | undefined =
localeFromParam && I18n.isLanguageAvailable(localeFromParam) ? localeFromParam : getConfig(state).DefaultClientLocale;
localeFromParam && I18n.isLanguageAvailable(state, localeFromParam) ? localeFromParam : getConfig(state).DefaultClientLocale;
const currentLocale: string = getCurrentUserLocale(state, defaultLocale);
if (I18n.isLanguageAvailable(currentLocale)) {
if (I18n.isLanguageAvailable(state, currentLocale)) {
return currentLocale;
}
return General.DEFAULT_LOCALE;