# transpoco-translation-library-ts

> Transpoco translation library for Typescript to handle translations returned from Transpoco Translation API.

Latest version **1.0.0** (published 2018-05-30) · ISC license · 0 weekly downloads

## Install

```sh
npm install transpoco-translation-library-ts
pnpm add transpoco-translation-library-ts
yarn add transpoco-translation-library-ts
bun add transpoco-translation-library-ts
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2018-05-30 |
| First published | 2018-05-30 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | transpoco-dev |

## Links

- npm: https://www.npmjs.com/package/transpoco-translation-library-ts
- npm.io page: https://npm.io/package/transpoco-translation-library-ts

## Recent versions

- 1.0.0 (latest) — 2018-05-30

## README

# Transpoco Translation Library js

Transpoco translation library for Typescript to handle translations returned from Transpoco Translation API.

## Usage

First it's necessary to load the translation table, for example:

```js
import Translation from '@transpoco/transpoco-translation-library-ts';
// Example of a translation table returned from API
const translationTable = [
    {
        id: 14,
        code: 'Original',
        string: 'Original',
    }, {
        id: 15,
        code: 'Translation',
        string: 'Traduction',
    }, {
        id: 16,
        code: 'More information...',
        string: 'Plus d\'informations',
    },
    {
        id: 17,
        code: 'Good morning {name}',
        string: 'Bonjour {name}',
    },
    {
        id: 17,
        code: 'Hello {name} and {name2}',
        string: 'Bonjour {name} et {name2}',
    },
];

// Set Translation to french
Translation.load(translationTable);
```

The library comes with the _ funtion to translate words and supports interpolation:

```js
Translation._('Translation'); // Traduction
Translation._('Good morning {name}', {name: 'John'}); // Bonjour John
```

## Development

All tests are handle by [Mocha] and [Chai], the entry file it's Translation.js, the project uses [Babel] to transpile ES6 to ES5.

## Publish to NPM

```sh

npm version patch -m 'Update reason'
npm publish

```

[Mocha]: https://mochajs.org/
[Chai]: http://chaijs.com/
[Babel]: babeljs.io

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