# da-translate

> Simple Vue.js library for language translations with support of masks.

Latest version **0.1.4** (published 2018-09-27) · 0 weekly downloads

## Install

```sh
npm install da-translate
pnpm add da-translate
yarn add da-translate
bun add da-translate
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; low quality score; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.4 |
| Published | 2018-09-27 |
| First published | 2018-09-26 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 577.8 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | Vitaliy Baychura |
| Maintainers | div-art |
| Keywords | vue, translations, translate |

## Links

- npm: https://www.npmjs.com/package/da-translate
- npm.io page: https://npm.io/package/da-translate

## Dependencies (1)

- [vue](https://npm.io/package/vue.md) ^2.5.17

## Alternatives

- [messageformat](https://npm.io/package/messageformat.md) — 329.7K weekly downloads
- [@mintlify/scraping](https://npm.io/package/@mintlify/scraping.md) — 294.8K weekly downloads
- [@mintlify/previewing](https://npm.io/package/@mintlify/previewing.md) — 209.5K weekly downloads
- [@mintlify/prebuild](https://npm.io/package/@mintlify/prebuild.md) — 209.5K weekly downloads
- [@mintlify/link-rot](https://npm.io/package/@mintlify/link-rot.md) — 206.3K weekly downloads

## Recent versions

- 0.1.4 (latest) — 2018-09-27
- 0.1.3 — 2018-09-27
- 0.1.2 — 2018-09-27
- 0.1.1 — 2018-09-27
- 0.1.0 — 2018-09-26

## README

# da-translate
Simple Vue.js library for language translations with support of masks.

## Project setup
```
npm install --save da-translate 
```

### Initialization
```
import Vue from 'vue'
import DaTranslate from 'da-translate'

Vue.use(DaTranslate, {
  locale: 'en',
  langs: {
    'en': {
      'simple': 'Simple message',
      'hello': 'Hello, :user'
    },
    'ru': {
      'simple': 'Простое сообщение',
      'hello': 'Привет, :user',
    }
  }
})
```

You can also change left mask and right mask.  
For example you dont want to save user mask as ':user' and want to save as '<{user}>'.  
For this you can send left and right mask, when you initialize library  

```
Vue.use(DaTranslate, {
  locale: 'en',
  langs: {
    'en': {
      'simple': 'Simple message',
      'hello': 'Hello, <{user}>',
    },
    'ru': {
      'simple': 'Простое сообщение',
      'hello': 'Привет, <{user}>',
    },
  },
  masks: {
    left: '<{',
    right: '}>',
  }
})
```

Default values are:
```
masks: {
  left: ':',
  right: '',
}
```

### Usage
##### Inside components:


```
<template>
  <div>
    <h1>dat('simple')</h1>
    <h1>dat('hello', {user: 'John Doe'})</h1>
  </div>
</template>
```

##### Inside script


```
this.dat('simple') 
```
or 
```
this.$_daTranslate.t('hello', {user: 'User name'})
```

##### Usage as imported file:

```
import daTranslate from 'da-translate'

daTranslate.t('simple')
```

##### Language Change

Only inside components

```
this.$_daTranslate.set('ru')
```

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