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.
Palamedes 2.0 is out. Read the release notes.
- Integration
- @palamedes/vite-plugin
- Verified against
- React Start 1.169.4
- Server model
- Server Functions
- Locale models
- 4 examples
Transforms macros before the React and Start pipeline.
With TanStack Router 1.170.46 and Vite 8.2.4.
Request data activates the matching server runtime.
Cookie, route, subdomain, and top-level domain.
@palamedes/tanstackv2.2.0757 downloads / month01 — 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
The server request middleware resolves the locale and supplies isolated request state over shared immutable catalogs. Server functions then use 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(),
],
}
// src/start.ts
import { createIsomorphicFn, createStart } from "@tanstack/react-start"
import { createTanStackServerI18nRequestMiddleware } from "@palamedes/tanstack"
const i18nMiddleware = createIsomorphicFn().server(() =>
createTanStackServerI18nRequestMiddleware({
async resolveLocale(request) {
const { resolveLocaleFromRequest } = await import("./lib/i18n.server")
return resolveLocaleFromRequest(request)
},
}),
)()!
export const startInstance = createStart(() => ({
requestMiddleware: [i18nMiddleware],
}))
// src/lib/server-functions.ts
import { createServerFn } from "@tanstack/react-start"
import { t } from "@palamedes/core/macro"
import { getI18n } from "@palamedes/runtime"
export const getStatus = createServerFn({ method: "GET" })
.handler(async () => {
const locale = getI18n().locale
return t`Server function confirmed locale ${locale}.`
})resolveLocaleFromRequest() is the checked example's application policy. The adapter shares compiled server catalogs and delivers active-locale browser fragments automatically. Locale switches navigate to a new document.
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. 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
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
- Initial response
- SSR checked
- Server behavior
- Function checked
- Evidence
- 4 app shapes
Accept-Language reaches the configured locale URL.
Localized content is present before client interaction.
A later server function returns translated output.
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 this verification include Solid Start?
- TanStack Start is verified with React Start 1.169.4. Solid is verified separately through the Solid 2 Start Mode/Nitro demos. Both families are executable integration tests covering SSR, hydration, navigation, locale changes, and catalog recovery. TanStack Solid Start is outside the v2 scope; these examples do not establish support for that combination.
- 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