Vite Plugin
Install
Section titled “Install”npm install @localive/viteConfiguration
Section titled “Configuration”Add localive to your Vite config:
import { defineConfig } from 'vite';import { localive } from '@localive/vite';
export default defineConfig({ plugins: [ localive({ translationsPath: 'src/locales', locales: ['en', 'fr', 'de'], defaultLocale: 'en', endpoint: '/__localive-update', ws: true, }), ],});Options
Section titled “Options”| Option | Type | Default | Description |
|---|---|---|---|
translationsPath | string | 'src/locales' | Root directory for translation JSON files |
searchRoots | string[] | [] | Additional directories to scan for translations |
locales | string[] | required | Supported locale codes |
defaultLocale | string | first in locales | Default/source locale |
endpoint | string | '/__localive-update' | API endpoint path |
ws | boolean | false | Enable WebSocket for multi-tab sync |
wsPort | number | auto | WebSocket port |
How It Works
Section titled “How It Works”- The plugin scans your
translationsPathfor JSON locale files at startup. - When you edit a translation in the overlay, it sends a POST to the
endpoint. - The server updates the locale file on disk, preserving formatting and key order.
- The browser receives the update and refreshes the displayed translation instantly.
Multi-Tab Sync
Section titled “Multi-Tab Sync”When ws is enabled, all open tabs receive live updates when any tab edits a translation.