vue-translate

A translator directive for Vue
4,287 3
Install
npm install vue-translate
Latest Version:0.0.1
Last Updated:Dec 15, 2023
Links: GitHub  ·  npm
Maintainer: lepture

Vue Translate

A translator directive for Vue.

The Basics

var Vue = require('Vue');
var translate = require('vue-translate');
Vue.use(translate);

// the messages data
translate.messages = {
  "hello": "你好"
};

Use as directive

The v-trans directive will translate title, arial-label, alt and text content automaticly.

<div v-trans title="hello">hello</div>

<!-- will be translated to -->
<div title="你好">你好</div>

Translate more attributes

If the message you want to translate is not on the default attributes, e.g. data-message, you can pass it to v-trans.

<div v-trans="data-message" data-message="hello">hello</div>

<!-- will be translated to -->
<div data-message="你好">你好</div>

Version History

Version Released Vue License
0.0.1 ^0.12.10