Skip to content

Configuration

Configure it in vueCompilerOptions.plugins in the Vite root tsconfig.json, or pass it as an argument to the Vite plugin function (vueInternationalization()).

To get types in VS Code and vue-tsc, configuring it in the Vite root tsconfig.json is recommended.

json
{
  "vueCompilerOptions": {
    "plugins": [
      {
        "name": "vite-vue-internationalization/volar",
        "primaryLocale": "en-US",
        "messageSyntax": "vue",
        "buildStrategy": "virtual",
        "sfcTransform": "locale-sources"
      }
    ]
  }
}
OptionDefaultDescription
primaryLocalerequiredLocale used as the source for generated types.
globalundefinedSources for global dictionaries keyed by locale.
buildStrategyvirtualChoose virtual or inline-chunks.
scan.include**/*.vueLimits Vue files collected at startup.
scan.exclude[]Excludes Vue files from collection.
messageSyntaxvueChoose vue or icu for the whole project.
sfcTransformlocale-sourcesControls which SFCs receive $locale/$l bindings. locale-sources transforms only SFCs with <locale> or defineInternationalization(), while all transforms every SFC.
globalTypedetailedControls Volar types for $locale.env and $l.env. Use runtime for very large global dictionaries to avoid expanding every key during vue-tsc.
localizerDocumentationtrueControls $l JSDoc generation for Volar hover text.

Vite transform output uses broad runtime types for $locale.env and $l.env so large global dictionary types are not duplicated into every transformed SFC. Vue Language Tools / Volar uses detailed global dictionary types by default for editor completion and vue-tsc; set globalType: "runtime" when the global dictionary is too large for type checking.

See the generated API Reference for the full VueInternationalizationOptions type.

Related API:

Next: