i18n

Implements locale-aware routing and react-intl integration in Rango RSC applications.

Updated Nov 7, 2025
One-click install
npx skills add https://github.com/rangojs/rango --skill i18n-rangojs
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: i18n
Source: https://github.com/rangojs/rango/tree/main/packages/rangojs-router/skills/i18n
Command: npx skills add https://github.com/rangojs/rango --skill i18n-rangojs

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires react-intl.

What problem does it solve? Building a multi-language app requires locale-aware URLs, a reliable locale resolution strategy, and integration with a message library like react-intl. This Skill provides the patterns to mount routes under an optional locale prefix, resolve the active locale from URL, cookie, and Accept-Language headers, and wire react-intl into a React Server Components route tree. ## Core Features & Use Cases - Optional Locale Prefix Routing: Mount routes under /:locale? so the default locale lives at the bare URL while other locales get a prefix, with constraints to reject unknown locales. - Locale Resolution Chain: Resolve the active locale via URL prefix, cookie, Accept-Language header, then a default fallback, with optional middleware redirects to canonical URLs. - react-intl Integration: Load message bundles server-side and pass them to a client IntlProvider, keeping translations out of the client bundle. - Use Case: You are building a documentation site in English, British English, and French. Use this Skill to serve /, /en, and /fr variants, generate localized links with reverse(), and render translated UI strings through react-intl. ## Quick Start Use the i18n skill to add an optional locale prefix to my Rango routes and wire up react-intl with a locale resolution fallback chain.

Frequently Asked Questions about i18n

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

FAQPage Schema
How do I add locale-based routing to a React app?

Mount your routes under an optional include prefix like `/:locale?` so the default locale serves the bare URL and other locales get a prefix. Add a constraint such as `:locale(en|gb|fr)?` so unknown locale values fall through to a 404 instead of matching as slugs.

How to integrate react-intl with React Server Components?

Load message bundles on the server in a layout, then pass locale and messages to a client component wrapping IntlProvider. Server components can use formatjs createIntl() directly with the same messages map for static translated text.

Does Rango include a built-in i18n module?

No, Rango does not ship an i18n module. The router provides URL primitives like optional include prefixes, constraints, and typed reverse(), which you compose with libraries such as react-intl, lingui, or @formatjs/intl.

Why does an unknown locale like /de match my index route?

Without a constraint, the optional locale param captures any first segment, so /de matches with locale set to de. Add a constraint like `:locale(en|gb|fr)?` so unsupported values are rejected and the request 404s or falls through to other routes.

How do I generate localized URLs with reverse()?

Pass the locale param to ctx.reverse() with your route name; undefined or empty string collapses the optional segment to the bare URL. If your default locale should be hidden, normalize it to undefined before calling reverse.