parent
7cbce4543e
commit
402a4b7b3e
|
@ -178,7 +178,6 @@ window.html10n = (function(window, document, undefined) {
|
|||
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
|
||||
|
@ -668,6 +667,14 @@ window.html10n = (function(window, document, undefined) {
|
|||
// 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)
|
||||
|
|
Loading…
Reference in New Issue