Vue CLI plugin to add vue-i18n to your Vue Project
vue-cli-plugin-i18n will soon be transferred to intlify organaization. After that, it will be developed and maintained on intlify.
The vue-cli-plugin-i18n
that has been released on npm will be released as @intlify/vue-cli-plugin-i18n
in near future.
Intlify is a new i18n project kickoff by @kazupon. ๐
- vue-i18n basic scaffolding
- Locale messages in Single File components with vue-i18n-loader
- Locale messages missing & unused reporting (experimental)
- Env Variables
If yon don't have a project created with Vue CLI:
vue create my-vue-app
Install the plugin into your project:
cd my-vue-app
vue add i18n
-
vue-cli-service i18n:report
(experimental)Report the missing locale message keys and unused keys.
NOTE: limitation
vue-cli-service i18n:report
cannot detect missing and unused keys from local messages of i18n custom blocks.
When vue-i18n code files had been scaffolded into your project, the following env variables generate into .env
:
-
VUE_APP_I18N_LOCALE
The locale of project localization, default
en
. -
VUE_APP_I18N_FALLBACK_LOCALE
The locale of project fallback localization, default
en
.
These env variables are read in src/i18n.(js|ts)
.
vue-cli-plugin-i18n
have some plugin options in vue.config.js
:
module.exports = {
pluginOptions: {
i18n: {
locale: 'ja', // The locale of project localization
fallbackLocale: 'en', // The fallback locale of project localization
localeDir: 'locales', // The directory where store localization messages of project
enableInSFC: false // Enable locale messages in Single file components
}
}
}
See the prompts.js
.
Details changes for each release are documented in the CHANGELOG.md.
Please make sure to read the Issue Reporting Checklist before opening an issue. Issues not conforming to the guidelines may be closed immediately.
Managed with GitHub Projects
Please make sure to read the Contributing Guide before making a pull request.