next-intl Internationalization
Add internationalization to Next.js App Router applications with next-intl, supporting translations, formatting, and locale routing.
Overview
The library supports both server and client components, making it fully compatible with the App Router architecture. Your AI agent can configure the middleware for locale detection and URL rewriting, set up message files for each locale, implement the `useTranslations` hook for client components, and use `getTranslations` for server components.
next-intl handles complex formatting scenarios including dates, times, numbers, pluralization, and rich text with embedded components. AI agents can generate translation JSON files, implement locale switchers, set up default locales, and configure SEO-friendly hreflang tags for multilingual sites.
Who Is This For?
- Next.js teams adding multi-language support to their applications
- Developers implementing locale-based routing with URL prefixes
- Teams managing translation files across multiple locales
- Engineers building SEO-optimized multilingual sites
Installation
npm install next-intl Configuration
// i18n/request.ts
import { getRequestConfig } from "next-intl/server";
export default getRequestConfig(async ({ locale }) => ({
messages: (await import(`../messages/${locale}.json`)).default,
}));
// middleware.ts
import createMiddleware from "next-intl/middleware";
export default createMiddleware({
locales: ["en", "ar", "es"],
defaultLocale: "en",
}); Explore AI Tools
Discover the best AI tools that complement your skills
Read AI & Design Articles
Tips and trends in the world of design and AI
Related Skills
Figma MCP Server
Bridge the gap between design and code by connecting Figma to your AI agent via MCP, enabling accurate design-to-code translation.
Storybook Component Docs
Build, document, and visually test UI components in isolation using Storybook. AI agents can generate stories and catch visual regressions.
Tailwind CSS IntelliSense
Get intelligent Tailwind class suggestions, autocompletions, and linting as you style components in your editor.