Are there cases when t
macro is not wrapped with i18n._()
?
#1043
Replies: 1 comment 5 replies
-
Hello, great to hear that you're migrating to v3! Getting adoption on v3 will make the release more stable. About the Runtime error of React, a huge project written with React Native had the same issues but I couldn't replicate it to try to fix it. If you have the possibility to share with me a piece of code where i can run the project and debug Lingui, I'll try my best to fix this issue. About lazy translations, the correct way of using lazy translations it's to use
This sometimes is occurred about how i18n.load() it's imported, since it's a singleton instance. These are extrange errors and I can only help with a reproduction code :/ |
Beta Was this translation helpful? Give feedback.
-
Hi, I'm migrating our app Next.js app to Lingui v3 and we primarily use:
All
withI18n
,useLingui
,<I18n>
, etc. are gone 🙏Everything seems to be working, but there are a few cases when the
t
macro isn't wrapped ini18n._()
becase we get aUnhandled Runtime Error
from React:Error: Objects are not valid as a React child (found: object with keys {id}). If you meant to render a collection of children, use an array instead.
We have a few lazy translations, which are defined outside of our components. Some are in functions, which are then called in our components with a parameter to return the correct translation. Some are exported as a JS object (a config of sorts) spread onto component props.
But the weird thing is that one of these helper functions works ok, while others don't and need to be manually wrapped with
i18n._t()
at the call site. Second weird thing is that sometimes it seems to work when I just addimport { i18n } from @lingui/core
and leave it there without using it.Beta Was this translation helpful? Give feedback.
All reactions