# transpoco-translation-library-js

> Transpoco translation library for Js

Latest version **1.0.2** (published 2017-09-21) · MIT license · 0 weekly downloads

## Install

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

## 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.0.2 |
| Published | 2017-09-21 |
| First published | 2017-09-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Mauricio Silva |
| Maintainers | transpoco-dev |

## Links

- npm: https://www.npmjs.com/package/transpoco-translation-library-js
- Repository: https://github.com/Transpoco/transpoco-translation-library-js
- Homepage: https://github.com/Transpoco/transpoco-translation-library-js#readme
- Issues: https://github.com/Transpoco/transpoco-translation-library-js/issues
- npm.io page: https://npm.io/package/transpoco-translation-library-js

## Dependencies (1)

- [babel-runtime](https://npm.io/package/babel-runtime.md) ^6.26.0

## Recent versions

- 1.0.2 (latest) — 2017-09-21
- 1.0.1 — 2017-09-21
- 1.0.0 — 2017-09-21

## README

# Transpoco Translation Library js

Transpoco translation library for Node JS / Javascript 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-js';
// 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
const t = new Translation();
t.importTranslationTable(translationTable);
```

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

```js
t._('Translation'); // Traduction
t._('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-js · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
