Translations cleaning / workflows (#10125)
This commit is contained in:
@ -1,11 +1,11 @@
|
||||
import { i18n } from '@lingui/core';
|
||||
import { APP_LOCALES } from 'twenty-shared';
|
||||
import { APP_LOCALES, SOURCE_LOCALE } from 'twenty-shared';
|
||||
|
||||
export const dynamicActivate = async (locale: keyof typeof APP_LOCALES) => {
|
||||
if (!Object.values(APP_LOCALES).includes(locale)) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn(`Invalid locale "${locale}", defaulting to "en"`);
|
||||
locale = 'en';
|
||||
locale = SOURCE_LOCALE;
|
||||
}
|
||||
const { messages } = await import(`../../locales/generated/${locale}.ts`);
|
||||
i18n.load(locale, messages);
|
||||
|
||||
@ -1,5 +1,10 @@
|
||||
import { fromNavigator, fromStorage, fromUrl } from '@lingui/detect-locale';
|
||||
import { APP_LOCALES, isDefined, isValidLocale } from 'twenty-shared';
|
||||
import {
|
||||
APP_LOCALES,
|
||||
isDefined,
|
||||
isValidLocale,
|
||||
SOURCE_LOCALE,
|
||||
} from 'twenty-shared';
|
||||
import { dynamicActivate } from '~/utils/i18n/dynamicActivate';
|
||||
|
||||
export const initialI18nActivate = () => {
|
||||
@ -22,7 +27,7 @@ export const initialI18nActivate = () => {
|
||||
} else if (isDefined(navigatorLocale) && isValidLocale(navigatorLocale)) {
|
||||
// TODO: remove when we're ready to launch
|
||||
// locale = navigatorLocale;
|
||||
locale = 'en';
|
||||
locale = SOURCE_LOCALE;
|
||||
}
|
||||
|
||||
dynamicActivate(locale);
|
||||
|
||||
Reference in New Issue
Block a user