i18n
FreeNo executable scriptsNot checkedAdd full internationalization (i18n) to a Next.js project using next-intl. Supports 14+ languages, SEO-friendly locale routing, hreflang sitemaps, and bulk…
by OpenClaudia★ 754 GitHub starsAbout this skill
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)
src/i18n/request.ts
import { getRequestConfig } from 'next-intl/server'
import { routing } from './routing'
export default getRequestConfig(async ({ requestLocale }) => {
let locale = await requestLocale
if (!locale || !routing.locales.includes(locale as any)) {
locale = routing.defaultLocale
}
return {
locale,
messages: (await import(`../messages/${locale}.json`)).default,
}
})
Step 4: Create Middleware
Create src/middleware.ts:
import createMiddleware from 'next-intl/middleware'
import { routing } from '@/i18n/routing'
export default createMiddleware({
...routing,
localeDetection: false, // Don't auto-redirect based on Accept-Language
})
export const config = {
matcher: ['/((?!_next|api|images|fonts|favicon|sitemap|robots).*)'],
}
Key decision: localeDetection: false prevents auto-redirecting users based on browser language. This keeps English URLs stable for SEO. Users can manually switch languages via a language selector.
Step 5: Update next.config
Wrap the existing config with createNextIntlPlugin:
import createNextIntlPlugin from 'next-intl/plugin'
const withNextIntl = createNextIntlPlugin('./src/i18n/request.ts')
// ... existing config ...
export default withNextIntl(nextConfig)
Step 6: Add [locale] Dynamic Route
Move all page content under src/app/[locale]/:
Create
src/app/[locale]/layout.tsxwith:generateStaticParams()returning all localessetRequestLocale(locale)call<NextIntlClientProvider>wrapping children<html lang={locale} dir={rtlLocales.includes(locale) ? 'rtl' : 'ltr'}>- Hreflang
<link>tags in<head>for all locales +x-default
Move existing pages into
src/app/[locale]/Each page should call
setRequestLocale(locale)for static generation
Step 7: Extract Strings into Translation Files
Create
src/messages/en.jsonwith all user-facing strings organized by section:{ "common": { "signIn": "Sign In", ... }, "tools": { "tool-slug": { "title": "...", "description": "..." } }, "faq": { "tool-slug": [{ "question": "...", "answer": "..." }] } }Replace all hardcoded strings in components with
useTranslations():const t = useTranslations('common') return <button>{t('signIn')}</button>For server components, use
getTranslations():const t = await getTranslations('common')
Step 8: Translate to All Locales
For each non-English locale, create src/messages/{locale}.json with the same structure as en.json.
Translation Strategy
Use parallel Codex agents via the codex-tasks skill to save Claude credits:
- Launch one Codex task per locale (up to 7 in parallel) using
/codex-tasks - Each task reads
en.json, translates all strings, writes{locale}.json - Codex prompt should include:
- The full
en.jsoncontent (or path to read it) - Target l
- The full
Install i18n in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
Allowed tools
Tools this skill is permitted to call.
No restriction — this skill can use any tool.
FAQ
What does the i18n skill do?
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".
How do I install the i18n skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the i18n skill run scripts?
No, this skill is instructions only (SKILL.md) with no executable scripts.
Related skills
gtm-enterprise-account-planning
Strategic account planning and execution for enterprise deals. Use when planning complex sales cycles, managing multiple stakeholders, applying MEDDICC…
by GitHubgtm-partnership-architecture
Build and scale partner ecosystems that drive revenue and platform adoption. Use when building partner programs from scratch, tiering partnerships, managing…
by GitHublanding-page-conversion-audit
Audit a landing page, sales page or checkout page for conversion leaks and return a fix list ordered by expected revenue impact. Use when asked to review…
by GitHubpower-platform-architect
Use this skill when the user needs to transform business requirements, use case descriptions, or meeting transcripts into a technical Power Platform solution…
by GitHub