i18n

Standardize Next.js App Router translations with next-intl and locale JSON files.

Updated Jan 26, 2026
One-click install
npx skills add https://github.com/theofernandezz/ai-library --skill i18n-theofernandezz
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: i18n
Source: https://github.com/theofernandezz/ai-library/tree/main/.opencode/skills/i18n
Command: npx skills add https://github.com/theofernandezz/ai-library --skill i18n-theofernandezz

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Centralizes and standardizes how applications add multilingual support to Next.js apps, preventing hardcoded strings and inconsistent translations.

Core Features & Use Cases

  • Centralized locale management and middleware-based detection
  • Server and client translation usage via next-intl with structured message namespaces
  • Flow for adding, validating, and switching translations across routes and components
  • Ideal for apps with multiple locales, dynamic content, and SEO-friendly metadata

Quick Start

Install next-intl, configure i18n, add messages for en/es/pt, and wire up a locale-aware layout.

Frequently Asked Questions about i18n

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add multi-language support to a Next.js App Router project?

To add multi-language support to a Next.js App Router project, you standardize translation loading using a centralized messages directory with locale JSON files, root i18n configuration, and a locale-aware layout wrapper. This prevents hardcoded strings and ensures consistent translations across server and client components.

How does middleware-based locale detection work with next-intl?

Middleware-based locale detection intercepts incoming requests to identify the user's preferred language before routing. Using next-intl, it automatically applies the detected locale to load the correct JSON translation files and formats server and client translations across pages and server actions.

What is the best way to structure translation files for a Next.js internationalization setup?

The best way to structure translation files for Next.js internationalization is using a centralized messages directory containing separate locale JSON files. This setup uses structured message namespaces to organize translations, allowing server and client utilities to efficiently format and apply strings across components.

Can I use next-intl for both server and client translation usage in Next.js?

Yes, you can use next-intl for both server and client translation usage in Next.js. It requires a layout wrapper providing translations and structured message namespaces, enabling seamless string formatting and locale switching across server actions, pages, and client-side components.

Does this Next.js internationalization approach support SEO-friendly metadata?

Yes, this Next.js internationalization approach supports SEO-friendly metadata. By utilizing middleware-based locale detection and a centralized locale management system, it ensures that search engines correctly index language-specific URLs and dynamic content across multiple locales.

Why should I centralize locale management instead of hardcoding strings in Next.js?

You should centralize locale management to prevent hardcoded strings and inconsistent translations across your application. Standardizing how translations are loaded and applied via a root i18n configuration ensures maintainable, structured message namespaces for apps with multiple locales and dynamic content.