Skip to content

Vite Plugin

Terminal window
npm install @localive/vite

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,
}),
],
});
OptionTypeDefaultDescription
translationsPathstring'src/locales'Root directory for translation JSON files
searchRootsstring[][]Additional directories to scan for translations
localesstring[]requiredSupported locale codes
defaultLocalestringfirst in localesDefault/source locale
endpointstring'/__localive-update'API endpoint path
wsbooleanfalseEnable WebSocket for multi-tab sync
wsPortnumberautoWebSocket port
  1. The plugin scans your translationsPath for JSON locale files at startup.
  2. When you edit a translation in the overlay, it sends a POST to the endpoint.
  3. The server updates the locale file on disk, preserving formatting and key order.
  4. The browser receives the update and refreshes the displayed translation instantly.

When ws is enabled, all open tabs receive live updates when any tab edits a translation.