Skip to content

Vite i18n · React and Solid

Vite i18n for React and Solid, in one plugin.

Add Palamedes beside your renderer plugin and write messages inside TypeScript and JSX. The v2 adapter derives the active locale's compiled fragments before translated code runs, including lazy modules. You keep your existing routing and locale policy.

Palamedes 2.0 is out. Read the release notes.

Integration
@palamedes/vite-plugin

One transform and catalog loader for Vite projects.

Renderer packages
React + Solid

Choose the runtime module that matches the UI.

Version range
Vite 8

The plugin requires Vite 8, which the matrix runs on.

Catalog workflow
PO + FCL

PO imports today; PO or FCL for CLI catalog storage.

npm package@palamedes/vite-pluginv2.2.02.1K downloads / month

01 — The framework problem

Vite supplies a fast module pipeline, not an internationalization architecture.

A useful Vite i18n setup still needs an authoring model, extraction, catalogs, ICU validation, renderer integration, and an active runtime. Adding unrelated plugins for each step creates boundaries that fail at different times.

02 — The Palamedes model

Use Vite as the host for a complete local i18n workflow.

The plugin is only the build boundary. Palamedes connects it to the same native transform, catalog engine, runtime contract, and CLI used by the framework adapters.

Transform before the renderer

Place palamedes() before the React plugin, or add it to Solid's Vite configuration with the Solid runtime module.

Ready-made rich-message components

React and Solid expose Trans, Plural, Select, and SelectOrdinal macros over the same compiled message model. The adapter initializes browser delivery; applications do not maintain catalog maps or loading boundaries.

Keep extraction out of the browser build

The native pmds CLI extracts and updates catalogs explicitly, while Vite focuses on turning application modules into runnable code.

03 — In TypeScript

The only difference between React and Solid is the renderer boundary.

vite.config.ts

// React
import react from "@vitejs/plugin-react"
import { palamedes } from "@palamedes/vite-plugin"
import { defineConfig } from "vite"

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

// Solid
import solid from "@solidjs/vite-plugin"

export default defineConfig({
  plugins: [
    palamedes({ framework: "solid" }),
    solid(),
  ],
})

Both paths use TypeScript macros, the same palamedes.yaml format, and the same extraction CLI. The renderer package supplies rich-message and client-locale primitives where the UI models differ.

04 — Locale strategy

Choose the URL model that fits your Vite product.

Vite does not prescribe routing or server request APIs. Cookie, route, subdomain, and top-level-domain locale policies remain application concerns; Palamedes keeps the translation pipeline stable underneath whichever policy your React or Solid host implements.

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.

Top-level domain (TLD)

product.com to product.de. Palamedes replaces the final DNS label and keeps the rest of the hostname; paths have no locale prefix.

Compare locale strategies →

05 — Proof and boundaries

The plugin is exercised through several full-stack hosts, not just a fixture.

TanStack Start, Solid, Waku, and React Router use @palamedes/vite-plugin throughout the browser-verified framework matrix. Package tests cover the transform and loader boundary directly.

React hosts
3 families

TanStack Start, Waku, and React Router.

Solid hosts
1 family

Solid uses the Solid runtime integration.

Build behavior
Dev + build

The same plugin handles transforms and PO imports.

Diagnostics
Native

Macro, placeholder, and ICU problems surface early.

06 — Questions

Vite i18n questions, answered

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

Does Vite have built-in internationalization?
No. Vite supplies a development server, module transforms, and production builds. Palamedes adds message authoring, catalog loading, extraction, validation, runtime access, and renderer integrations on top of that pipeline.
Should the Palamedes plugin run before the React or Solid plugin?
Yes. Put palamedes() before the renderer plugin so message macros are transformed while their original TypeScript and JSX structure is still available.
Does Palamedes type-check my Vite application?
No. Like Vite itself, the plugin transforms source modules rather than running whole-program type checking. Keep tsc --noEmit or your existing type-check command in development and CI.
Can I use Palamedes with Vue or Svelte?
Vue 3 + Vite has an experimental browser-only integration: core macros work directly in SFC script blocks, with native extraction and automatic catalog delivery. A separate Nuxt 4 Node SSR proof reuses that compiler. Vue rich text and Svelte remain unsupported. See the Vue and Nuxt framework pages for the runnable proofs and their boundaries.

Add one Vite plugin, then keep the whole translation workflow coherent.