# vue-lang-js

> A Vue.js Plugin

Latest version **1.0.2** (published 2017-12-08) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install vue-lang-js
pnpm add vue-lang-js
yarn add vue-lang-js
bun add vue-lang-js
```

## Health

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

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2017-12-08 |
| First published | 2017-12-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >= 6.0 |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | Andre de Waard |
| Maintainers | andredewaard |
| Keywords | plugin, vue, vuejs |

## Links

- npm: https://www.npmjs.com/package/vue-lang-js
- Repository: https://github.com/eli5-amsterdam/vue-lang-js
- Homepage: https://github.com/eli5-amsterdam/vue-lang-js#readme
- Issues: https://github.com/eli5-amsterdam/vue-lang-js/issues
- npm.io page: https://npm.io/package/vue-lang-js

## Dependencies (1)

- [lang.js](https://npm.io/package/lang.js.md) ^1.1.11

## Recent versions

- 1.0.2 (latest) — 2017-12-08
- 1.0.1 — 2017-12-08
- 1.0.0 — 2017-12-08
- 0.1.1 — 2017-12-08

## README

# vue-lang-js

This plugin is based on https://github.com/rmariuzzo/Lang.js

## Installation
This Vue plugin can be installed via npm or yarn

### npm 
```
$ npm install @eli5/vue-lang-js
```

### yarn
```
$ yarn add @eli5/vue-lang-js
```

## Initialization

Start by importing the component.

```javascript
import Vue from 'vue'
import VueLang from '@eli5/vue-lang-js'

Vue.use(VueLang, {
    messages: source, // Provide locale file
    locale: 'nl', // Set locale
    fallback: 'en' // Set fallback lacale
})
```

## Usage

Get language string
```javascript
    this.$trans('auth.title')
    this.$trans('auth.title', { name: 'eli5' })
    {{ $trans('auth.title') }}
    {{ $trans('auth.title', { name: 'eli5' }) }}
    
    // Alias
    this.$t('auth.title')
    this.$t('auth.title', { name: 'eli5' })
    {{ $t('auth.title') }}
    {{ $t('auth.title', { name: 'eli5' }) }}
```

Get language string with plural
```javascript
    this.$choice('auth.title', int)
    this.$choice('auth.title', int, { name: 'eli5' })
    {{ $choice('auth.title', int) }}
    {{ $choice('auth.title', int, { name: 'eli5' }) }}

    // Alias
    this.$tc('auth.title', int)
    this.$tc('auth.title', int, { name: 'eli5' })
    {{ $tc('auth.title', int) }}
    {{ $tc('auth.title', int, { name: 'eli5' }) }}
```

Set locale
```javascript
    this.$lang.setLocale('en')
```

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