-
-
Notifications
You must be signed in to change notification settings - Fork 764
New issue
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LocaleStructure not compatibility single brackets for namespace #1090
Comments
@vechnii2007 The |
I ran into the exact same issue. A simple config like this would turn
To make custom |
hey @isaachinman, the underlying issue is that The only workaround for it at the moment is to create an empty file based on custom |
@sbekrin @vechnii2007 Yep, that's correct – I misspoke when first commenting on this issue. The |
@sbekrin your workaround worked with me, thank you. |
It took me a while to figure out how to get a custom interpolation prefix/suffix to work. I think it's a little unintuitive that changing an option that relates to how the text inside the translation files is structured has a knock-on effect to how files are loaded. After doing some digging, I came across i18next#1090 that clarifies the issue, but I feel it's worth putting this in the README. This PR does that. It's not much, but I hope you find it useful.
It took me a while to figure out how to get a custom interpolation prefix/suffix to work. I think it's a little unintuitive that changing an option that relates to how the text inside the translation files is structured has a knock-on effect to how files are loaded. After doing some digging, I came across #1090 that clarifies the issue, but I feel it's worth putting this in the README. This PR does that. It's not much, but I hope you find it useful. Co-authored-by: Isaac Hinman <[email protected]>
Describe the bug
I faced localeStructure and interpolation problem
my json is for variables with single brackets.
like this
"test": "Why {appName}?",
and i used in code
{t("test", { appName: process.env.NEXT_PUBLIC_APP_NAME })}
in the config it was stated that
now such an entry does not work, I looked in the code and found that in
node_modules/next-i18next/dist/commonjs/config/createConfig.js
you are doing a replacement
var defaultLocaleStructure = localeStructure.replace ('{{lng}}', lng) .replace ('{{ns}}', defaultNS);
If you change it to single brackets or add an entry, then everything will work.
Occurs in next-i18next version
8.1.2
Steps to reproduce
like this. Use single brackets in common.json
"test": "Why {appName}?",
and i used in code
{t("test", { appName: process.env.NEXT_PUBLIC_APP_NAME })}
Expected behaviour
Expected result, that i can use single or more brackets for localeStructure and interpolation
OS (please complete the following information)
MacOS
Chrome 89.0.4389.90
The text was updated successfully, but these errors were encountered: