summaryrefslogtreecommitdiff
path: root/src/static/js/html10n.js
diff options
context:
space:
mode:
authorMarcel Klehr <mklehr@gmx.net>2012-12-23 16:31:50 +0100
committerMarcel Klehr <mklehr@gmx.net>2012-12-23 18:17:23 +0100
commitfdf6628cc5b6e6f50f7125939de339aa064f3d44 (patch)
tree6b56ebb7568ff806b1efdf735ed5da236076edc7 /src/static/js/html10n.js
parent04b65a0b4ecbb915a6049017347b27c03025ca3c (diff)
downloadetherpad-lite-fdf6628cc5b6e6f50f7125939de339aa064f3d44.zip
Fix html attr translation
Diffstat (limited to 'src/static/js/html10n.js')
-rw-r--r--src/static/js/html10n.js7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/static/js/html10n.js b/src/static/js/html10n.js
index 3c4e5450..ca17bb0e 100644
--- a/src/static/js/html10n.js
+++ b/src/static/js/html10n.js
@@ -735,7 +735,8 @@ window.html10n = (function(window, document, undefined) {
// get id
str.id = node.getAttribute('data-l10n-id')
if (!str.id) return
- if(!translations[str.id]) return
+
+ if(!translations[str.id]) return consoleWarn('Couldn\'t find translation key '+str.id)
// get args
if(window.JSON) {
@@ -750,6 +751,7 @@ window.html10n = (function(window, document, undefined) {
str.str = html10n.get(str.id, str.args)
+ // get attribute name to apply str to
var prop
, index = str.id.lastIndexOf('.')
, attrList = // allowed attributes
@@ -758,7 +760,6 @@ window.html10n = (function(window, document, undefined) {
, "alt": 1
, "textContent": 1
}
- // get attribute name to apply str to
if (index > 0 && str.id.substr(index + 1) in attrList) { // an attribute has been specified
prop = str.id.substr(index + 1)
} else { // no attribute: assuming text content by default
@@ -766,7 +767,7 @@ window.html10n = (function(window, document, undefined) {
}
// Apply translation
- if (node.children.length === 0) {
+ if (node.children.length === 0 || prop != 'textContent') {
node[prop] = str.str
} else {
var children = node.childNodes,