I18n
Add full internationalization (i18n) to a Next.js project using next-intl.
Install
npx skills add OpenClaudia/openclaudia-skills --skill i18n -g -a claude-code -y- Repository
- OpenClaudia/openclaudia-skills724
- Category
- Marketing
- Updated
- 7d ago
- License
- MIT
- Context cost
- Mediumabout 2,244 tokens
- Runs scripts
- No, instructions only
What it does
Add full internationalization (i18n) to a Next.js project using next-intl. Supports 14+ languages, SEO-friendly locale routing, hreflang sitemaps, and bulk translation. Use when the user asks to "internationalize", "add i18n", "add translations", "multi-language", "localize", "add language support", or "translate my site".
Internationalize a Next.js Project
Add complete internationalization to a Next.js (App Router) project using next-intl v4. This skill handles routing, translation files, sitemap hreflang, and bulk translation across all locales.
Step 1: Assess the Project
- Check the Next.js version (
package.json), must be 13+ with App Router - Check if i18n is already partially set up (look for
next-intl,next-i18next,[locale]routes) - Identify all pages/routes that need translation
- Identify all user-facing strings (hardcoded text in components)
- Ask the user which locales to support (default recommendation: en, es, fr, de, pt, ja, ar, zh, zh-tw, id, vi, ms, ru, hi)
Step 2: Install Dependencies
npm install next-intl
Step 3: Create i18n Configuration Files
Create 4 files under src/i18n/:
src/i18n/config.ts
export const locales = ['en', 'es', 'fr', 'de', 'pt', 'ja', 'ar', 'zh', 'zh-tw', 'id', 'vi', 'ms', 'ru', 'hi'] as const
export type Locale = (typeof locales)[number]
export const defaultLocale: Locale = 'en'
export const localeNames: Record<Locale, string> = {
en: 'English',
es: 'Espanol',
fr: 'Francais',
de: 'Deutsch',
pt: 'Portugues',
ja: '日本語',
ar: 'العربية',
zh: '简体中文',
'zh-tw': '繁體中文',
id: 'Bahasa Indonesia',
vi: 'Tieng Viet',
ms: 'Bahasa Melayu',
ru: 'Русский',
hi: 'हिन्दी',
}
export const rtlLocales: Locale[] = ['ar']
src/i18n/routing.ts
import { defineRouting } from 'next-intl/routing'
import { defaultLocale, locales } from './config'
export const routing = defineRouting({
locales,
defaultLocale,
localePrefix: 'as-needed', // English URLs stay clean, other locales get /es/, /fr/, etc.
})
src/i18n/navigation.ts
import { createNavigation } from 'next-intl/navigation'
import { routing } from './routing'
export const { Link, redirect, usePathname, useRouter } = createNavigation(routing)
