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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
If I try to translate a key which includes a namespace and a space, but doesn't include a key separator, the key is not translated.
const i18next = require('i18next') i18next.init({ lng: 'en', resources: { en: { translation: { errorCodes: { 'UNAUTHORIZED': 'Unauthorized', 'BAD REQUEST': 'Bad request' }, 'UNAUTHORIZED': 'Unauthorized', 'BAD REQUEST': 'Bad request' } } } }) let errorCode = 'UNAUTHORIZED' console.log(i18next.t(`translation:errorCodes.${errorCode}`)) console.log(i18next.t(`translation:${errorCode}`)) console.log(i18next.t(`${errorCode}`, {ns: 'translation'})) errorCode = 'BAD REQUEST' console.log(i18next.t(`translation:errorCodes.${errorCode}`)) console.log(i18next.t(`translation:${errorCode}`)) console.log(i18next.t(`${errorCode}`, {ns: 'translation'}))
With version 20.6.1, the code above prints
Unauthorized Unauthorized Unauthorized Bad request Bad request Bad request
With version 21.2.0, it prints
Unauthorized Unauthorized Unauthorized Bad request translation:BAD REQUEST Bad request
(This is very similar to #1661, but includes namespaces, which that defect did not.)
The text was updated successfully, but these errors were encountered:
This is because of of the new natural language detection feature... https://www.i18next.com/misc/migration-guide#natural-language-detection The only way to omit that check is to provide the keySeparator option with the new v21.2.1
Sorry, something went wrong.
Great! We already have ns and key separators set, so I'll just upgrade to 21.2.1 now that it's available. Thanks.
No branches or pull requests
🐛 Bug Report
If I try to translate a key which includes a namespace and a space, but doesn't include a key separator, the key is not translated.
To Reproduce
Expected behavior
With version 20.6.1, the code above prints
Unauthorized
Unauthorized
Unauthorized
Bad request
Bad request
Bad request
With version 21.2.0, it prints
Unauthorized
Unauthorized
Unauthorized
Bad request
translation:BAD REQUEST
Bad request
Your Environment
(This is very similar to #1661, but includes namespaces, which that defect did not.)
The text was updated successfully, but these errors were encountered: