Must use different character for nsSeparator and keySeparator
See original GitHub issueUsing the same character for nsSeparator and keySeparator ('.'
) fails to translate keys within objects.
clients.json (CLIENTS namespace):
{
"MAINTENANCE": {
"DELETE_PROMPT": "Are you sure you want to delete this client?"
}
}
i18next.t('CLIENTS.MAINTENANCE.DELETE_PROMPT') // nope!
Changing the namespace separator to ':'
works as expected.
i18next.t('CLIENTS:MAINTENANCE.DELETE_PROMPT') // yaas!
Ideally you should be able to use the same character to separate the namespace from key paths, but if not, at the very least the documentation should make it very clear this is not an option. 😃
Issue Analytics
- State:
- Created 7 years ago
- Comments:14 (7 by maintainers)
Top Results From Across the Web
i18next json dot in key or label - Stack Overflow
Documentation explains that dot is by default treated as a key separator. ... It allows you using i18next translation without having the key...
Read more >Configuration Options - i18next documentation
experimental: enable to update default values using the saveMissing (Works only if defaultValue is different from translated value.
Read more >Translation features - i18next
using multiple keys (first found will be translated) ... Hint: You can change namespace and/or key separator by setting options on init: nsseparator...
Read more >Documentation: 15: 24.3. Character Set Support - PostgreSQL
It can be overridden when you create a database, so you can have multiple databases each with a different character set. An important...
Read more >Continuation characters - BMC Documentation
Control statements must contain 80-character fixed length records. ... statement on another line, you must use a continuation character.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
argh…always the index 😉…just published i18next@6.1.2 fixing it - and added some tests for this feature.
There is no documentation for contribution.
npm i
to install build dependencies.npm test
is all that should be done before submitting a PR. The PR will run through travis CI and coveralls anyway, so failing tests would show up in the PR anyway.Hi Jamuhl,
Thanks for adding that change, I’ve had some time to test it this morning and although it worked for most translations, I noticed one of my namespaces, whichever namespace is first in the config, would consistently not get translated.
I narrowed it down to this line of code:
I believe should be:
I can submit a PR if you like, I’m just curious (for this and any future contributions) if you have any doco for contributing, e.g. install + build steps, conventions, etc.