vuejs-localization

Convenient way to retrive strings in various languages in Vuejs.
10,273 27
Install
npm install vuejs-localization
Latest Version:1.0.3
License:ISC
Last Updated:Jul 3, 2020
Links: GitHub  ·  npm
Maintainer: valterlorran

vuejs-localization

Installation

$ npm install vuejs-localization --save

Setup

var Vue = require('vue');
var Lang = require('vuejs-localization');

//Notice that you need to specify the lang folder, in this case './lang'
Lang.requireAll(require.context('./lang', true, /\.js$/));

Vue.use(Lang);

Lang Folder

└── lang
    ├── en
    |  └──messages.js
    └── pt
       └──messages.js

Lang file

//messages.js
module.exports = {
  hello_world : 'Hellow World!'
}

Usage

$lang.{file}.{key}
<h1>{{$lang.messages.hello_world}}</h1>

Results in:

<h1>Hello World</h1>

Change localization (reactive)

//inside vue instance
this.$lang.setLang('pt')

Related Packages

vue-google-translate

A vue.js wrapper for the google translate API. The package easens localization o...

8,239 18
@byjohann/vue-i18n

Lightweight internationalization plugin for Vue

8,721 7
@chepuhasasha/v-lang

This plugin for VUE is designed to save you from having to maintain language dic...

1,787
@lingva/vue

Vue adapter for Lingva localization

754 0
vuex-i18n

Easy localization for vue-components using vuex as data store

241,310 654

Version History

Version Released License
1.0.3 ISC
1.0.2 ISC
1.0.1 ISC
1.0.0 ISC