mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-21 16:06:16 -04:00
[html10n] Don't expose lang code, if the language is not available
This commit is contained in:
parent
7aba02f0cf
commit
23b7469df6
1 changed files with 5 additions and 3 deletions
|
@ -662,6 +662,7 @@ window.html10n = (function(window, document, undefined) {
|
||||||
|
|
||||||
html10n.get = function(id, args) {
|
html10n.get = function(id, args) {
|
||||||
var translations = html10n.translations
|
var translations = html10n.translations
|
||||||
|
if(!translations) return consoleWarn('No translations available (yet)')
|
||||||
if(!translations[id]) return consoleWarn('Could not find string '+id)
|
if(!translations[id]) return consoleWarn('Could not find string '+id)
|
||||||
|
|
||||||
// apply args
|
// apply args
|
||||||
|
@ -804,7 +805,8 @@ window.html10n = (function(window, document, undefined) {
|
||||||
// loop through priority array...
|
// loop through priority array...
|
||||||
for (var i=0, n=langs.length; i < n; i++) {
|
for (var i=0, n=langs.length; i < n; i++) {
|
||||||
lang = langs[i]
|
lang = langs[i]
|
||||||
if(!lang) continue;
|
|
||||||
|
if(!lang || !(lang in that.loader.langs)) continue;
|
||||||
|
|
||||||
// ... and apply all strings of the current lang in the list
|
// ... and apply all strings of the current lang in the list
|
||||||
// to our build object
|
// to our build object
|
||||||
|
@ -814,7 +816,7 @@ window.html10n = (function(window, document, undefined) {
|
||||||
|
|
||||||
// the last applied lang will be exposed as the
|
// the last applied lang will be exposed as the
|
||||||
// lang the page was translated to
|
// lang the page was translated to
|
||||||
that.language = langs[lang]
|
that.language = lang
|
||||||
}
|
}
|
||||||
cb(null, build)
|
cb(null, build)
|
||||||
})
|
})
|
||||||
|
@ -825,7 +827,7 @@ window.html10n = (function(window, document, undefined) {
|
||||||
* thus overriding most of the formerly applied langs
|
* thus overriding most of the formerly applied langs
|
||||||
*/
|
*/
|
||||||
html10n.getLanguage = function() {
|
html10n.getLanguage = function() {
|
||||||
this.language
|
return this.language;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue