Notes:
- The compiler looks for occurences of
<NextIntlClientProvider messages="auto">
- For every occurence, the module graph is traversed (static imports as well as lazy references), looking for client entry points.
- The namespaces within client module graphs are collected (e.g.
useTranslations('ns1')
) - The provider is replaced with something like
<NextIntlClientProvider messages={pick(useMessages(), ['ns1', 'ns2'])} />
<NextIntlClientProvider messages="auto">
must be rendered in a Server Component whenmessages="auto"
is used- The compiler doesn't traverse nested segments. This is important, as it will not pull messages from segments that might not render into parent layouts.
Open questions:
- When `` is used in a layout, do we auto detect sibling entry points (
page
, `not-found`, …) and traverse those too? Or should the provider be explicitly used in each file and we only follow module references? Consider that `error.tsx` must be a Client Componen