Translations - Crowdin, Set workspace member locale on signup, and optimizations (#10091)
More progress on translations: - Migrate from translations.io to crowdin - Optimize performance and robustness - Set workspaceMember/user locale upon signup
This commit is contained in:
@ -2,6 +2,11 @@ import { i18n } from '@lingui/core';
|
||||
import { APP_LOCALES } 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';
|
||||
}
|
||||
const { messages } = await import(`../../locales/generated/${locale}.ts`);
|
||||
i18n.load(locale, messages);
|
||||
i18n.activate(locale);
|
||||
|
||||
Reference in New Issue
Block a user