---
id: ssh-next-intl-add-language
name: "next-intl-add-language"
url: https://skills.yangsir.net/skill/ssh-next-intl-add-language
author: github
domain: ai-frontend-engineering
tags: ["nextjs", "next-intl", "internationalization-(i18n)", "react-localization"]
install_count: 9300
rating: 4.50 (293 reviews)
github: https://github.com/github/awesome-copilot
---

# next-intl-add-language

> 为Next.js + next-intl应用程序添加新语言，实现国际化支持。

**Stats**: 9,300 installs · 4.5/5 (293 reviews)

## Before / After 对比

### 为Next.js应用添加多语言支持

## Readme

This is a guide to add a new language to a Next.js project using next-intl for internationalization,

- For i18n, the application uses next-intl.
- All translations are in the directory `./messages`.
- The UI component is `src/components/language-toggle.tsx`.
- Routing and middleware configuration are handled in:
  - `src/i18n/routing.ts`
  - `src/middleware.ts`

When adding a new language:

- Translate all the content of `en.json` to the new language. The goal is to have all the JSON entries in the new language for a complete translation.
- Add the path in `routing.ts` and `middleware.ts`.
- Add the language to `language-toggle.tsx`.


---
*Source: https://skills.yangsir.net/skill/ssh-next-intl-add-language*
*Markdown mirror: https://skills.yangsir.net/api/skill/ssh-next-intl-add-language/markdown*