We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi, First sorry if it is not a bug, but perhaps it deserves a word in the documentation if not.
It's about reusing the same base translation for different namespaces, and doing it using the same object for base.
As the sample code shows, the function addResouceBundle mutates its third parameters, leading to confusion
https://codesandbox.io/p/sandbox/test-z3hr2l
import i18n from "i18next"; const base = { k1: { k2: "v" } }; i18n.init({ fallbackLng: "en"}) .then((t) => { i18n.addResourceBundle("en", "ns1", base); i18n.addResourceBundle( "en", "ns1", { k1: { k2: "v for ns1" } }, true, true ); // reusing base : fail i18n.addResourceBundle("en", "ns2", base); // work : i18n.addResourceBundle('en', 'ns2', deepCopy(base)} i18n.addResourceBundle( "en", "ns2", { k1: { k2: "v for ns2" } }, true, true ); console.log({ translated: t("ns1:k1.k2") }); document.getElementById("app")!.innerHTML = `t("ns1:k1.k2")=${t( "ns1:k1.k2" )}`; });
Naively expecting : "v for ns1", but get "v for ns2" instead.
Maybe a deepcopy done by the library itself, so that it prints v for ns1 or a few word accompagnying the document for addResourceBundle
v for ns1
addResourceBundle
The text was updated successfully, but these errors were encountered:
d2d7608
should be addressed with v23.8.3
Sorry, something went wrong.
No branches or pull requests
馃悰 Bug Report
Hi, First sorry if it is not a bug, but perhaps it deserves a word in the documentation if not.
It's about reusing the same base translation for different namespaces, and doing it using the same object for base.
As the sample code shows, the function addResouceBundle mutates its third parameters, leading to confusion
To Reproduce
https://codesandbox.io/p/sandbox/test-z3hr2l
Expected behavior
Naively expecting : "v for ns1", but get "v for ns2" instead.
Maybe a deepcopy done by the library itself, so that it prints
v for ns1
or a few word accompagnying the document foraddResourceBundle
Your Environment
The text was updated successfully, but these errors were encountered: