goslate
provides you free python API to google translation service by querying google translation website.
It is:
- Free: get translation through public google web site without fee
- Fast: batch, cache and concurrently fetch
- Simple: single file module, just
Goslate().translate('Hi!', 'zh')
>>> import goslate
>>> gs = goslate.Goslate()
>>> print gs.translate('hello world', 'de')
hallo welt
For romanlized writing (romanlization), batch translation, language detection, proxy support etc., please check API reference
goslate support both Python2 and Python3. You could install it via:
$ pip install goslate
or just download latest goslate.py directly and use
futures
pacakge is optional but recommended to install for best performance in large text translation task.
goslate.py
is also a command line tool
Translate
stdin
input into Chinese in GBK encoding$ echo "hello world" | goslate.py -t zh-CN -o gbk
Translate 2 text files into Chinese, output to UTF-8 file
$ goslate.py -t zh-CN -o utf-8 source/1.txt "source 2.txt" > output.txt
use --help
for detail usage
$ goslate.py -h
- Report issues & suggestions
- Fork repository
- Donation
- [fix bug] update to adapt latest google translation service changes
- [fix bug] fix compatible issue with latest google translation service json format changes
- [fix bug] unit test failure
- [new feature] Translation in roman writing system (romanlization), thanks for Javier del Alamo's contribution.
- [new feature] Customizable service URL. you could provide multiple google translation service URLs for better concurrency performance
- [new option] roman writing translation option for CLI
- [fix bug] Google translation may change normal space to no-break space
- [fix bug] Google web API changed for getting supported language list