diff --git a/lib/utils/language.js b/lib/utils/language.js index 91b3747..501fdd2 100644 --- a/lib/utils/language.js +++ b/lib/utils/language.js @@ -35,18 +35,20 @@ define(['polyglot', 'moment', 'helper'], function (Polyglot, moment, helper) { function setTranslation(json) { _.extend(json); - moment.locale(_.locale(), { - longDateFormat: { - LT: 'HH:mm', - LTS: 'HH:mm:ss', - L: 'DD.MM.YYYY', - LL: 'D. MMMM YYYY', - LLL: 'D. MMMM YYYY HH:mm', - LLLL: 'dddd, D. MMMM YYYY HH:mm' - }, - calendar: json.momentjs.calendar, - relativeTime: json.momentjs.relativeTime - }); + if (moment.locale(_.locale()) !== _.locale()) { + moment.defineLocale(_.locale(), { + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D. MMMM YYYY', + LLL: 'D. MMMM YYYY HH:mm', + LLLL: 'dddd, D. MMMM YYYY HH:mm' + }, + calendar: json.momentjs.calendar, + relativeTime: json.momentjs.relativeTime + }); + } } window._ = new Polyglot({ locale: getLocale(), allowMissing: true });