* Set moment timezone locale as needed to prevent moment and intl locale getting out of sync * Update app/i18n/index.js Co-Authored-By: Elias Nahum <nahumhbl@gmail.com> * Updates per feedback
This commit is contained in:
parent
a9064aca0f
commit
5b858e2f06
1 changed files with 11 additions and 0 deletions
|
|
@ -108,10 +108,21 @@ function loadTranslation(locale) {
|
|||
}
|
||||
}
|
||||
|
||||
let momentLocale = DEFAULT_LOCALE;
|
||||
|
||||
function setMomentLocale(locale) {
|
||||
if (momentLocale !== locale) {
|
||||
momentLocale = moment.locale(locale);
|
||||
}
|
||||
}
|
||||
|
||||
export function getTranslations(locale) {
|
||||
if (!TRANSLATIONS[locale]) {
|
||||
loadTranslation(locale);
|
||||
}
|
||||
|
||||
setMomentLocale(locale.toLowerCase());
|
||||
|
||||
return TRANSLATIONS[locale] || TRANSLATIONS[DEFAULT_LOCALE];
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue