Vue i18n Translation Extractor

2.0.7 · active · verified Sun Apr 19

vue-i18n-extract is a development tool designed for managing `vue-i18n` localization within Vue.js projects through static code analysis. It scans Vue Single File Components (SFCs), JavaScript, and TypeScript files to identify used i18n keys and compares them against existing translation files (e.g., JSON, YAML). This helps developers find missing translations, identify unused keys that can be safely removed, and detect duplicate keys. The current stable version is 2.0.7, with an active release cadence, frequently incorporating new features and bug fixes as evidenced by recent patch releases. Its primary differentiation lies in its comprehensive static analysis approach for Vue-specific i18n usage, supporting various patterns like `$t`, `v-t`, and `Translation` components.

Common errors

Warnings

Install

Imports

Quickstart

This `package.json` excerpt demonstrates how to integrate `vue-i18n-extract` into a project using npm scripts for reporting, adding, and removing translation keys.

{
  "name": "my-vue-i18n-app",
  "version": "1.0.0",
  "description": "My Vue.js i18n project",
  "main": "index.js",
  "scripts": {
    "i18n:report": "vue-i18n-extract report --vueFiles './src/**/*.?(js|ts|vue)' --languageFiles './src/locales/*.?(json|yml|yaml)' --ci",
    "i18n:add": "vue-i18n-extract report --vueFiles './src/**/*.?(js|ts|vue)' --languageFiles './src/locales/*.?(json|yml|yaml)' --add",
    "i18n:remove": "vue-i18n-extract report --vueFiles './src/**/*.?(js|ts|vue)' --languageFiles './src/locales/*.?(json|yml|yaml)' --remove"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "vue-i18n-extract": "^2.0.0"
  }
}

view raw JSON →