Soft launchDialecto is still in testing, and details on this site may change as we finish it.

Svelte live editing

Live editing on Svelte lets you click any text in your running SvelteKit app and edit it in a Dialecto sidebar while vite dev runs. It works with Paraglide and with svelte-i18n. Production adds nothing: vite build, vite preview and every adapter get no route, script, marker or file from the add-on.

Install

npm install --save-dev @dialecto/svelte

It supports SvelteKit 3.1 on Vite 8, and SvelteKit 2.70 on Vite 5 to 8, with Svelte 5 and Node 22 or later. Paraglide support needs Paraglide JS 2 with @inlang/plugin-message-format 4. Paraglide 1 (@inlang/paraglide-sveltekit) and Svelte 4 are not supported.

Setup

Paraglide

One edit in vite.config, listed after paraglideVitePlugin() and before sveltekit().

import { paraglideVitePlugin } from '@inlang/paraglide-js'
import { sveltekit } from '@sveltejs/kit/vite'
import { dialectoSvelte } from '@dialecto/svelte'

export default {
  plugins: [paraglideVitePlugin({ project: './project.inlang', outdir: './src/lib/paraglide' }), dialectoSvelte(), sveltekit()],
}

Run vite dev, open the page and click a text. Change it in the sidebar. A reload keeps the draft, and Discard drops it.

svelte-i18n

The same edit, without the Paraglide plugin.

plugins: [dialectoSvelte(), sveltekit()]

Your catalogs are JSON files that the code imports, through register(locale, () => import('./locales/en.json')) or addMessages(locale, json). The add-on marks every string in those JSON modules as Vite loads them. A catalog in static/ that is fetched at run time is not seen, because it has to go through Vite.

The add-on finds the catalog folder itself: every folder outside node_modules with two or more <locale>.json files that a file importing svelte-i18n imports, or sits next to. When several folders match, it stops with an error. Name the one to edit with dialectoSvelte({ catalogs: 'src/lib/locales' }) or DIALECTO_CATALOGS. npx @dialecto/svelte doctor prints the folders it found.

If the page script does not load on a SvelteKit version whose dev client entry has another name, add dialectoHandle from @dialecto/svelte/handle to the sequence in src/hooks.server.js, in place of the default loading.

Editable text

  • Placeholders. With Paraglide, a draft of Hello {name}! shows with {name} filled in from the page’s inputs. Formatters and markup are not run, and Reload to preview shows the draft in the page.
  • Plurals. With Paraglide, variant messages (plural and match) show a marker, but their text is read-only in the sidebar. With svelte-i18n, a plain message and a {name} message preview on save, and ICU messages (plural, select) show Reload to preview.
  • Nested and flat. With svelte-i18n, both catalog shapes work.

Keys ending .url, .path, .href, .slug or _format, and anything in skipKeys, are left unmarked, because a marker inside an href or a class would break it.

Settings

Each option is also a DIALECTO_* variable where there is one: catalogs, paraglideOutdir (DIALECTO_PARAGLIDE_OUTDIR), library, sourceLocale, url, project, saveToFiles, enabled, skipKeys, toggleKey, hidden and corner. With Paraglide, catalogs defaults to the folders in the pathPattern of project.inlang/settings.json, else messages. enabled: false or DIALECTO_IN_CONTEXT=off turns the add-on off in dev.

Pull requests

Your edits are saved in Dialecto as drafts on your project, and the pull request is opened from the sidebar. With saveToFiles, plus DIALECTO_SCAN_TOKEN and a numeric DIALECTO_PROJECT, Save to files writes the new text into messages/{locale}.json instead, changing only the bytes of that value. Your team reviews and merges the result the usual way.