The Essential Next.js build plugin now supports next-i18next by default – no extra config needed. If you’re not familiar with it, next-18next
manages translation of your content in a Next.js app by providing a few React hooks & Higher-Order Components. The package grabs translated strings from the files in your public/locales
directory and displays them on the correct language route. The package works with Next’s own internationalized routing to help you build a more complete internationalized site.
You can use next-i18next
by including the locale files in your public directory ( public/locales/**
) and creating a next-i18next.config.js
file in your project’s root.
The next-i18next.config.js
file contains information about the locales you support.
// next-i18next.config.js
module.exports = {
i18n: {
defaultLocale: 'en',
locales: ['en', 'fr'], // Supports English and French
},
}