Replies: 2 comments 4 replies
-
Edit Jul 15, 2024 Due to ease of use, we're now recommending passing all messages to the client side to get started: Setup for If you're interested in improving the performance of your app, you can additionally explore this section: Using internationalization in Client Components. Previous answer That's a great question! In the pages directory this was easier, because there are only Client Components (see the docs on "Providing messages" at "How can I know all the namespaces needed for a page?"). However, static properties from Client Components can't be read from Server Components, therefore this doesn't work unfortunately anymore. Supporting either such a property access within React/Next.js or a built-in compiler for |
Beta Was this translation helpful? Give feedback.
-
How to consume picked messages passed through NextIntlProvider with working typescript? |
Beta Was this translation helpful? Give feedback.
-
As suggested in the documentation, we can pass the translation as props from a server component to a client component. But this approach is getting tedious when my client component is deeply nested.
Say I have a Table which is a server component, then I will pass down a Button which can trigger a modal with Buttons inside. When I need to provide translation to the Button label, I will have to go back to the closest server component (which is the Table in this case) to pass down the translation messages (Table => Button in the Table => Modal => Button in the Modal).
This is also getting confusing as the translation messages could partially stop at each level. Is there better way to handle this kind of case?
Beta Was this translation helpful? Give feedback.
All reactions