Vue CLI i18n Plugin

2.3.2 · maintenance · verified Tue Apr 21

The `vue-cli-plugin-i18n` package is a Vue CLI plugin designed to integrate `vue-i18n` into new or existing Vue projects, streamlining the setup of internationalization. As of version 2.3.2, its latest release in late 2021, the plugin provides scaffolding for `vue-i18n`'s basic configuration, support for locale messages within Single File Components via `vue-i18n-loader`, and experimental reporting features for missing or unused locale keys. It supports both Vue 2 and Vue 3 projects, offering distinct options like `enableInSFC` for Vue 2 (related to `vue-i18n` v8.x) and `enableLegacy` or `runtimeOnly` for Vue 3 (related to `vue-i18n` v9+). Additionally, it includes a `enableBridge` option for Vue 2 projects to facilitate migration to `vue-i18n@v9.x`. The plugin is maintained by the Intlify organization, known for the `vue-i18n` library itself, ensuring close compatibility and up-to-date best practices.

Common errors

Warnings

Install

Imports

Quickstart

This demonstrates how to create a new Vue project, add the i18n plugin, and integrate the scaffolded internationalization setup into the main application entry point.

vue create my-vue-app
cd my-vue-app
vue add i18n

// After installation, a src/i18n.js (or .ts) file will be generated.
// You can then use it in your main.js (or main.ts):
// src/main.js
import { createApp } from 'vue'
import App from './App.vue'
import i18n from './i18n' // Auto-generated by the plugin

createApp(App).use(i18n).mount('#app')

// To report missing/unused keys (experimental):
// vue-cli-service i18n:report

view raw JSON →