vue-i18n-mixin
Simple internationalisation mixin for Vue.js
Installation
npm install --save vue-i18n-mixin
Usage
In the Vue Model
var root = mixins: data: locale: 'en' translations: header: title: en: 'Hello' fr: 'Bonjour' { // If you need to dynamically create the translations this$optionstranslations = // ... ; } { var title; // You can translate in the VM title = this; // Will return 'Hello' // You can force a locale title = this; // Will return 'Bonjour' // You can use the shorthand title = this };
In a view
{{ t('header.title') }}