# google-open-translate

> A **free** and **unlimited** API for Google Translate :dollar::no_entry_sign:

Latest version **1.0.1** (published 2020-10-23) · ISC license · 0 weekly downloads

## Install

```sh
npm install google-open-translate
pnpm add google-open-translate
yarn add google-open-translate
bun add google-open-translate
```

## 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.1 |
| Published | 2020-10-23 |
| First published | 2020-10-23 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 7.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | qinghua.song |
| Maintainers | qinghua.song |
| Keywords | google, translate |

## Links

- npm: https://www.npmjs.com/package/google-open-translate
- Repository: https://github.com/xiaohuaxiangwoyiyang/google-open-translate
- Homepage: https://github.com/xiaohuaxiangwoyiyang/google-open-translate#readme
- Issues: https://github.com/xiaohuaxiangwoyiyang/google-open-translate/issues
- npm.io page: https://npm.io/package/google-open-translate

## Dependencies (2)

- [got](https://npm.io/package/got.md) ^11.8.0
- [querystring](https://npm.io/package/querystring.md) ^0.2.0

## Alternatives

- [ext-list](https://npm.io/package/ext-list.md) — 6.3M weekly downloads
- [@lexical/selection](https://npm.io/package/@lexical/selection.md) — 3.8M weekly downloads
- [@lexical/text](https://npm.io/package/@lexical/text.md) — 3.6M weekly downloads
- [@lexical/clipboard](https://npm.io/package/@lexical/clipboard.md) — 3.0M weekly downloads
- [@tiptap/extension-mention](https://npm.io/package/@tiptap/extension-mention.md) — 3.0M weekly downloads

## Recent versions

- 1.0.1 (latest) — 2020-10-23
- 1.0.0 — 2020-10-23

## README

# google-open-translate

A **free** and **unlimited** API for Google Translate :dollar::no_entry_sign:

## Features 

- Auto language detection
- Spelling correction
- Language correction 
- Fast and reliable – it uses the same servers that [translate.google.com](https://translate.google.com) uses

## Install 

```
npm install --save google-open-translate
```

## Usage

From automatic language detection to English:

``` js
const translate = require('google-open-translate');

translate('请问如何调用谷歌翻译API', {to: 'en'}).then(res => {
    console.log('res', res.text);
    //=> How to call Google Translate API
    // console.log(res.orig);
    //=> 请问如何调用谷歌翻译API
}).catch(err => {
    console.error(err);
});
```



## API

### translate(text, options)

#### text

Type: `string`

The text to be translated

#### options

Type: `object`

##### from

Type: `string` Default: `auto`

The `text` language. Must be `auto` or one of the codes/names (not case sensitive) contained in [languages.js](https://github.com/matheuss/google-open-translate/languages.js)

##### to

Type: `string` Default: `en`

The language in which the text should be translated. Must be one of the codes/names (not case sensitive) contained in [languages.js](https://github.com/matheuss/google-open-translate/master/languages.js).


### Returns an `object`:

- `text` *(string)* – The translated text.
- `orig` *(string)* - The origial text.
- `src` *(array)* - What language needs to be translated into another language.

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