IntlPull
Tutorial
14 min read

Next.js Pages Router avec next-i18next : Tutoriel i18n Complet 2026

Guide complet pour configurer next-i18next dans Next.js Pages Router. Configuration, serverSideTranslations et gestion des namespaces.

IntlPull Team
IntlPull Team
03 Feb 2026, 11:44 AM [PST]
On this page
Summary

Guide complet pour configurer next-i18next dans Next.js Pages Router. Configuration, serverSideTranslations et gestion des namespaces.

Réponse Rapide

Pour utiliser next-i18next : Installez le package, créez next-i18next.config.js, enveloppez _app.tsx avec appWithTranslation et utilisez serverSideTranslations.


Installation

Terminal
npm install next-i18next react-i18next i18next

Configuration

next-i18next.config.js:

JavaScript
1module.exports = {
2  i18n: {
3    defaultLocale: 'fr',
4    locales: ['fr', 'en', 'es'],
5  },
6};

Traductions

public/locales/fr/common.json:

JSON
1{
2  "salutation": "Bonjour, {{name}} !",
3  "items_one": "{{count}} article",
4  "items_other": "{{count}} articles"
5}

Utilisation

TSX
1import { serverSideTranslations } from 'next-i18next/serverSideTranslations';
2import { useTranslation } from 'next-i18next';
3
4export default function Accueil() {
5  const { t } = useTranslation('common');
6  return <h1>{t('salutation', { name: 'Monde' })}</h1>;
7}
8
9export const getStaticProps = async ({ locale }) => ({
10  props: {
11    ...(await serverSideTranslations(locale, ['common'])),
12  },
13});

Articles Connexes

Tags
next.js
next-i18next
pages-router
i18n
tutorial
ssr
2026
IntlPull Team
IntlPull Team
Engineering

Building tools to help teams ship products globally. Follow us for more insights on localization and i18n.