FIX: Ignore if the default localization node is not an object (#5439)

This commit is contained in:
Vinoth Kannan 2017-12-27 11:23:53 +05:30 committed by Sam
parent f1f2ae594c
commit d18c42abd5
2 changed files with 10 additions and 1 deletions

View File

@ -55,7 +55,9 @@ export default {
node = node[segs[i]];
}
node[segs[segs.length-1]] = v;
if (typeof node === "object") {
node[segs[segs.length-1]] = v;
}
});
}

View File

@ -41,3 +41,10 @@ QUnit.test("translation overrides", function(assert) {
assert.equal(I18n.t("composer.reply"), "WAT", "overrides existing translation in current locale");
assert.equal(I18n.t("topic.reply.help"), "foobar", "overrides translation in default locale");
});
QUnit.test("skip translation override if parent node is not an object", function(assert) {
PreloadStore.store('translationOverrides', {"js.composer.reply":"WAT","js.composer.reply.help":"foobar"});
LocalizationInitializer.initialize(this.registry);
assert.equal(I18n.t("composer.reply.help"), "[fr.composer.reply.help]");
});