NJ Municipality Lookup
CodebaseSrc

I18n

Server-side internationalization (i18n) configuration using next-intl.

Internationalization Configuration

Server-side internationalization (i18n) configuration using next-intl.

Purpose

Configures next-intl for the Next.js App Router, providing translation loading and locale handling for Server Components.

Key Files

  • request.ts - Exports getRequestConfig for next-intl, loads translation messages based on the current locale

How It Works

  1. Reads the x-locale header set by Next.js middleware
  2. Dynamically imports the corresponding translation file from ../locales/
  3. Returns configuration with locale and messages for next-intl to use

Supported Locales

Currently supports English (en) as the default and only locale. Additional locales can be added by:

  1. Adding locale to the locales array in request.ts
  2. Creating corresponding JSON file in src/locales/

On this page