Vite live editing
Live editing on Vite lets you click any text in your running React or plain Vite app and edit it in a Dialecto sidebar. It runs on the Vite dev server only. It is the same add-on as the Astro guide, used as a Vite plugin. Vue and Svelte apps have their own add-ons: see Vue and Nuxt and Svelte.
Install
npm install --save-dev @dialecto/astro
The package is the same one Astro uses. The add-on also exists as a single dependency-free file that Dialecto
offers as a download on the project’s settings page. Copy it into the app, for example into tooling/, and
import it by path instead.
Setup
The add-on needs Vite 8 and Node 22 or later.
// vite.config.js
import react from '@vitejs/plugin-react';
import { dialectoInContextVite } from '@dialecto/astro';
export default defineConfig({ plugins: [react(), dialectoInContextVite()] });
Run vite. An Edit text button appears at the bottom right of every page. The editor signs in with your
Dialecto account, and the first time a Dialecto window asks you to allow it. The add-on finds the project from
your git remote.
Under the dev server only, the plugin marks the catalogs, serves two loopback routes, adds the overlay to
index.html, and swaps intl-messageformat for a recording formatter. A build carries none of it.
Editable text
The app reads its text from src/i18n/messages/<locale>.json, flat JSON catalogs in ICU message format, and
formats it with intl-messageformat.
- Placeholders. The recording formatter keeps the argument values each message was formatted with, so the preview of your edit uses the values the page used.
- Flat catalogs only. Nested catalogs are edited in Dialecto’s web editor, not on the page.
Settings
The options are the same as on Astro, with the same variables: url, project, catalogs (default
src/i18n/messages), sourceLocale (default en), enabled, toggleKey, hidden, corner and
saveToFiles. See the settings table. DIALECTO_IN_CONTEXT=off
turns the add-on off.
Pull requests
Your edits are saved in Dialecto as drafts on your project. The pull request is opened from the sidebar, and it
changes only the edited values in your catalogs. Your team reviews and merges it the usual way. With
saveToFiles, Save to files writes the drafts into your working tree instead, and you commit them yourself.