360 Secure SkillHub
360 安全技能中心

next-intl-add-language

该 Skill 是一份操作指南,说明如何在采用 next-intl 的 Next.js 项目中新增一种语言:把 en.json 的全部内容翻译为新语言、在路由与中间件配置中登记该语言路径,并在语言切换组件中加入该语言。仅描述步骤,不含具体翻译内容或自动化脚本。

github
热度 0.00
最近更新 2026-10-18 22:10:31
分类:开发依赖:读写文件应用场景:翻译 / 代码生成

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add github/awesome-copilot/next-intl-add-language
Metadata
name
next-intl-add-language
description
Add new language to a Next.js + next-intl application

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.