Trans Component namespace
See original GitHub issueDescribe the bug When using Trans component in conjunction with useTranslation hook namespace set in hook is not used for translation inside component.
const [t] = useTranslation('ns');
<Trans t={t} i18nKey="some.key">
Placeholder
</Trans>
Deducting from debug info Trans component use translation
namespace instead of ns
. When I explicitly specify namespace in key it works as intended (<Trans i18nKey="ns:some.key">...
) as well as when namespace is declared through ns="ns"
prop, but from what I can remember using t
namespace worked before.
Occurs in react-i18next version v10.11.0
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:12 (9 by maintainers)
Top Results From Across the Web
Trans Component - react-i18next documentation
transSupportBasicHtmlNodes · true · Enables keeping the name of simple nodes (e.g. <br/> ) in translations instead of indexed keys.
Read more >Developer's guide to internationalization
Step by step how to internationalize your i18n component ... Note: Please provide the current namespace to Trans component by passing ns="currentModule" and ......
Read more >A Guide to React Localization with i18next | Phrase
We're using the default, translation , namespace here. If we were to load our app at this point, we would get an error...
Read more >How to use the Trans component for bold or italicized text in ...
Solved the issue. The problem is that I wasn't passing in the namespace of my translation file correctly to the Trans component.
Read more >i18next-scanner - npm
defaultNs. Type: String Default: 'translation'. The default namespace used if not passed to translation function. defaultValue.
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
@kachkaev should be fixed in react-i18next@10.11.1
It fixes by taking the passed in
t
function … not by magically pass the one from withTranslation to the Trans component.