---
name: add-languages-to-nextjs-site
description: Adds another locale to a Next.js site that uses next-intl - a message catalogue, a route prefix and a language switcher. Use when the user wants a second language, a locale switcher, or next-intl message files for a new locale.
license: MIT
metadata:
  category: frontend
  tags: "nextjs,locales"
  author: johnny-bravo
  version: "1.0"
  updated: "2026-11-07"
  status: published
  aliases: "add-languages-to-nextjs-site, next-intl, locale switcher, i18n"
  source_url: "https://github.com/github/awesome-copilot/tree/5269f7ea2d6c3a9bfda5ed878b6726cf509121fd/skills/next-intl-add-language"
  source_license: MIT
  copyright: "Copyright GitHub, Inc."
  original_author: "GitHub awesome-copilot contributors (next-intl-add-language)"
  modified: "Adapted by TheSkillVault: expanded a four-line project note into a general next-intl checklist (catalogue, routing, switcher, missing keys); dropped the assumption of one fixed file layout; added gotchas and done-when."
  imported_on: "2026-11-07"
---

# Add a language to a Next.js site

A new locale needs three things: every message string, a URL the router accepts, and a control that switches locale. Copying the English file and forgetting the router leaves a 404.

## When to use
- The site already has one locale and needs another, such as Japanese or Spanish.
- A next-intl switcher lists only English.
- Message JSON exists for English and the new locale file is missing.

## When not to use
- The task is to create the Next.js project from scratch.
- The task is server components, server actions or Suspense. That is a separate checklist.
- The user pasted a block of prose and wants that block rendered in another language in chat. That is not a site change.

## Steps
1. Find the locale list, the message directory and the switcher. In a typical next-intl site those are a routing module, `messages/en.json`, middleware and a small switcher component. Use the paths this repo already has.
2. Copy the source catalogue to the new code, for example `messages/ja.json`. Fill every key in the new locale. Leave no English string behind unless the product owner asked for that key to stay.
3. Add the locale code to the routing list and to the middleware matcher so `/ja/...` is a real route.
4. Add the same code to the switcher, with a human label ("Japanese", not just `ja`).
5. Open one page in the old locale and the same page in the new locale. Click the switcher both ways.
6. Remove a key on purpose in a scratch copy, load the page, and confirm the UI shows a visible gap rather than a crash. Put the key back.
7. Read prices, dates and legal lines yourself. A wrong number is worse than a missing label.

## Gotchas
- Do not put secrets, tokens or personal data in message files. They ship to the browser.
- A locale added only in the JSON file, and not in routing, will not load.
- Dates, plurals and currency formats differ by locale. A single shared sentence often reads wrong. Split those keys.
- Keep the catalogue key identical across files. Renaming a key in one locale only breaks the other.

## Portability
This is the next-intl shape. If you use next-i18next or a hand-written dictionary, keep the same three pieces: message files, a route prefix, and a switcher. The file names differ. The checklist does not pick fonts or layout.

## Done when
- The new locale has a full message file, a working URL prefix and a switcher entry.
- Both locales render the same page, and a missing key is obvious.
- No secret sits in the message files.

## Example prompt
"Add Japanese to this Next.js site that uses next-intl. Duplicate the English messages, register ja in routing and middleware, and add it to the language switcher."

---
Adapted from "next-intl-add-language" in github/awesome-copilot (MIT, Copyright GitHub, Inc.). See LICENSE.txt.
