diff options
author | Marcel Klehr <mklehr@gmx.net> | 2013-04-05 14:18:46 +0200 |
---|---|---|
committer | Marcel Klehr <mklehr@gmx.net> | 2013-04-05 14:18:46 +0200 |
commit | 402a4b7b3ec5cd04fd3d423581f12bb7f3787158 (patch) | |
tree | 3364d74e5f6a3075fc115363c34c9319ff97c0d6 /src/static/js/html10n.js | |
parent | 7cbce4543e8d8e834d755b9563999e5a85781fd7 (diff) | |
download | etherpad-lite-402a4b7b3ec5cd04fd3d423581f12bb7f3787158.zip |
html10n.js: Finally fix two-part locale specs
fixes #1706
Diffstat (limited to 'src/static/js/html10n.js')
-rw-r--r-- | src/static/js/html10n.js | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/static/js/html10n.js b/src/static/js/html10n.js index aa53a266..406409ad 100644 --- a/src/static/js/html10n.js +++ b/src/static/js/html10n.js @@ -177,8 +177,7 @@ window.html10n = (function(window, document, undefined) { cb(new Error('A file couldn\'t be parsed as json.')) return } - - if (!data[lang]) lang = lang.substr(0, lang.indexOf('-') == -1? lang.length : lang.indexOf('-')) + if (!data[lang]) { cb(new Error('Couldn\'t find translations for '+lang)) return @@ -667,7 +666,15 @@ window.html10n = (function(window, document, undefined) { var that = this // if only one string => create an array if ('string' == typeof langs) langs = [langs] - + + // Expand two-part locale specs + var i=0 + langs.forEach(function(lang) { + if(!lang) return + langs[i++] = lang + if(~lang.indexOf('-')) langs[i++] = lang.substr(0, lang.indexOf('-')) + }) + this.build(langs, function(er, translations) { html10n.translations = translations html10n.translateElement(translations) |