Translations cleaning / workflows (#10125)

This commit is contained in:
Félix Malfait
2025-02-11 15:26:21 +01:00
committed by GitHub
parent 6da9976193
commit cc68deaab1
63 changed files with 376 additions and 164 deletions

View File

@ -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);

View File

@ -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);