Internationalization capabilities with a full static site (i.e. serverless)
Inability to compile a static site with all language ahead of time.
A clear and concise description of what you want and what your use case is.
The ability to provide a static site with multiple languages pre-compiled.
Working on a solution to this (and other static site permutations) with @iliapir — we are experimenting with:
<Experiment>/<Variant> pairs; in OP's case maybe a <LanguageProvider>)pages/faqs might have language permutations en & esgetStaticPaths, + using getStaticProps to compute which permutation to showpages/faqs might emit pages/faqs_-_en & pages/faqs_-_es@FarhadG does this sound like an approach that will solve your statically-compiled internationalization needs? @timneutkens does this look like the right approach within Next.js?
Early feedback is much appreciated, as we suspect this will require monkeying in next/build/utils.ts#isPageStatic (e.g. by wrapping mod.getStaticPaths). If our spike works out, we expect to have a PR ready for comments in a week or three.
@BiscuiTech @AlexOros — a week or three was a little ambitious. But the PR is up and good to go! #14454
Note that the CI error is due to the addition of a path parameter passed to getStaticProps({ params: { path } }) for files w/o a dynamic segment.
Please see the following RFC for first-class i18n support in Next.js:
https://github.com/vercel/next.js/discussions/17078
Thanks!
Most helpful comment
@BiscuiTech @AlexOros — a week or three was a little ambitious. But the PR is up and good to go! #14454
Note that the CI error is due to the addition of a
pathparameter passed togetStaticProps({ params: { path } })for files w/o a dynamic segment.