To implement internationalization (i18n) in your Next.js application, make sure to include the following configuration in your next.config.js
file:
// next.config.js
module.exports = {
i18n: {
// List all the locales you want to support in your app
locales: ['en-US', 'fr', 'nl-NL'],
// Set the default locale for non-prefixed paths
defaultLocale: 'en-US',
// Define locale domains and their default locale (needed for domain routing)
// Note: Include subdomains in the domain value for matching e.g. "fr.example.com"
domains: [
{
domain: 'example.com',
defaultLocale: 'en-US',
},
{
domain: 'example.nl',
defaultLocale: 'nl-NL',
},
{
domain: 'example.fr',
defaultLocale: 'fr',
},
],
},
}
For more information and examples about setting up internationalized routing in Next.js, refer to the official documentation.