Next.js i18n · TypeScript
Next.js i18n for the App Router, from server to client.
Palamedes gives Next.js 16 one translation model across Server Components, Client Components, and server actions. The Next plugin handles macro transforms and catalog loading; your application keeps control of routing and locale policy.
Palamedes 2.0 is out. Read the release notes.
- Integration
- @palamedes/next-plugin
- Verified against
- Next.js 16
- Rendering
- RSC + client
- Locale models
- 4 examples
One host adapter for macro transforms and PO imports.
App Router proofs cover Turbopack and webpack.
Server Components, Client Components, and server actions.
Cookie, route, subdomain, and top-level domain.
@palamedes/next-pluginv2.2.04.3K downloads / month01 — The framework problem
Next.js makes locale routing visible. The harder boundary is request-local rendering.
A locale segment or cookie is only the first decision. Translations must resolve to the same locale while React crosses server and client boundaries, streams HTML, hydrates the browser, and runs a server action later.
02 — The Palamedes model
Keep the framework-specific wiring at the edge of one i18n model.
Palamedes treats Next.js as a host, not as a separate translation architecture. The adapter owns the build integration while the core keeps message identity, catalogs, diagnostics, and runtime access consistent.
A native Next.js build path
withPalamedes() transforms macros and delivers compiled message dependencies through Turbopack or webpack. Graph splitting is automatic in v2; Client Components need no application-owned catalog loader.
Request-scoped server i18n
A server-only scope binds getI18n() to the active request. Complete compiled locale catalogs are shared across requests, while each request keeps its own locale and formatter state. Server Actions initialize their scope separately.
The same authoring model
Write t and Trans next to the component. Server and client code share source-string-first catalogs instead of maintaining parallel APIs.
03 — In TypeScript
The adapter is visible in config. The translation stays beside the UI.
next.config.ts + app/page.tsx
// next.config.ts
import { withPalamedes } from "@palamedes/next-plugin"
export default withPalamedes({})
// app/page.tsx — a Server Component
import { Trans } from "@palamedes/react/macro"
import { createNextServerI18n } from "@palamedes/next-plugin/server"
export default async function Page() {
await createNextServerI18n({ locale: "de" })
return <h1><Trans>Welcome to Palamedes</Trans></h1>
}This first component uses a fixed locale. In an application, resolve it from your existing locale policy. The adapter shares server catalogs and loads Client Component fragments automatically; the full guide also covers separate Server Action initialization and ordinary host error UI.
04 — Locale strategy
Choose the URL model that fits your Next.js product.
Next.js owns URL structure and request handling. Palamedes supplies typed locale controls and the same catalog runtime for all four patterns, so choosing an SEO-friendly route segment does not require choosing a different translation library.
Cookie
One URL for all locales. Useful for signed-in apps; an explicit language choice is persisted and opens a new document in that locale.
Route segment
/de/checkout-style paths. The SEO-friendly default for public content with indexable localized pages.
Subdomain
de.example.com. Clean separation per market, works well with regional CDNs and analytics splits.
05 — Proof and boundaries
A real App Router application, exercised like a user would use it.
The Next.js family is part of the repository's browser-verification matrix. The checks start the application, inspect server-rendered output, switch locale, and invoke translated server behavior.
- Initial response
- SSR checked
- Interaction
- Switch checked
- Server behavior
- Action checked
- Evidence
- Source + CI
The expected locale is present before hydration.
Copy, plurals, dates, and currency move together.
A server action returns localized output after interaction.
Examples, verifier, and screenshots are checked in.
06 — Questions
Next.js i18n questions, answered
The short version of the decisions that usually block an implementation.
- Does Palamedes replace Next.js internationalized routing?
- No. Next.js still owns routes, redirects, middleware, and URL design. Palamedes handles translated messages, catalogs, diagnostics, and the runtime that follows the locale your application resolved.
- Does Next.js i18n work in Server Components?
- Yes on the verified Node runtime path. Initialize one request-local server scope before downstream Server Components call Palamedes macros; keep that server-only module outside Edge and client bundles.
- Can the same messages run in Client Components and server actions?
- Yes. The adapter initializes Client Components with compiled fragments for the document locale. Server Components and separately initialized Server Actions use shared immutable catalogs with request-local state. Both use the same source-string-first catalogs.
- How is this different from next-intl?
- next-intl is deeply centered on Next.js. Palamedes provides a broader source-to-runtime toolchain with a native core, repository-owned PO or FCL catalogs, semantic merging, audits, and first-party adapters across several hosts. The right choice depends on whether that shared workflow matters to your team.
07 — Keep exploring