# @dimailn/vue-t

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

Latest version **1.2.2** (published 2021-08-17) · ISC license · 0 weekly downloads

## Install

```sh
npm install @dimailn/vue-t
pnpm add @dimailn/vue-t
yarn add @dimailn/vue-t
bun add @dimailn/vue-t
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.2 |
| Published | 2021-08-17 |
| First published | 2021-04-06 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 2.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | dimailn |

## Links

- npm: https://www.npmjs.com/package/@dimailn/vue-t
- npm.io page: https://npm.io/package/@dimailn/vue-t

## Dependencies (1)

- [vue-provide-observable](https://npm.io/package/vue-provide-observable.md) ^3.0.2

## Recent versions

- 1.2.2 (latest) — 2021-08-17
- 2.0.1 (next) — 2024-06-05
- 2.0.0 — 2024-06-05
- 1.2.1 — 2021-07-27
- 1.2.0 — 2021-07-27
- 1.1.1 — 2021-05-21
- 1.1.0 — 2021-05-13
- 1.0.1 — 2021-05-13
- 1.0.0 — 2021-04-06

## README

# vue-t

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

# Installation

```npm i --save vue-t```

```javascript

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 ```vueT``` option.
Your translate method should use this properties to determine current scope for translations.

```vueT``` option may be used like this

```javascript

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

{
  name: 'UserCard',
  vueT: true
}

```

or
```javascript
// This component has $translationScope === 'UserInformation'

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

```

Now you may use ```$t``` in this way

```vue
<template>

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

</template>

<script>

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

</script>

```

---
_Source: https://npm.io/package/@dimailn/vue-t · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
