1.2.2 • Published 1 year ago

@dimailn/vue-t v1.2.2

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

vue-t

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

Installation

npm i --save @dimailn/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>
2.0.1

1 year ago

2.0.0

1 year ago

1.2.2

4 years ago

1.2.1

4 years ago

1.2.0

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago