Skip to content

awesome-webextension/vue-plugin-webextension-i18n

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vue-plugin-webextension-i18n

Vue.js plugin that wraps the extension internationalization api. Supports WebExtension and native Chrome extension.

Install

Vue3 & Vue2 both are supported.

npm add vue-plugin-webextension-i18n

Usage

This plugin exposes an instance method $i18n whose signature is identical to that of i18n.getMessage.

Vue2

import Vue from 'vue'
import i18n from 'vue-plugin-webextension-i18n'
Vue.use(i18n)

new Vue({
  template: "<h1>{{ $i18n('title') }}</h1>",
  mounted () {
    const info = this.$i18n('info_head') + Date.now()
    // ...
  }
})

Vue3

import { createApp } from 'vue'
import i18n from 'vue-plugin-webextension-i18n'

const app = createApp({
  template: "<h1>{{ $i18n('title') }}</h1>",
  mounted () {
    const info = this.$i18n('info_head') + Date.now()
    // ...
  }
})
app.use(i18n)
app.mount('#app')

About

Vue.js plugin that wraps the extension internationalization api. Supports WebExtension and native Chrome extension.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published