Closed addlistener closed 5 months ago
Another potential feature request: provide messages on a page level ( just like https://next-intl-docs.vercel.app/docs/getting-started/pages-router)
I guess even if I successfully make the above work. There will be another problem which is the full set of message keys are loaded in any single page. It will be unnecessary overhead.
I nailed it. pageProps.locale should be of type BaseLocale
Another potential feature request: provide messages on a page level ( just like https://next-intl-docs.vercel.app/docs/getting-started/pages-router)
I guess even if I successfully make the above work. There will be another problem which is the full set of message keys are loaded in any single page. It will be unnecessary overhead.
I nailed it as well. picking the keys in pageProps.locale
works
My goal
i18n SSR or SSG for pages dir
The problem
the html generated from SSR or SSG is empty because no locale are provided on the server.
Known solution
next-intl seems have it by
router.locale
. https://next-intl-docs.vercel.app/docs/getting-started/pages-routerMy detailed question -> how to construct pageProps.locale ?
I followed the docs for pages dir https://next-international.vercel.app/docs/pages-setup
If I log
_app.tsx
pageProps.locale
in server I get undefinedSo I constructed it manually. Following the structure below https://github.com/QuiiBz/next-international/blob/a049386f43bf2c42a2b3ed9b8d3e82b42ff9eebe/packages/next-international/src/pages/create-i18n-provider.tsx#L69-L76
All I get is the message keys instead of the message values
Anything recommended I can do?
Versions
=> Found "next-international@1.2.4" => Found "next@14.1.4"