Read the Next.js Docs to learn more about implementing I18n in Next.js.
Initialize i18n with CLI.
Define the i18n configurations in a file, we will import it with @/ilb/i18n
in this guide.
Change your current source configurations.
Update the usages to your source:
Create a middleware that redirects users to appropriate locale.
See Middleware for customisable options.
Create a dynamic route /app/[lang]
, and move all special files from /app
to
the folder.
A I18nProvider
is needed for localization. Wrap the root provider inside your I18n provider.
Make sure to update references to source
and configure Static Site Generation correctly.
see Page Conventions to learn how to organize your documents.
Configure i18n on your search solution.
For Flexsearch, you don't need further changes if you're using the createFromSource
shortcut. See Search I18n.
We only provide English translation by default, you have to pass your translations to the provider.
To allow users changing their language, enable i18n
on your layouts.