i18next
TransLocale for SvelteKit.
Connect native i18next catalogs to SvelteKit with translation state scoped to each rendered component tree.
1. Install
Run this from your application directory.
npm install @translocale/svelte i18next2. Connect your project
Create a cloud project and replace PROJECT_UUID with its ID. The source and target languages must match your local configuration. Adjust the example locales to your project.
npx translocale-svelte init --api https://translocale.io --project PROJECT_UUID --source en --locales en,fr,ar --namespaces common,checkoutApprove translation access in the browser:
npx translocale-svelte login --scope translateSign-in is shared with your other TransLocale tools for this project. Keep credentials in developer tooling or CI. Your deployed app reads its own translation files.
3. Wire up your app
Setup generates src/lib/translocale-resources.ts. Call provideTranslations from @translocale/svelte/runtime inside your locale layout's component script, then useTranslations in descendants. Update the provider when the route language changes. The included README shows the layout code, and the consumer example sets the document language and direction for server rendering and browser navigation. Add translocale-svelte check before vite build.
4. Translate, review, and download
Inspect the plan before running translate. The example caps the job at 1,000 source characters across its target languages. Waiting stops after two minutes; a timeout leaves the job running.
npx translocale-svelte plan
npx translocale-svelte translate --max-characters 1000 --wait
npx translocale-svelte pull --job JOB_UUID --locale fr --revision 1
npx translocale-svelte checkReplace JOB_UUID with the completed job ID. Before pulling revision 1, save that revision in the dashboard and review its wording. Choose the exact saved revision you want to ship, then repeat pull for each target locale. Revision 0 is the original generated output.
Normal application builds use saved catalogs and make no paid translation requests.
Already have translations?
Run npx translocale-svelte discover --source en to find locale and namespace directories. Initialize from a reviewed candidate using the included discovery guide. Sync compares incoming revisions with local edits and a recorded baseline, then requires an explicit plan hash before writing.
Current limits
- Uses native i18next JSON v4 with default separators. svelte-i18n and Paraglide catalogs, translated URL slugs, and rich-component rendering are not supported.
- The preview uses Svelte 5's supported legacy component syntax. Local Cloudflare server rendering and browser hydration are tested; hosted consumer deployment and lazy catalog loading remain pending.
The service accepts up to 100 KB and 200 messages per source document, with up to 10 target languages. Expanded target messages must also fit the adapter's limits. Read the file compatibility guide.