# brisk-translate

> A internationalization (i18n) library for Angular.

Latest version **1.0.10** (published 2021-01-08) · 0 weekly downloads

## Install

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

## Health

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

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.10 |
| Published | 2021-01-08 |
| First published | 2020-09-03 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 194.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | asemor |

## Links

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

## Dependencies (1)

- [tslib](https://npm.io/package/tslib.md) ^2.0.0

## Recent versions

- 1.0.10 (latest) — 2021-01-08
- 1.0.9 — 2021-01-08
- 1.0.8 — 2020-12-11
- 1.0.7 — 2020-12-11
- 1.0.6 — 2020-11-10
- 1.0.4 — 2020-10-29
- 1.0.3 — 2020-10-29
- 1.0.2 — 2020-10-29
- 1.0.1 — 2020-09-03

## README

# BriskTranslate

A internationalization (i18n) library for Angular.

## Get Started

`npm install brisk-translate --save`

## Import

`import { BrTranslateModule } from 'brisk-translate';` 

## Examples
### Prepare translation files(JSON format)
assets/i18n/basic_en.json
``` json
{
  "hello": "Hello"
}
```
assets/i18n/basic_zh.json
``` json
{
  "hello": "你好"
}
```

assets/i18n/other_en.json
``` json
{
  "hello": "other-Hello"
}
```
assets/i18n/other_zh.json
``` json
{
  "hello": "other-你好"
}
```
### Code
``` typescript
import { Component, OnInit } from '@angular/core';
import { TranslateService } from 'brisk-translate';

@Component({
  selector: 'lab-basic-translate',
  template: `<button (click)="use('EN')">EN</button>
            <button (click)="use('ZH')">ZH</button>
            <p>{{text | brTranslate: 'basic'}}</p>
            <p>{{'hello' | brTranslate: 'basic'}}</p>
            <p>-------OTHER------</p>
            <p>{{'hello' | brTranslate: 'other'}}</p>
            <p>-------JSON------</p>
            <p>{{json | brTranslate: 'basic'}}</p>
            <p>-------Directive------</p>
            <p brTranslate="basic">hello</p>`
})
export class BasicTranslateComponent implements OnInit {
  text: string;
  json: string;
  constructor(private translate: TranslateService) { }

  ngOnInit(): void {
    this.text = 'hello';
    this.json = '{"en":"Hello","zh":"你好"}';
    this.translate.addTranslation('basic','assets/i18n/basic');
    this.translate.addTranslation('other','assets/i18n/other');
  }

  use(lang: string) {
    this.translate.use(lang);
  }
}
```

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