Skip to content

React Router i18n · Framework Mode

React Router i18n for Framework Mode.

Palamedes connects React Router 8 loaders, actions, SSR, and hydrated React components to one translation runtime. The Vite plugin compiles messages; route modules resolve the locale and activate the matching catalog.

Mode
Framework

Type-safe route modules, loaders, actions, and SSR.

Verified against
React Router 8.3

React 19 and the React Router Vite plugin.

Integration
@palamedes/vite-plugin

Macro transforms and PO loading in the route build.

Locale models
4 examples

Cookie, route, subdomain, and top-level domain.

npm package@palamedes/react-router-rscv1.17.3635 downloads / month

01 — The framework problem

The locale has to be route data, server state, and client state at the right times.

Framework Mode spans the initial server render and later browser navigations. A translated route must activate its locale before loader or action macros run, then hydrate React with the same catalog.

02 — The Palamedes model

Use route modules for policy and Palamedes for the translation lifecycle.

React Router continues to own matching, redirects, data loading, and mutations. Palamedes supplies transformed authoring, catalogs, request activation, and client synchronization around those APIs.

Compose two Vite plugins

The Palamedes transform runs beside the React Router plugin, so macros and PO imports become normal modules in the Framework Mode build.

Activate inside route boundaries

A loader or action normalizes its locale and activates the server runtime before translated messages execute.

Hydrate from root locale data

The root route exposes the resolved locale and the client entry loads the same catalog before React hydrates the document.

03 — In TypeScript

Framework Mode keeps the locale close to the loader and action.

vite.config.ts + routes/locale-home.tsx

// vite.config.ts
import { reactRouter } from "@react-router/dev/vite"
import { palamedes } from "@palamedes/vite-plugin"

export default {
  plugins: [
    palamedes(),
    reactRouter(),
  ],
}

// routes/locale-home.tsx
export async function loader({ params }: Route.LoaderArgs) {
  const locale = normalizeLocale(params.locale)
  activateServerI18n(locale)
  return { locale, title: t`Welcome to Palamedes` }
}

The checked route module also localizes an action response. Its client entry activates the locale from root loader data before HydratedRouter hydrates the React tree.

04 — Locale strategy

Choose the URL model that fits your React Router product.

React Router route modules own params, requests, redirects, and links. Palamedes keeps the catalog and component model identical while the four examples change how those route modules derive a locale.

Cookie

One URL for all locales. Best for apps behind login where SEO is irrelevant and switching should be instant.

open demosource →

Route segment

/de/checkout-style paths. The SEO-friendly default for public content with indexable localized pages.

open demosource →

Subdomain

de.example.com. Clean separation per market, works well with regional CDNs and analytics splits.

open demosource →

Top-level domain

example.de vs example.com. Maximum market trust; Palamedes maps each domain to its locale.

◌ local / CIsource →

Compare the four locale strategies →

05 — Proof and boundaries

Framework Mode is tested as a full server-and-browser application.

The verifier checks the initial document, route or host behavior, client switching, and a localized action after hydration.

Route modules
Typed

The examples use generated loader and action types.

Initial response
SSR checked

Server-rendered messages match the resolved locale.

Mutation
Action checked

A post-hydration action returns localized output.

Evidence
Live + CI

Hosted demos and checked source cover the matrix.

06 — Questions

React Router i18n questions, answered

The short version of the decisions that usually block an implementation.

Where should React Router resolve the locale?
At the route or request boundary that owns the policy: a root loader, a locale route loader, middleware, or a shared request helper. Activate the Palamedes server runtime before translated loader or action code executes.
Can actions return translated messages?
Yes. The checked examples activate the route locale inside the action and return a message produced by a transformed Palamedes macro.
Does client navigation keep the active catalog synchronized?
Yes in the verified examples. Root locale data initializes the browser runtime before hydration, and the React client helper follows locale changes during navigation and switching.
Is React Router Framework Mode the same as Remix v3?
No. React Router Framework Mode is a React framework built around route modules and a Vite plugin. The new Remix v3 is a separate server-first full-stack project with its own router, loaders, UI direction, and integration constraints.

07 — Keep exploring

See how the same model meets a different host.

Let route modules own the request and one runtime own the messages.