Commit 86c4853b authored by bernard-ng's avatar bernard-ng Committed by JC Brand

#2290 format dayjs locale

parent 62c657be
...@@ -73,12 +73,14 @@ function isLocaleAvailable (locale, available) { ...@@ -73,12 +73,14 @@ function isLocaleAvailable (locale, available) {
*/ */
async function fetchTranslations (_converse) { async function fetchTranslations (_converse) {
const { api, locale } = _converse; const { api, locale } = _converse;
const dayjs_locale = locale.toLowerCase().replace('_', '-');
if (!isConverseLocale(locale, api.settings.get("locales")) || locale === 'en') { if (!isConverseLocale(locale, api.settings.get("locales")) || locale === 'en') {
return; return;
} }
const { default: data } = await import(/*webpackChunkName: "locales/[request]" */ `../i18n/${locale}/LC_MESSAGES/converse.po`); const { default: data } = await import(/*webpackChunkName: "locales/[request]" */ `../i18n/${locale}/LC_MESSAGES/converse.po`);
await import(/*webpackChunkName: "locales/dayjs/[request]" */ `dayjs/locale/${locale.toLowerCase().replace('_', '-')}`); await import(/*webpackChunkName: "locales/dayjs/[request]" */ `dayjs/locale/${dayjs_locale}`);
dayjs.locale(getLocale(locale, l => dayjs.locale(l))); dayjs.locale(getLocale(dayjs_locale, l => dayjs.locale(l)));
jed_instance = new Jed(data); jed_instance = new Jed(data);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment