vue-mini-translate
v1.1.0
Published
A copy of ```i18n``` but very, very, _very_ slim and blazingly fast. If you need a simple translation tool and ```i18n``` is too big, use ```vue-mini-translate```!
Downloads
2
Readme
vue-mini-translate
A copy of i18n
but very, very, very slim and blazingly fast. If you need a simple translation tool and i18n
is too big, use vue-mini-translate
!
Usage
It is very simple to use this package. Follow these steps:
- Install it with the command-line:
npm install vue-mini-translate
- Add the plugin to your app:
import Vue from 'vue'
import VMT from 'vue-mini-translate'
Vue.use(VMT)
- Add a language with translations:
import enObject from '../locales/en.json' // { test: 'test-text', key567: 'value749' [...] }
// small amount of language
this.$mt.addLanguage('de', {
test: 'test-text'
})
// bulk import
this.$mt.addLanguage('en', { ...enObject })
- Set a language (default is 'de')
this.$mt.setLanguage('en')
- Get the value
<template>
<div class="translation">{{$t('test')}}</div>
<!-- output: test-text -->
</template>
- That's it. This plugin can't do anything else.
Development
Feel free to fork this project and/or contribute to this repository. This codebase will be improved, but no more Features will be active added.