DEV Community

Cover image for Next.js: Internationalisation (i18n) for the `app directory`
Martin Krause
Martin Krause

Posted on

5

Next.js: Internationalisation (i18n) for the `app directory`

A while ago, we released version 3.0.0 of next-export-i18n, the most popular i18n module for Next.js, which is fully compatible with next export.

Version 3.0.0 fully supports the app directory and comes with the highly sought-after feature of storing the selected language in localStorage instead of the search parameter on the URL.

The case for next-export-i18n

Since v10.0.0 Next.js has an out-of-the-box support for internationalised (i18n) routing and it streamlines the touring and locale parsing for nearly all existing l18n library solutions available for Next.js, for example, react-intl, react-i18next, lingua, rosetta, next-intl.

Those are amazing libraries, but unfortunately, next.js' i18n-routing does not support statically exported pages that you create with next export or the config: export property.

With next-export-i18n, you can easily add internationalisation (i18n) to your h actual static exported pages by operating exclusively on the client side.

For the page router

In case you're using the page router please use version 2.x of next-export-i18n with npm install --save-dev next-export-i18n@^2

Migrating your code

In case you're migrating from the page router to the app directory, please look at the 2.x to 3.x Migration guide.

Top comments (0)

AWS Security LIVE!

Tune in for AWS Security LIVE!

Join AWS Security LIVE! for expert insights and actionable tips to protect your organization and keep security teams prepared.

Learn More