Skip to content

TanStack Start i18n · TypeScript

TanStack Start i18n for routes, server functions, and the client.

Palamedes connects TanStack Start's type-safe router and server functions to one source-string-first translation workflow. Locale routing stays in TanStack; macro transforms, catalogs, diagnostics, and runtime access stay coherent across the request.

Integration
@palamedes/vite-plugin

Transforms macros before the React and Start pipeline.

Verified against
Start 1.168

With TanStack Router 1.170 and Vite 8.

Server model
Server Functions

Request data activates the matching server runtime.

Locale models
4 examples

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

npm package@palamedes/tanstackv1.17.3679 downloads / month

01 — The framework problem

A typed locale route is useful only when the server function speaks the same locale.

TanStack Router can model localized URLs precisely. An i18n integration still has to carry that decision into SSR, server functions, browser hydration, and later client interactions without turning the router into a translation store.

02 — The Palamedes model

Let TanStack own navigation and Palamedes own translation semantics.

The integration composes at the Vite and request boundaries. It does not replace TanStack Router's route tree, rewrites, params, or metadata APIs.

A normal Vite plugin

The Palamedes plugin runs in the existing TanStack Start toolchain and compiles TypeScript macros plus imported PO catalogs.

Explicit server activation

A server function validates its locale input, activates a request-local i18n instance, and then uses the same t macro as application code.

Router-native locale URLs

Use required, optional, or rewritten locale params in TanStack Router. Palamedes follows the resolved locale instead of prescribing the URL.

03 — In TypeScript

The Vite adapter and server function meet at one runtime contract.

vite.config.ts + server-functions.ts

// vite.config.ts
import { tanstackStart } from "@tanstack/react-start/plugin/vite"
import react from "@vitejs/plugin-react"
import { palamedes } from "@palamedes/vite-plugin"

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

// server-functions.ts
export const getStatus = createServerFn({ method: "GET" })
  .validator((data: { locale: Locale }) => data)
  .handler(async ({ data }) => {
    activateServerI18n(data.locale)
    return t`Server function confirmed locale ${data.locale}.`
  })

The checked route example derives the locale from a typed route param, passes it into server functions, and initializes the browser runtime for subsequent navigation.

04 — Locale strategy

Choose the URL model that fits your TanStack Start product.

TanStack Router supports several localized URL patterns, including optional path params and rewrites. The Palamedes matrix keeps message handling identical while each example changes only the locale-resolution strategy.

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

Verified across the initial request and a later server-function call.

The browser flow checks more than rendered text. It proves that route resolution, client switching, and server work agree on one active locale.

Routing
Redirect checked

Accept-Language reaches the configured locale URL.

Initial response
SSR checked

Localized content is present before client interaction.

Server behavior
Function checked

A later server function returns translated output.

Evidence
4 app shapes

Every locale strategy has source and CI coverage.

06 — Questions

TanStack Start i18n questions, answered

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

Does Palamedes replace TanStack Router's i18n routing patterns?
No. Keep locale params, rewrites, redirects, and links in TanStack Router. Palamedes turns the locale resolved by those routes into the active catalog for server and client code.
Can Palamedes translate TanStack Start server functions?
Yes. Validate or normalize the locale at the server-function boundary, activate a request-local i18n instance, and use the same transformed macros as the rest of the application.
Does it work with server-side rendering?
Yes. The example matrix verifies localized SSR output and then checks client switching plus a localized server-function response.
How does this compare with Paraglide in the TanStack guide?
Paraglide offers a generated, typesafe message API and dedicated URL-localization helpers. Palamedes uses source-string-first PO or FCL catalogs, macro-style authoring, a native catalog toolchain, and one runtime model shared with its other supported hosts.

07 — Keep exploring

See how the same model meets a different host.

Keep TanStack's route types and add a coherent translation toolchain.