diff --git a/.tx/config b/.tx/config index ff559341..4cf4f302 100644 --- a/.tx/config +++ b/.tx/config @@ -6,4 +6,3 @@ lang_map = sr@latin:sr_Latn, zh_CN:zh_Hans, zh_TW:zh_Hant file_filter = app/locales/locale-.json source_file = app/locales/locale-en.json source_lang = en -type = PO diff --git a/app/coffee/app.coffee b/app/coffee/app.coffee index c8f666f0..a38b3625 100644 --- a/app/coffee/app.coffee +++ b/app/coffee/app.coffee @@ -244,7 +244,7 @@ configure = ($routeProvider, $locationProvider, $httpProvider, $provide, $tgEven if not window.taigaConfig.debugInfo $translateProvider.fallbackLanguage(preferedLangCode) - moment.lang(preferedLangCode) + moment.locale(preferedLangCode) init = ($log, $config, $rootscope, $auth, $events, $analytics, $translate) -> diff --git a/app/coffee/modules/auth.coffee b/app/coffee/modules/auth.coffee index 1cd8d4d9..adf2f498 100644 --- a/app/coffee/modules/auth.coffee +++ b/app/coffee/modules/auth.coffee @@ -40,6 +40,11 @@ class AuthService extends taiga.Service constructor: (@rootscope, @storage, @model, @rs, @http, @urls, @translate) -> super() + _setLocales: -> + if @rootscope.user.lang + @translate.use(@rootscope.user.lang) + moment.locale(@rootscope.user.lang) + getUser: -> if @rootscope.user return @rootscope.user @@ -48,6 +53,7 @@ class AuthService extends taiga.Service if userData user = @model.make_model("users", userData) @rootscope.user = user + @._setLocales() return user return null @@ -57,9 +63,7 @@ class AuthService extends taiga.Service @storage.set("userInfo", user.getAttrs()) @rootscope.user = user - if @rootscope.user.lang - @translate.use(@rootscope.user.lang) - moment.lang(@rootscope.user.lang) + @._setLocales() clear: -> @rootscope.auth = null diff --git a/bower.json b/bower.json index 0b62786e..aa4355ca 100644 --- a/bower.json +++ b/bower.json @@ -68,7 +68,7 @@ "flot-orderBars": "emmerich/flot-orderBars", "flot-axislabels": "markrcote/flot-axislabels", "flot.tooltip": "~0.8.4", - "moment": "~2.6.0", + "moment": "~2.10.2", "isMobile": "~0.3.1", "favico.js": "0.3.4", "Sortable": "~0.1.8", @@ -82,7 +82,7 @@ }, "resolutions": { "lodash": "~2.4.1", - "moment": "~2.6.0", + "moment": "~2.10.2", "jquery": "~2.1.1", "angular": "1.3.11" }, diff --git a/gulpfile.js b/gulpfile.js index b630327c..82f82a83 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -125,7 +125,7 @@ paths.libs = [ paths.vendor + "angular-translate-loader-static-files/angular-translate-loader-static-files.js", paths.vendor + "angular-translate-interpolation-messageformat/angular-translate-interpolation-messageformat.js", paths.vendor + "i18next/i18next.js", - paths.vendor + "moment/min/moment-with-langs.js", + paths.vendor + "moment/min/moment-with-locales.js", paths.vendor + "checksley/checksley.js", paths.vendor + "pikaday/pikaday.js", paths.vendor + "jquery-flot/jquery.flot.js", diff --git a/scripts/manage_translations.py b/scripts/manage_translations.py index 751bf45d..7c265080 100644 --- a/scripts/manage_translations.py +++ b/scripts/manage_translations.py @@ -26,6 +26,12 @@ from argparse import RawTextHelpFormatter from subprocess import PIPE, Popen, call +FIXED_LOCALES = { + "zh-Hant": "zh-hant" + "zh-Hans": "zh-hans" +} + + def _tx_resource_for_name(name): """ Return the Transifex resource name """ return "taiga-front.{}".format(name) @@ -45,10 +51,18 @@ def fetch(resources=None, languages=None): else: for resource in resources: if languages is None: - call("tx pull -r {res} -a -f --minimum-perc=5".format(res=_tx_resource_for_name(resource)), shell=True) + call("tx pull -r {res} -a -f --minimum-perc=5".format(res=_tx_resource_for_name(resource)), + shell=True) else: for lang in languages: - call("tx pull -r {res} -f -l {lang}".format(res=_tx_resource_for_name(resource), lang=lang), shell=True) + call("tx pull -r {res} -f -l {lang}".format(res=_tx_resource_for_name(resource), lang=lang), + shell=True) + + if languages: + for lang in languages: + if lang in FIXED_LOCALES: + os.rename("app/locales/locale-{}.json".format(lang), + "app/locales/locale-{}.json".format(FIXED_LOCALES[lang])) def commit(resources=None, languages=None):