We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9eaac2a commit d7ebfbeCopy full SHA for d7ebfbe
_includes/i18n-as-script.html
@@ -8,9 +8,17 @@
8
window.i18n.active_language = {{ vars_active_language.tag | jsonify }};
9
10
// give defaults
11
- for (var key in i18n_default) {
12
- if (window.i18n.hasOwnProperty(key) === false || window.i18n[key] === null) {
13
- window.i18n[key] = i18n_default[key];
+ function copyDefaults(from, to) {
+ for (var key in from) {
+ if (from[key] !== null && typeof from[key] === 'object') {
14
+ copyDefaults(from[key], to[key] || (to[key] = {}));
15
+ continue;
16
+ }
17
+ if (to.hasOwnProperty(key) === false || to[key] === null) {
18
+ to[key] = from[key];
19
20
}
21
22
+
23
+ copyDefaults(i18n_default, window.i18n);
24
</script>
0 commit comments