[i18n] Date and time
parent
91745a7010
commit
83e7434d27
|
@ -6,4 +6,3 @@ lang_map = sr@latin:sr_Latn, zh_CN:zh_Hans, zh_TW:zh_Hant
|
|||
file_filter = app/locales/locale-<lang>.json
|
||||
source_file = app/locales/locale-en.json
|
||||
source_lang = en
|
||||
type = PO
|
||||
|
|
|
@ -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) ->
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
},
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue