Loads timeago translation when loading translations.

This commit is contained in:
gaba
2017-05-18 15:38:53 -07:00
parent 3ca22bd101
commit 1a7ad410f5
+6 -5
View File
@@ -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) {