We didn't get much complaints on Localization so I guess we can expand it more and make it the default behavior to use the browser's locale when you signup --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
14 lines
521 B
TypeScript
14 lines
521 B
TypeScript
import { i18n } from '@lingui/core';
|
|
import { APP_LOCALES, SOURCE_LOCALE } from 'twenty-shared/translations';
|
|
|
|
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 = SOURCE_LOCALE;
|
|
}
|
|
const { messages } = await import(`../../locales/generated/${locale}.ts`);
|
|
i18n.load(locale, messages);
|
|
i18n.activate(locale);
|
|
};
|