Nextjs i18n

From HoangNguyen0403/agent-skills-standard · View interactive version

Nextjs i18n is an AI agent skill from the GitHub repository HoangNguyen0403/agent-skills-standard. Best practices for multi-language handling, locale routing, and detection strategies across App and Pages Router. Use when adding i18n, locale routing, or language detection in Next.js.

How to use this skill

Skill file

Internationalization (i18n)

**Priority: P2 (MEDIUM)**

Maintain single source of truth for locales and ensure SEO-friendly sub-path routing.

Workflow: Add i18n to Next.js App Router Project

  1. Install next-intl and create messages/en.json, messages/fr.json, etc.
  2. Add locale detection middleware in middleware.ts
  3. Create app/[lang]/layout.tsx with locale param
  4. Load translations server-side via getMessages()
  5. Add hreflang tags in generateMetadata
  6. Pre-render locales with generateStaticParams
  7. Verify: run next build and confirm all locale paths render

Middleware Example

See implementation examples

Implementation Guidelines

Library Specifics

For detailed setup with common libraries, refer to:

Anti-Patterns

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.