mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-01-31 19:02:59 +01:00
parent
7cbce4543e
commit
402a4b7b3e
1 changed files with 10 additions and 3 deletions
|
@ -177,8 +177,7 @@ window.html10n = (function(window, document, undefined) {
|
||||||
cb(new Error('A file couldn\'t be parsed as json.'))
|
cb(new Error('A file couldn\'t be parsed as json.'))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!data[lang]) lang = lang.substr(0, lang.indexOf('-') == -1? lang.length : lang.indexOf('-'))
|
|
||||||
if (!data[lang]) {
|
if (!data[lang]) {
|
||||||
cb(new Error('Couldn\'t find translations for '+lang))
|
cb(new Error('Couldn\'t find translations for '+lang))
|
||||||
return
|
return
|
||||||
|
@ -667,7 +666,15 @@ window.html10n = (function(window, document, undefined) {
|
||||||
var that = this
|
var that = this
|
||||||
// if only one string => create an array
|
// if only one string => create an array
|
||||||
if ('string' == typeof langs) langs = [langs]
|
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) {
|
this.build(langs, function(er, translations) {
|
||||||
html10n.translations = translations
|
html10n.translations = translations
|
||||||
html10n.translateElement(translations)
|
html10n.translateElement(translations)
|
||||||
|
|
Loading…
Reference in a new issue