1.2.2 • Published 3 years ago

@dimailn/vue-t v1.2.2

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

vue-t

A small helper which allows you to write contextual translations in Vue.

Installation

npm i --save vue-t

import VueT from '@dimailn/vue-t'
Vue.use(VueT)

Usage

This library provides two computed property for components - $translationScope and $defaultTranslationScope. These properties are inherited from parent components and you may change them by using jsT option. Your translate method should use this properties to determine current scope for translations.

jsT option may be used like this

// This component has $translationScope === 'UserCard', based on name(recommended way)

{
  name: 'UserCard',
  vueT: true
}

or

// This component has $translationScope === 'UserInformation'

{
  name: 'UserCard',
  vueT: 'UserInformation'
}

Now you may use $t in this way

<template>

<div>
  <span>{{$t('.title')}}</span>
</div>

</template>

<script>

export default {
  name: 'UserCard',
  vueT: true
}

</script>
1.2.2

3 years ago

1.2.1

3 years ago

1.2.0

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago