sveltekit-i18n Internationalization for SvelteKit

Examples

Standalone applications, each covering one decision you make once and live with. Every one of them runs in the browser — Node and the dev server boot inside the tab, with nothing installed locally.

Routing

  • Multi-page Several routes, no locale in the URL. sveltekit-i18n/kit negotiates the locale per request from a cookie, then Accept-Language.
  • Locale in the query /about?lang=cs, resolved on the server before rendering. Not the SEO option, and it says so.
  • Locale router /en/about, /cs/about, /de/about, everything prerendered, with entries() for what the crawler cannot reach.
  • Static locale router The same routing with no server at all: one HTML file per page per locale.
  • Advanced locale router The default locale keeps the bare URL and the error page is yours, translated on the first hit. This site routes the same way.

Component-scoped translations

  • Component-scoped (CSR) A component carrying its own instance and its own lexicon, loaded in the browser.
  • Component-scoped (SSR) The same component, loaded by the page and handed down through snapshot() and hydrate(): complete on the first render.

Content

  • mdsvex A route written in Markdown: t() inside .svx, route-scoped loading, prerendered per locale.

Extensions

  • Stores The $t store surface from v2 on a 3.x core: extension-stores in the config handed to defineI18n(), and a language switcher bound to $locale.
  • Typed access Keys as members of t: extension-typed-access in the config handed to defineI18n(), and t.home.title() typed from the generated schema.
  • HTML Markup in a message rendered as elements: extension-html's T component, a payload rendered as text, a tag mapped to a component, and what never renders.