1.1.0 • Published 5 years ago

vue-mini-translate v1.1.0

Weekly downloads
8
License
-
Repository
-
Last release
5 years ago

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 js-mini-translate!

Usage

It is very simple to use this package. Follow these steps:

  1. Install it with the command-line:
npm install vue-mini-translate
  1. Add the plugin to your app:
import Vue from 'vue'
import VMT from 'vue-mini-translate'

Vue.use(VMT)
  1. 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 })
  1. Set a language (default is 'de')
this.$mt.setLanguage('en')
  1. Get the value
<template>
    <div class="translation">{{$t('test')}}</div> 
    <!-- output: test-text -->
</template>
  1. 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.