Index: i18n.js |
=================================================================== |
--- a/i18n.js |
+++ b/i18n.js |
@@ -65,20 +65,30 @@ |
// Loads i18n strings |
function loadI18nStrings() |
{ |
- var nodes = document.querySelectorAll("[class^='i18n_']"); |
- for(var i = 0; i < nodes.length; i++) |
+ function addI18nStringsToElements(nodes) |
Thomas Greiner
2016/01/25 15:40:29
Detail: You're calling them "elements" everywhere
saroyanm
2016/01/26 18:36:16
Done.
|
{ |
- var node = nodes[i]; |
- var arguments = JSON.parse("[" + node.textContent + "]"); |
- if (arguments.length == 0) |
- arguments = null; |
+ for(var i = 0; i < nodes.length; i++) |
+ { |
+ var node = nodes[i]; |
+ var arguments = JSON.parse("[" + node.textContent + "]"); |
+ if (arguments.length == 0) |
+ arguments = null; |
- var className = node.className; |
- if (className instanceof SVGAnimatedString) |
- className = className.animVal; |
- var stringName = className.split(/\s/)[0].substring(5); |
+ var className = node.className; |
+ if (className instanceof SVGAnimatedString) |
+ className = className.animVal; |
+ var stringName = className.split(/\s/)[0].substring(5); |
- ext.i18n.setElementText(node, stringName, arguments); |
+ ext.i18n.setElementText(node, stringName, arguments); |
+ } |
+ } |
+ addI18nStringsToElements(document.querySelectorAll("[class^='i18n_']")); |
Thomas Greiner
2016/01/25 15:40:29
Detail: You're always calling this function using
saroyanm
2016/01/26 18:36:16
Done.
|
+ var templates = document.querySelectorAll("template"); |
Thomas Greiner
2016/01/25 15:40:30
Detail: Please add a short comment to explain why
saroyanm
2016/01/26 18:36:17
Done.
|
+ for (var i = 0; i < templates.length; i++) |
+ { |
+ var nodes = templates[i].content.querySelectorAll("[class^='i18n_']"); |
+ if (nodes.length > 0) |
+ addI18nStringsToElements(nodes); |
} |
} |