1
0
Fork 0
mirror of https://github.com/plankanban/planka.git synced 2025-07-18 20:59:44 +02:00

fix: Fix core locale loading

This commit is contained in:
Maksim Eltyshev 2022-07-24 17:13:28 +02:00
parent 2f0eecaf2a
commit 0589c23975

View file

@ -79,21 +79,19 @@ i18n
debug: process.env.NODE_ENV !== 'production',
});
i18n.loadCoreLocale = (language = i18n.resolvedLanguage) => {
i18n.loadCoreLocale = async (language = i18n.resolvedLanguage) => {
if (language === 'en') {
return;
}
import(`./locales/${language}/core`).then((module) => {
const locale = module.default;
const { default: locale } = await import(`./locales/${language}/core`);
Object.keys(locale).forEach((namespace) => {
if (namespace === 'dateFns') {
i18n.dateFns.addLocale(language, locale[namespace]);
} else {
i18n.addResourceBundle(language, namespace, locale[namespace], true, true);
}
});
Object.keys(locale).forEach((namespace) => {
if (namespace === 'dateFns') {
i18n.dateFns.addLocale(language, locale[namespace]);
} else {
i18n.addResourceBundle(language, namespace, locale[namespace], true, true);
}
});
};