vite-plugin-lingo

raw JSON →
0.1.4 verified Mon Apr 27 auth: no javascript

Vite plugin that provides a visual editor for Gettext .po translation files in Vite projects. Current stable version is 0.1.4. The plugin adds a web UI for browsing and editing .po files, includes HMR support, and integrates with the wuchale i18n library. Key differentiators: framework-agnostic (works with any Vite setup), built-in HMR, and support for SvelteKit conventions. It is AGPL-3.0 licensed and published with npm provenance. Release cadence is rapid with frequent patches.

error Error: Default export is not a function
cause Using named import { lingo } instead of default import lingo.
fix
import lingo from 'vite-plugin-lingo'
error Error [ERR_REQUIRE_ESM]: require() of ES Module
cause Using require() without .default in a CommonJS context.
fix
const lingo = require('vite-plugin-lingo').default;
error Error: Cannot find module 'svelte'
cause Missing Svelte peer dependency.
fix
npm install --save-dev svelte
breaking Plugin requires Vite 5, 6, or 7; incompatible with Vite 4.x or older versions.
fix Upgrade Vite to ^5.0.0, ^6.0.0, or ^7.0.0.
gotcha The plugin uses Svelte internally and requires Svelte as a peer dependency (^4.0.0 || ^5.0.0).
fix Install svelte: npm install --save-dev svelte
gotcha In CommonJS environments, require() returns the module object; use .default to get the plugin function.
fix const lingo = require('vite-plugin-lingo').default;
gotcha The `restartOnPoChange` option is a 'nuclear' option; enabling it unnecessarily causes dev server restarts on every .po file change.
fix Use `reloadOnPoChange: true` instead unless you have a plugin conflict.
npm install vite-plugin-lingo
yarn add vite-plugin-lingo
pnpm add vite-plugin-lingo

Sets up vite-plugin-lingo with a custom route and locales directory in Vite config.

// vite.config.ts
import { defineConfig } from 'vite';
import lingo from 'vite-plugin-lingo';

export default defineConfig({
  plugins: [
    lingo({
      route: '/_translations',
      localesDir: './locales',
    }),
  ],
});