i18n-nextjs
Internationalization (i18n) guide for Next.js / Node.js web applications using the App Router. Covers translation file structure, locale routing, SEO metadata per locale, hreflang, structured JSON-LD data, UI component translations, and multi-language sitemap generation. Use when the user asks to: add i18n support, add a new language, translate a page or component, add SEO metadata for multiple locales, implement hreflang, update the sitemap for new locales, or follow i18n best practices in a Next.js project.
Install via CLI (Recommended)
clawhub install openclaw/skills/skills/javainthinking/web-i18n-nextjsi18n for Next.js — Implementation Guide
Core Principles
- All user-facing features must implement i18n — no hardcoded strings in components.
- Translations must be natural and idiomatic — never use scripts or machine translation; treat quality the same as English copywriting.
- SEO metadata, JSON-LD structured data, and sitemaps must all be locale-aware.
- Default locale (English) uses clean URLs with no prefix (
/products); other locales use a prefix (/es/products).
Supported Locales
Locale list lives in src/lib/i18n/locales.ts. Keep the sitemap script's locales array in sync with this file.
export const locales = ['en', 'es', 'fr', 'de', 'ja', 'zh-CN', /* ... add as needed */]
export const defaultLocale = 'en'
export type Locale = typeof locales[number]
Directory Structure
src/app/[lang]/
├── dictionaries/ ← One JSON file per locale
│ ├── en.json
│ ├── es.json
│ └── ...
├── dictionaries.ts ← getDictionary(locale) server helper
├── layout.tsx ← Root layout: generateMetadata + hreflang + JSON-LD
└── <page>/
└── page.tsx ← generateMetadata + page content
Translation Files
See references/translation-files.md for:
- JSON key hierarchy conventions (
page.section.key) - Server-side
getDictionary()usage - Client-side
useDictionary()hook usage - Template variable pattern (
{count}substitution) - Fallback pattern for missing keys
Routing & Middleware
See references/routing.md for:
src/middleware.ts— locale detection, redirect/en/*→/*, rewrite for default localeLocalizedLinkcomponent — automatically prefixes non-default localesuseLocale()hook — reads locale from URL params → pathname → localStorage → defaultgetLocalizedPath()/removeLocalePrefix()utilities
SEO Metadata
See references/seo-metadata.md for:
generateMetadata()pattern in layout/page filesgenerateAlternatesMetadata()fromsrc/lib/i18n/seo.ts- Full hreflang
alternates.languagesoutput (all locales +x-default) - OpenGraph
locale/alternateLocalefields html langattribute andLangSetterclient component
Structured JSON-LD Data
See references/structured-data.md for:
- WebApplication schema with translated
featureList,description - BlogPosting schema with
inLanguagefield - FAQ schema with translated
acceptedAnswer - BreadcrumbList schema with localized URLs
- Rendering via
<Script>or<script>tags
Multi-language Sitemap
Metadata
Not sure this is the right skill?
Describe what you want to build — we'll match you to the best skill from 16,000+ options.
Find the right skillPaste this into your clawhub.json to enable this plugin.
{
"plugins": {
"official-javainthinking-web-i18n-nextjs": {
"enabled": true,
"auto_update": true
}
}
}Related Skills
2slides
AI-powered presentation generation using 2slides API. Create slides from text content, match reference image styles, or summarize documents into presentations. Use when users request to "create a presentation", "make slides", "generate a deck", "create slides from this content/document/image", or any presentation creation task. Supports theme selection, multiple languages, and both synchronous and asynchronous generation modes.
powerdrill-data-analysis
This skill should be used when the user wants to analyze, explore, visualize, or query data using Powerdrill. Covers listing, creating, and deleting datasets; uploading local files as data sources; creating analysis sessions; running natural-language data analysis queries; and retrieving charts, tables, and insights. Triggers on requests like "analyze my data", "query my dataset", "upload this file for analysis", "list my datasets", "create a dataset", "visualize sales trends", "continue my previous analysis", "delete this dataset", or any data exploration task mentioning Powerdrill.
powerdrill-data-analysis
This skill should be used when the user wants to analyze, explore, visualize, or query data using Powerdrill. Covers listing, creating, and deleting datasets; uploading local files as data sources; creating analysis sessions; running natural-language data analysis queries; and retrieving charts, tables, and insights. Triggers on requests like "analyze my data", "query my dataset", "upload this file for analysis", "list my datasets", "create a dataset", "visualize sales trends", "continue my previous analysis", "delete this dataset", or any data exploration task mentioning Powerdrill.
2slides
AI-powered presentation generation using 2slides API. Create slides from text content, match reference image styles, or summarize documents into presentations. Use when users request to "create a presentation", "make slides", "generate a deck", "create slides from this content/document/image", or any presentation creation task. Supports theme selection, multiple languages, and both synchronous and asynchronous generation modes.
apipick-public-holidays
Query public holidays for any country and year using the apipick Public Holidays API. Supports 100+ countries identified by ISO 3166-1 alpha-2 country codes. Returns a sorted list of holidays with dates and official names. Use when the user wants to find public holidays for a country, check if a specific date is a holiday, list all national holidays for a given year, or plan around holidays in any country. Requires an apipick API key (x-api-key). Get a free key at https://www.apipick.com.