Gathering detailed insights and metrics for vue-i18n-extract
Gathering detailed insights and metrics for vue-i18n-extract
Gathering detailed insights and metrics for vue-i18n-extract
Gathering detailed insights and metrics for vue-i18n-extract
@ifreeovo/i18n-extract-cli
这是一款能够自动将代码里的中文转成i18n国际化标记的命令行工具。当然,你也可以用它实现将中文语言包自动翻译成其他语言。适用于vue2、vue3和react
vue-i18n-extract-plugin
针对vue/react项目,从js/jsx/ts/tsx/vue文件提取语言,并生成语言包到json文件中,并支持将生成的key重写入文件中.
i18n-extract-utils
React/Vue i18n extraction and transformation utility
xxmi-vue-i18n-extract
Manage vue-i18n localization with static analysis
Manage vue-i18n localization with static analysis
npm install vue-i18n-extract
Typescript
Module System
95.9
Supply Chain
99.6
Quality
76.8
Maintenance
100
Vulnerability
98.2
License
TypeScript (92.72%)
JavaScript (7.28%)
Total Downloads
18,060,448
Last Day
1,792
Last Week
72,491
Last Month
306,741
Last Year
3,834,995
MIT License
345 Stars
442 Commits
88 Forks
7 Watchers
5 Branches
28 Contributors
Updated on Jul 01, 2025
Minified
Minified + Gzipped
Latest Version
2.0.7
Package Id
vue-i18n-extract@2.0.7
Unpacked Size
0.98 MB
Size
256.10 kB
File Count
50
Cumulative downloads
Total Downloads
Last Day
-29.4%
1,792
Compared to previous day
Last Week
-3.8%
72,491
Compared to previous week
Last Month
-33.7%
306,741
Compared to previous month
Last Year
5.8%
3,834,995
Compared to previous year
vue-i18n-extract
is built to work with your Vue.js projects using the library vue-i18n. It runs static analysis on your Vue.js source code looking for any vue-i18n
usage, in order to:
Run from the command line:
1npx vue-i18n-extract report --vueFiles './path/to/source-files/**/*.?(js|vue)' --languageFiles './path/to/language-files/*.?(json|yml|yaml)'
Install the package in your project:
1npm install --save-dev vue-i18n-extract
Use it via an npm script in your package.json
file:
1{ 2 "scripts": { 3 "vue-i18n-extract": "vue-i18n-extract report --vueFiles './path/to/source-files/**/*.?(js|vue)' --languageFiles './path/to/language-files/*.?(json|yml|yaml|js)'" 4 } 5}
Finally, run:
1npm run vue-i18n-extract
This will print out a table of missing keys in your language files, as well as unused keys in your language files.
Install the package in your project:
1npm install --save-dev vue-i18n-extract
Import the module and use it like this:
1const VueI18NExtract = require('vue-i18n-extract');
2
3const report = VueI18NExtract.createI18NReport({
4 vueFiles: './path/to/vue-files/**/*.?(js|vue)',
5 languageFiles: './path/to/language-files/*.?(json|yml|yaml|js)',
6});
You can use the following configuration options via the vue-i18n-extract command line utility or a vue-i18n-extract.config.js
configuration file.
You can generate a default configuration file using npx vue-i18n-extract init
(it uses the following options: vue-i18n-extract.config.ts
). Once you have a configuration file, you can run npx vue-i18n-extract
.
vueFiles
vueFiles
--vue-files
, --vueFiles
string
./path/to/source-files/**/*.?(js|vue)
./tests/fixtures/**/*.?(vue|js)
languageFiles
languageFiles
--language-files
, --languageFiles
string
./path/to/language-files/*.?(json|yml|yaml)
./tests/fixtures/lang/**/*.json
output
output
--output
string
output.json
add
add
--add
false
boolean
remove
remove
--remove
false
boolean
ci
ci
--ci
false
boolean
separator
separator
--separator
'.'
string
exclude
exclude
--exclude
[]
string
or array of string
scompany.meta
in company.meta.motto
), the entire node of the object indicated by the sub segment will be excluded.exclude: ['translation_key_1', 'translation_key_2']
--exclude translation_key_1 --exclude translation_key_2
detect
detect
--detect
['missing', 'unused', 'dynamic']
string
or array of string
sdetect: ['missing', 'unused']
--detect missing --detect unused
noEmptyTranslation
noEmptyTranslation
--no-empty-translation
, --noEmptyTranslation
''
string
'*'
: Generate empty default translation for all locales.'en'
: Generate empty default translation for locale 'en'
.'en-US'
: Generate empty default translation for locale 'en-US'
.missingTranslationString
missingTranslationString
--missing-translation-string
, --missingTranslationString
''
string
or null
'Translation missing'
: Use "Translation missing" as default key.null
: Add the translation key to the file, but don't add a default translation. This will trigger vue-i18n
's the missingHandler.vue-i18n
Formats1// Single or double quote, and template literals 2$t('key.static') $t("key.static") $t(`key.static`) 3 4// Without dollar sign 5t('key.static') t("key.static") t(`key.static`) 6 7// $tc Support for use with plurals 8$tc('key.static', 0) $tc("key.static", 1) $tc(`key.static`, 2) 9 10// Without dollar sign 11tc('key.static', 0) tc("key.static", 1) tc(`key.static`, 2)
1<i18n path="key.component"></i18n> 2<i18n-t keypath="key.component"></i18n-t> 3<Translate keypath="key.component"></Translate>
Note: As of right now there is no support for binding in a path like
:path="condition ? 'string1' : 'string2'"
there is just support for strings as shown above.
1const TranslationComponentInCode = h(Translation, { 2 keypath: 'Translation component in code.', 3 tag: 'p', 4});
1<p v-t="'key.directive'"></p> 2<p v-t.preserve="'key.directive'"></p>
Note: As of right now there is no object support to reference a path from component data.
Setting up a Vue.js app with internationalization (i18n) support is easy nowadays: Once you have installed the plugin and injected into the Vue instance, you can just put $t('Hello World')
inside Vue.js component templates to use the plugin.
However, in our personal experience we found it very difficult to keep the language files and the .vue
files in sync.
That's why we wrote vue-i18n-extract
. We needed a way to analyze and compare our language files to our Vue.js source files, then report the result in a useful way.
Please make sure to read the Contributing Guide before making a pull request.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 11/16 approved changesets -- score normalized to 6
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
22 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-06-23
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More