# gtrans

> google translate api library

Latest version **1.1.0** (published 2016-08-14) · ISC license · 0 weekly downloads

## Install

```sh
npm install gtrans
pnpm add gtrans
yarn add gtrans
bun add gtrans
```

## 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.1.0 |
| Published | 2016-08-14 |
| First published | 2016-08-12 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | mdszy |
| Maintainers | mdszy_ |
| Keywords | google, translate, api, google translate, promise |

## Links

- npm: https://www.npmjs.com/package/gtrans
- Repository: https://github.com/mdszy/gtrans
- Homepage: https://mdszy.github.io/gtrans
- Issues: https://github.com/mdszy/gtrans/issues
- npm.io page: https://npm.io/package/gtrans

## Alternatives

- [promise-throttle](https://npm.io/package/promise-throttle.md) — 44.2K weekly downloads
- [@commercetools/sync-actions](https://npm.io/package/@commercetools/sync-actions.md) — 25.1K weekly downloads
- [cwait](https://npm.io/package/cwait.md) — 21.4K weekly downloads
- [@ledgerhq/hw-app-cosmos](https://npm.io/package/@ledgerhq/hw-app-cosmos.md) — 4.2K weekly downloads
- [@financial-times/o-loading](https://npm.io/package/@financial-times/o-loading.md) — 2.8K weekly downloads

## Recent versions

- 1.1.0 (latest) — 2016-08-14
- 1.0.3 — 2016-08-14
- 1.0.2 — 2016-08-14
- 1.0.1 — 2016-08-13
- 1.0.0 — 2016-08-13
- 0.1.1 — 2016-08-13
- 0.1.0 — 2016-08-12
- 0.0.2 — 2016-08-12
- 0.0.1 — 2016-08-12

## README

[![Flattr this git repo](http://api.flattr.com/button/flattr-badge-large.png)](https://flattr.com/submit/auto?user_id=mdszy&url=http://github.com/mdszy/gtrans&title=gtrans&language=&tags=github&category=software) 
[![Build Status](https://travis-ci.org/mdszy/gtrans.svg?branch=master)](https://travis-ci.org/mdszy/gtrans)

# gtrans

## Installation

`npm install gtrans`

Duh.

## Translation Example

```js
var gtrans = require('gtrans');

var t = new gtrans("apikey");

var opts = {
  text: "Hello, world!",
  source: "en", // This is optional. Language can be auto-detected.
  target: "de"
};

t.translate(opts).then(console.log);
```

Console output:

```js
[ { translatedText: 'Hallo Welt!' } ]
```

## Language Detection Example

```js
var gtrans = require('gtrans');

var t = new gtrans("apikey");

t.detect("Hello, world!").then(console.log);
```

Console output:

```js
[ [ { language: 'en', isReliable: false, confidence: 0.7100697 } ] ]
 ```

gtrans can also detect multiple strings, like this.

```js
t.detect("one", "two")
```

## Running tests

1. `npm install`
2.  Rename `test/key.template.json` to `test/key.json` and add your Google Translate
    API key
3. `npm test`

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