Svelte & SvelteKit i18n: A Beginner-Friendly Localization Guide

A ground-up guide to localizing a Svelte 5 / SvelteKit 2 app. Starts by building a 40-line i18n layer with runes so the mechanism is clear — then shows the SSR bug that module-level state guarantees, and fixes it with context. Covers the three decisions you make before writing code, a library shortlist, then two complete paths: svelte-i18n (register, init, waitLocale, ICU plurals, $date and $number formatters) and Paraglide JS (compiled typed messages, the reroute and paraglideMiddleware hooks, localizeHref and setLocale). Plus Accept-Language detection with q-value sorting in hooks.server.js, %lang% and dir via transformPageChunk, a switcher that persists to a cookie, locale-prefixed routes with a param matcher, canonical and hreflang tags, the five SSR traps with the symptom for each, prerendering every locale, a missing-key CI gate, and a JSON ↔ PO round trip so translators work in the format their tools speak.

Back to the PO-File blog