https://github.com/john-theo/google-translate-server
[DEPRECATED] Free Google Translate API. Very lightweight and easy to use.
https://github.com/john-theo/google-translate-server
api deprecated docker express google-translate google-translate-api javascript nodejs server
Last synced: about 2 months ago
JSON representation
[DEPRECATED] Free Google Translate API. Very lightweight and easy to use.
- Host: GitHub
- URL: https://github.com/john-theo/google-translate-server
- Owner: john-theo
- Created: 2020-04-15T16:30:08.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2022-12-12T12:00:19.000Z (over 2 years ago)
- Last Synced: 2025-02-27T18:01:02.097Z (3 months ago)
- Topics: api, deprecated, docker, express, google-translate, google-translate-api, javascript, nodejs, server
- Language: JavaScript
- Homepage:
- Size: 38.1 KB
- Stars: 151
- Watchers: 2
- Forks: 25
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Google Translate Server
   [](https://hub.docker.com/r/johndope/google-translate-server) [](https://hub.docker.com/r/johndope/google-translate-server) 
## !!!DEPRECATED!!!
After a lot of "googling", I'm sorry to confirm that similar approaches are **NO LONGER WORKING** now. And you **HAVE TO** own a Google Developer account for the simple task.
**BUT!** DO try out the [DeepL API](https://www.deepl.com/en/docs-api/)! As far as my uses cases are concerned, it works a lot better than Google Translate! Everyone end up here comes for the same reason, and I hope DeepL can be a better successor for you!
---
A express.js server wrapper for [google-translate-cn-api
](https://www.npmjs.com/package/google-translate-cn-api)Use Google Translate API **WITHOUT a Google account**!
## Features
- **Updated**, use Google Translate Web API;
- **Open Source**, **FREE** forever;
- **Cross Language**, simple REST API, basic url request in any language;
- **Fast**, choose your local Google Translate domian (eg. https://translate.google.cn/);
- **Auto Correction**;
- **ZERO Config**, `docker` ready, start service in 1 minute.## Example
### Request
```shell
curl http://localhost:30031/?text=I spea Dutch!&to=zh-cn
```### Response
```json
{
"text": "我说荷兰语!",
"from": {
"language": {
"didYouMean": false,
"iso": "en"
},
"text": {
"autoCorrected": false,
"value": "I speak Dutch!",
"didYouMean": true
}
},
"raw": ""
}
```## Use docker `Recommended`
```shell
docker run -it --rm -p 30031:30031 -e "DOMAIN=cn" johndope/google-translate-server
```## Run directly
### Install
```shell
npm i
```### Usage
```shell
# start with default port 30031
npm start# specify port
yarn start -- -p 30032# specify domain
# eg: translate.google.cn
# default: translate.google.com
yarn start -- -d cn
```## Use docker-compose
```shell
# start with default port 30031
docker-compose up# specify port
PORT=30032 docker-compose up# specify domain
DOMAIN=cn docker-compose up
```## Client Example
### curl
```shell
curl http://localhost:30031/?text=hello&to=zh-cn
```### python
```python
import requests
from urllib.parse import urlencodeprint(requests.get('http://localhost:30031/?'+urlencode({
'text': 'I spea Dutch!', # this input will trigger auto-suggestion
'from': 'en', # leave blank to auto detect
'to': 'zh-cn',
# 'raw': 'true', # response contains unparsed response
# 'domain': 'cn' # change google translate domain, overrides default domain
})).json())
```More details about query parameters: [google-translate-api](https://www.npmjs.com/package/google-translate-api) and [google-translate-cn-api](https://www.npmjs.com/package/google-translate-cn-api).
It's worth mention that, with `google-translate-cn-api`, you can now specify something like `domain: 'cn'` in the parameter to use your local `Google Translate` domain. Mode details can be found [here](https://github.com/lqqyt2423/google-translate-cn-api/blob/HEAD/example.js#L29-L31).
## Credit
- [google-translate-api](https://github.com/matheuss/google-translate-api)
- [google-translate-cn-api](https://github.com/lqqyt2423/google-translate-cn-api)## Repository
**Github:** [John-Theo/google-translate-server](https://github.com/John-Theo/google-translate-server)
**Docker Hub:** [johndope/google-translate-server](https://hub.docker.com/r/johndope/google-translate-server/)
## License
This application comes with **ABSOLUTELY NO WARRANTY**, to the extent permitted by applicable law.