vue-i18n-directives
vue-i18n-directives
Support
- Vue.js 2 ➡️
vue-i18n-directives@>=2.0.0[master] - Vue.js 1 ➡️
vue-i18n-directives@>=1.0.0
Prerequisites
Installation
$ npm i -S vue-i18n-directives
$ yarn add vue-i18n-directives
Directives
v-t➡️ Translate and set text through elementinnerText.v-ta➡️ Translate and append text through elementinnerTextv-tp➡️ Translate and set text to inputplaceholder.v-tc➡️ Translate and set capitalized text through elementinnerText.v-tu➡️ Translate and set uppercased text through elementinnerText.v-tl➡️ Translate and set lowercased text through elementinnerText.
Usage
// main.js
import Vue from 'vue';
import VueI18n from 'vue-i18n';
import VueI18nDirectives from 'vue-i18n-directives';
Vue.use(VueI18n);
Vue.use(VueI18nDirectives);
// ...
<script>
// Component.vue
export default {
name: 'Component'
};
</script>
<template lang="pug">
<h1 v-t="'user.name'"></h1> <!-- normal translation -->
<input v-tp="user.password'"/> <!-- placeholder translation -->
<p v-tc="'user.jobTitle'"></p> <!-- capitalize translation -->
<p v-tu="'user.role'"></p> <!-- uppercase translation -->
<p v-tl="'user.nickname'"></p> <!-- lowercase translation -->
<p v-ta="'user.profile'">This will not be overwritten</p> <!-- append translation -->
</template>
Development
# dev mode
$ npm run dev
# test
$ npm run test
# build
$ npm run build
# docs
$ npm run docs
License
Code Style
This project was built with yeoman and generator-vue-component ❤️
Related Packages
Version History
| Version | Released | Vue | License |
|---|---|---|---|
| 3.0.1 | MIT | ||
| 3.0.0 | MIT | ||
| 2.1.3 | MIT | ||
| 2.1.2 | MIT | ||
| 2.1.1 | MIT | ||
| 2.1.0 | MIT | ||
| 2.0.3 | MIT | ||
| 2.0.2 | MIT | ||
| 2.0.1 | MIT | ||
| 1.0.0 | MIT | ||
| 0.0.9 | ^1.0.26 | MIT | |
| 0.0.8 | ^1.0.26 | MIT | |
| 0.0.7 | ^1.0.26 | MIT | |
| 0.0.6 | ^1.0.26 | MIT | |
| 0.0.5 | ^1.0.26 | MIT | |
| 0.0.4 | ^1.0.26 | MIT | |
| 0.0.3 | ^1.0.26 | MIT | |
| 0.0.2 | ^1.0.26 | MIT | |
| 0.0.1 | ^1.0.26 | MIT |