🌐 vue-i18n-extensions
Extensions for vue-i18n
This library exports the following extensions:
- directive:
v-t
custom directive for server-side - module:
v-t
custom directive compiler module forvue-template-compiler
orvue-loader
(compilerModules
option)
💿 Installation
$ npm i --save-dev vue-i18n-extensions
🚀 Extensions
v-t
custom directive for server-side
directive: This directive is v-t
custom directive for server-side-rendering. You can specify it as directives
option of createRenderer
function.
The following example:
Vue const i18n = locale: 'en' messages: en: hello: 'hello' ja: hello: 'こんにちは' const renderer = const app = i18n { // <p v-t="'hello'"></p> return } renderer
v-t
custom directive compiler module
module: This module is v-t
custom directive module for vue compiler. You can specify it as modules
option of vue-template-compiler
.
⚠️ NOTE: This extension is not isomorphic/universal codes. for Node.js environment only.
The following example that use compile
function of vue-template-compiler
:
Vue const i18n = locale: 'en' messages: en: hello: 'hello' ja: hello: 'こんにちは' { console }const i18nModule = modulei18n const ast render = console // output -> 'hello'console // output -> `with(this){return _c('p',{domProps:{"textContent":_s("hello")}})}`
The following configration example of vue-loader
:
const Vue = const VueI18n = const i18nExtensions = const messages = Vue const i18n = locale: 'ja' messages: messages moduleexports = module: rules: test: /\.vue$/ loader: 'vue' options: compilerModules: i18nExtensions // other vue-loader options go here loaders: {}
📜 Changelog
Details changes for each release are documented in the CHANGELOG.md.
❗️ Issues
Please make sure to read the Issue Reporting Checklist before opening an issue. Issues not conforming to the guidelines may be closed immediately.
💪 Contribution
Please make sure to read the Contributing Guide before making a pull request.