Skip to content

Locale Map (Editor Internals)

vueI18nMapPlugin is a Vite plugin that dumps a locale map to disk when Vite is started in --mode i18n-dump, then exits immediately. It exists to feed the Locale Editor UI — you normally never call it directly. vue-i18n-kit init and vue-i18n-kit auto-config insert it into vite.config.ts/nuxt.config.ts automatically.

ts
// vite.config.ts
import { vueI18nMapPlugin } from 'vue-i18n-kit/vite'

export default defineConfig({
  plugins: [
    vueI18nMapPlugin({
      locales: {
        en: { path: 'src/locales/en.json', meta: { display: 'English', flag: '🇬🇧' } },
        ru: { path: 'src/locales/ru.json', meta: { display: 'Русский', flag: '🇷🇺' } },
      },
    }),
  ],
})
json
// package.json
{
  "scripts": {
    "i18n:ui": "vite --mode i18n-dump && vue-i18n-kit ui"
  }
}

The map is regenerated every time before the editor starts. The generated files can be added to .gitignore.

Options

locales

Record<string, string | { path, meta? }>, required. Map of locale codes to their file paths and optional metadata. Accepts either a plain path string or a { path, meta } object.

output

string · default: 'i18n-tools/locales.config.json'. Output path for the generated locale map, relative to project root.

What it writes

When Vite runs with --mode i18n-dump, the plugin writes two files during configResolved and then exits the process:

  • <output> (locales.config.json by default) — { root, generatedAt, locales: [{ code, path, meta? }] }, one entry per configured locale.
  • locales.entries.json (same directory as <output>) — a source-scan entries map built the same way as vue-i18n-kit stats/prune, used by the editor's usage map and unused/phantom-key detection.

Both files are consumed by src/ui-server/server.ts when the editor starts — this is the mechanism that lets the editor know which locale files exist and which source files reference which keys, without re-scanning the whole project on every request.