js-lingui: v3 t macro not working?
I’m trying to use the t macro from @lingui/macro@3.0.0-11 in a create react app, but it doesn’t seem to actually display the translated value.
To reproduce, see https://github.com/ojii/lingui-v3-t-macro-example
I expect both h1 and h2 to show the same value, but only the one using the <Trans> macro works, the one using t just shows the message id.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 2
- Comments: 19 (6 by maintainers)
Fixed it! Since the project I’m working on was last updated 8 months ago by the owner, he was calling the
i18nconfig as (maybe in an old version it worked this way?)changed it to (after updating the library to the latest version)
and the
t()macro started working fine in a JSX file.Thanks!
setupI18nis optional now. If you use it, you should setruntimeConfigModulehttps://js-lingui-git-next.lingui-js.now.sh/ref/conf.html#runtimeconfigmodule, but unless you need something special, you’re better off using the defaulti18nfrom@lingui/core@telpochyaotl Actually, in latest pre-release I made this behavior opt-out.
https://github.com/lingui/js-lingui/blob/f44ecdd7b6f47f1230262c73a3020e128820b162/packages/react/src/I18nProvider.tsx#L64-L71