Documentation Index
Complete documentation for the sveltekit-i18n ecosystem, covering 3.4:
one reactive instance built on Svelte 5 runes, no stores, the parser wired in,
and sveltekit-i18n/kit wiring it into SvelteKit β npm install sveltekit-i18n
is the whole install.
Upgrading from v2? Go straight to Upgrading from v2 and the migration table. From an earlier 3.x? Read Upgrading from 3.3, Upgrading from 3.2, Upgrading from 3.1 and, from 3.0, Upgrading from 3.0.
π Getting Started
New to sveltekit-i18n? Start here:
Getting Started Guide
A SvelteKit app from nothing to multilingual, in seven steps
- Requirements and installation β Svelte 5, Node 22 / Bun 1.2 / Deno 2, ESM-only
- Basic concepts β locales, keys, loaders, namespaces, the instance
- Your first multilingual app β
translation files, the config and
defineI18n,handle,load,use()andget() - Route-based loading (split namespaces, route params), switching locales and locale-based routing
- Placeholders and modifiers,
including
parserOptions - TypeScript, with a schema generated by typegen, and testing components
Perfect for: first-time users, quick setup
π Core Documentation
Architecture Overview
Understanding how everything works
- Package overview and relationships β core, parser, this package; composition rather than inheritance, and the parser extension
- The reactive engine β runes, and why the core ships its rune modules uncompiled
- Data flow β construction, loading, translation, locale switch
- Loading strategy β route matching,
load records per loader and route params, deduplication, cache,
invalidation and
cache: false - Instance lifetime β
/kit's per-request and per-tab instances, thesnapshot()/hydrate()hand-off,destroy() - Core concepts, when to use each package, performance
Perfect for: understanding internals, making architecture decisions
API Documentation
Complete reference for sveltekit-i18n
- Installation and packaging β ESM-only, one install, bundler requirements
- Configuration β
loaders,translations,basePath,initLocale,fallbackLocale,fallbackValue,preprocess,sanitizeLocales,cache,log,schema,extensions - Parser options β
modifierDefaults,customModifiers,onReport,recognizeWrappers,onSuspectValue - The instance β reactive properties, reactive
functions, promise-returning methods
(
loadNamespaceamong them), synchronous methods (snapshotandhydrateamong them) - Message format, exported types, utilities
- TypeScript (and
typegen),
extensions β keys as members of
t, markup in a message, the pipe order - SvelteKit β
sveltekit-i18n/kit: setup, which locale,data.i18n, pitfalls - SSR by hand, testing
- Migrating from v2, upgrading from 3.3, upgrading from 3.2, upgrading from 3.1 and upgrading from 3.0
Perfect for: day-to-day development, looking up specific APIs
@sveltekit-i18n/base API Documentation
The canonical reference for every member this package inherits
- Configuration and loaders
- Instance properties and methods
- SvelteKit and server-side rendering
- Upgrading from 3.2, from 3.1 and from 3.0 β every behaviour and type change
- The parser contract β for building on the core with a different parser
- TypeScript
Perfect for: member-level detail, or using the core with a custom parser
β¨ Best Practices
Best Practices Guide
Recommended patterns for production apps
- Instance ownership β per-request
instances, the module-level singleton hazard,
destroy(), why value properties must not be destructured - Awaiting loads β await the matching
load instead of polling
loading - SSR and CSR β
/kit, the hand-off, resolving the locale withpreferredLocale, no flash of untranslated content - Organization and key naming
- Performance β lazy loading,
loadNamespace(), preloading withpreload(),cache,cache: falseandinvalidate() - TypeScript β
schemaand typegen, one payload type, locale completion, custom modifier props - Extensions β the pipe, getting the
$tsurface back, keys as members oft, markup in a message, and the order they go in - Component-scoped β isolated translation contexts
- Library authors β shipping translations with a package
- Dynamic routes β
locale-based routing through
preferredLocale, right-to-left locales - Content management β CMS, API and
database sources, remote
queryloaders - Testing β a real instance instead of a mock
- Production β logging, parser reports, loader failures, monitoring
Perfect for: building production applications, scaling your i18n implementation
π§ Troubleshooting
Troubleshooting & FAQ
Solutions to common problems
- Upgrading from v2 β
$tis not a store, destructured values that never update, the removal of.get()/.set()/.subscribe()/toPromise()/getTranslationProps(), andinstanceof - Upgrading from 3.0 β a refetch
after hydration, the
keydeprecation warning, a loader'sredirect()orerror() - Setup and packaging β
$state is not defined, two copies of the core,ERR_REQUIRE_ESM - Common issues β translations not
loading, keys instead of values, flashing content, route matching and
basePath, locale not changing, stale translations, one visitor's locale in another's page, silent parser reports, TypeScript errors and typegen, tests, performance - Debugging tips β inspect translations, enable debug logging, open the report channel, test a loader
- FAQ β common questions
- Known limitations β what to be aware of
Perfect for: fixing issues, understanding limitations
π¨ Parser Documentation
Message interpolation lives in a parser. This package wires one; the core takes any parser that satisfies base's parser contract.
@sveltekit-i18n/parser-curly
The parser wired into this package
- Placeholders
{{name}}, default values, nested placeholders, escaping - Modifiers (
number,date,currency,ago, β¦), plural selection (plural,ordinal) and comparisons - Custom modifiers, modifier defaults, the report channel and how payload
values are read β all reachable here through
parserOptions - Implements the Curly Message Format
@sveltekit-i18n/parser-icu
ICU message format
For an application that wants ICU syntax, built on
@sveltekit-i18n/base directly β this
package fills the parser slot itself and cannot take another parser.
@sveltekit-i18n/parser-mf2
Unicode MessageFormat 2
The Unicode standard's successor to ICU MessageFormat, on the core directly in the same way.
@sveltekit-i18n/parser-i18next
The i18next syntax
For translation files that already exist in i18next's syntax, interpolated by i18next's own engine β on the core directly in the same way.
Parsers Overview
The parser monorepo, and writing your own
π‘ Examples
All Examples
Working code you can learn from
Standalone applications on v3: locale routing (URL parameter, path
prefix, static adapter, default locale unprefixed), per-request negotiation
from a cookie and Accept-Language, component-scoped translations rendered on
the client, and on the server handed over through snapshot() and hydrate(),
t() inside Markdown routes, the $t store surface of extension-stores,
the member keys of extension-typed-access, and the markup extension-html
renders.
π¦ Package Documentation
This Package
- sveltekit-i18n README β overview and quick start
- Contributing guide β repository layout, workflow, tests
- Releases β version history
The Family
- @sveltekit-i18n/base β the core; state, loading, caching, route matching, preprocessing (releases)
- @sveltekit-i18n/parser-curly, @sveltekit-i18n/parser-icu, @sveltekit-i18n/parser-mf2 and @sveltekit-i18n/parser-i18next (releases)
- @sveltekit-i18n/typegen β the
Vite plugin that generates the
schematype from your translations (releases) - @sveltekit-i18n/sv β the Svelte
CLI add-on that sets sveltekit-i18n up in a SvelteKit project
(
npx sv add @sveltekit-i18n) (releases) - Extensions β official
adapters for the
config.extensionspipe: @sveltekit-i18n/extension-stores (the$t/$locale/$loadingsurface), @sveltekit-i18n/extension-typed-access (keys as members oft) and @sveltekit-i18n/extension-html (markup in a message, rendered as elements and Svelte components) (releases) - Curly Message Format β the message format specification
base, parsers, extensions and typegen release first; sveltekit-i18n
after them, since it pins the core and the parser exactly; and
@sveltekit-i18n/sv last, since it installs the others. Read a package's
current version off npm.
π― Quick Links by Task
I want to...
Learn the basics
Upgrade an app from v2
β Upgrading from v2 and the migration table
Get $t back
β Best Practices: Extensions
Use keys as members of t
β API Docs: Keys as members of t or
Best Practices: Keys as members of t
Render markup in a message
β API Docs: Markup in a message or Best Practices: Markup in a message
Understand how it works
Look up an API
β API Documentation or base API Documentation
Wire it into SvelteKit
β API Docs: SvelteKit or Getting Started
Render on the server without leaking a visitor's locale
β API Docs: SvelteKit, API Docs: SSR by hand or Best Practices: Instance Ownership
Upgrade an app from 3.3
β API Docs: Upgrading from 3.3
Upgrade an app from 3.2
β API Docs: Upgrading from 3.2
Upgrade an app from 3.1
β API Docs: Upgrading from 3.1
Upgrade an app from 3.0
β API Docs: Upgrading from 3.0 and Troubleshooting: Upgrading from 3.0
Serve the app under a base path
Load a namespace on demand
Build a production app
Fix an issue
See working code
β Examples
Write a custom modifier or open the report channel
β API Docs: Parser options or parser-curly
Use a different message format
β Architecture: When to Use Each Package
Create locale-based URLs
β Best Practices: Dynamic Routes
Optimize performance
β Best Practices: Performance or Architecture: Performance
Type my keys and payloads
β API Docs: typegen, Best Practices: TypeScript or API Docs: TypeScript
Load from an API or database
β Best Practices: Content Management or base API: Loaders
Test components that translate
β Best Practices: Testing or Getting Started: Testing
Deploy to production
β Best Practices: Production
π Reading Order
For Beginners
- Getting Started Guide β learn by building
- API Documentation β the surface, member by member
- Best Practices β level up your implementation
For Upgraders
- Upgrading from v2 β the first-day errors
- Migrating from v2 β the old member, the new one
- Upgrading from 3.3 β what 3.4 changes
- Upgrading from 3.2 β what 3.3 changes
- Upgrading from 3.1 β what 3.2 changes
- Upgrading from 3.0 β what 3.1 changes
- Best Practices: Instance Ownership β what per-request instances change
For Advanced Users
- Architecture Overview β understand the system
- base API Documentation β deep dive
- Parsers and Extensions β custom message formats and custom surfaces
For Troubleshooting
- Troubleshooting Guide β find your issue
- FAQ β common questions
- GitHub Issues β get help
π€ Contributing
Interested in contributing to sveltekit-i18n?
- Contributing Guide β setup, workflow, tests, PRs
- GitHub Repository β main library, and the shared issue tracker for the whole family
- Issues β report bugs, request features
- Discussions β ask questions, share ideas
π License
MIT License β See individual repositories for details.
Can't find what you're looking for? Check the Troubleshooting Guide for how to get help.