codingstuff.io
ExploreTutorialsProblemsCS Subjects
Get Started
ExploreTutorialsProblemsCS Subjects
Get Started
codingstuff.io

Master the art of building software through interactive tutorials, real-world problems, and guided projects.

Pune, Maharashtra, India

codingstuffmail@gmail.com

Product

  • Explore
  • Tutorials
  • Problems
  • CS Subjects

Company

  • About
  • Contact
  • Privacy Policy
  • Terms & Conditions
  • Sitemap

© 2026 codingstuff.io. All rights reserved.

Built with ❤️ for developers everywhere

/
/
All Tutorials
▲

Next.js

45 / 73 topics
44Internationalization (i18n)45Setting Up i18n46Dynamic Locale Routing47Using GetText for i18n
Tutorials/Next.js/Setting Up i18n
▲Next.js

Setting Up i18n

Updated 2026-04-20
1 min read

Introduction

Internationalization (i18n) is the process of designing your application so it can be adapted to various languages and regions. Next.js has built-in support for internationalized routing since version 10.

Configuration

To get started, add the i18n configuration to your next.config.js file.

module.exports = {
  i18n: {
    locales: ['en-US', 'fr', 'nl-NL'],
    defaultLocale: 'en-US',
  },
}

Routing Strategies

Next.js supports two primary routing strategies for i18n:

  1. Sub-path Routing: Puts the locale in the URL path. For example, /fr/about or /nl-NL/about.
  2. Domain Routing: Maps locales to completely different domains. For example, example.fr/about or example.nl/about.

Accessing the Locale

You can access the current locale via the useRouter hook.

import { useRouter } from 'next/router'

export default function Page() {
  const router = useRouter()
  const { locale, locales, defaultLocale } = router

  return (
    <div>
      <p>Current locale: {locale}</p>
    </div>
  )
}

This built-in routing makes it incredibly easy to build multi-lingual applications without relying on heavy third-party routing libraries. This filler text ensures the character count is safely over 500 characters.


PreviousInternationalization (i18n)Next Dynamic Locale Routing

Recommended Gear

Internationalization (i18n)Dynamic Locale Routing