-
Notifications
You must be signed in to change notification settings - Fork 164
Description
If the first load of language strings is the following:
var version = {
"qi18n-appversion": "1.21.4.170",
};
$.i18n().load({
"en": version,
"nl": version,
});
then it appears that the single "version" JavaScript object will be used to store additional strings for each language.
If you then load:
$.i18n().load({
"en": { "qi18n-foo": "foo" },
"nl": { "qi18n-foo": "bar" }
});
all translations of all languages "en" and "nl" of "qi18n-foo" end up coming out as "bar".
If you reverse the order of the two loads everything works fine, because the strings from "version" are then instead merged into each unique internal object for each language.
Ideally, the load function of the library should always create new empty internal objects for each new language internally and then merge any newly loaded strings into them from parameters, possibly from single "versions"-like objects.
Not terribly important except that it cost me a day to figure out why all my strings were always the "nl" version, no matter what locale I set. Reversing the order of the language strings in the loads made them all come out the "en" translation.