Automated cherry pick of #3238 (#3255)

* 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:
Mattermost Build 2019-09-12 16:57:34 +02:00 committed by Elias Nahum
parent a9064aca0f
commit 5b858e2f06

View file

@ -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];
}