diff --git a/client/coral-i18n/services/i18n.js b/client/coral-i18n/services/i18n.js index 8b3b72774..c6521690f 100644 --- a/client/coral-i18n/services/i18n.js +++ b/client/coral-i18n/services/i18n.js @@ -7,11 +7,7 @@ const esTA = require('../../../node_modules/timeago.js/locales/es'); const defaultLanguage = 'en'; let translations = {}; - -// ToDo: Get this into the load translations to not load everything the whole time ->> -// Add es timeago locale for the timeago registration. -time.register('es', esTA); -let timeagoInstance = time(); +let timeagoInstance; const fetchTranslations = (locale) => { translations = require(`json-loader!yaml-loader!../locales/${locale}.yml`)[locale]; @@ -42,6 +38,11 @@ export const loadTranslations = (new_translations) => { const locale = getLocale(); setLocale(locale); + // ToDo: Get this into the load translations to not load everything the whole time ->> + // Add es timeago locale for the timeago registration. + time.register('es', esTA); + timeagoInstance = time(); + // If we have a translations file, let's use that one. // Otherwise get the core translations. if (new_translations !== undefined) {