summaryrefslogtreecommitdiff
path: root/src/static/js/html10n.js
diff options
context:
space:
mode:
authorMarcel Klehr <mklehr@gmx.net>2012-12-19 22:20:34 +0100
committerMarcel Klehr <mklehr@gmx.net>2012-12-23 18:17:14 +0100
commit23b7469df6426b53f1405ac6e486dbd9cf6d1480 (patch)
tree09ab7e721a5a88e49d4236154d7d903821cc4ca0 /src/static/js/html10n.js
parent7aba02f0cf20cd475bc6a4186c2113d347b16fbe (diff)
downloadetherpad-lite-23b7469df6426b53f1405ac6e486dbd9cf6d1480.zip
[html10n] Don't expose lang code, if the language is not available
Diffstat (limited to 'src/static/js/html10n.js')
-rw-r--r--src/static/js/html10n.js8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/static/js/html10n.js b/src/static/js/html10n.js
index 7502856f..9769272f 100644
--- a/src/static/js/html10n.js
+++ b/src/static/js/html10n.js
@@ -662,6 +662,7 @@ window.html10n = (function(window, document, undefined) {
html10n.get = function(id, args) {
var translations = html10n.translations
+ if(!translations) return consoleWarn('No translations available (yet)')
if(!translations[id]) return consoleWarn('Could not find string '+id)
// apply args
@@ -804,7 +805,8 @@ window.html10n = (function(window, document, undefined) {
// loop through priority array...
for (var i=0, n=langs.length; i < n; 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
// to our build object
@@ -814,7 +816,7 @@ window.html10n = (function(window, document, undefined) {
// the last applied lang will be exposed as the
// lang the page was translated to
- that.language = langs[lang]
+ that.language = lang
}
cb(null, build)
})
@@ -825,7 +827,7 @@ window.html10n = (function(window, document, undefined) {
* thus overriding most of the formerly applied langs
*/
html10n.getLanguage = function() {
- this.language
+ return this.language;
}
/**