Skip to main content

Use the same api to call the third party translator apis, such as google, tencent, baidu.

Project description


Use the same api to call the third party translator apis, such as google, tencent, baidu.


Python 3.7 or more latest version


pip install cloud-translator


The library support GoogleTranslator, TencentTranslator, BaiduTranslator, where GoogleTranslator depends on py-googletrans which not needs appid and appkey, but is not stable and probably blocked by google.

TencentTranslator and BaiduTranslator are rewritted with reference to the offical demo script to support python 3.7 version

from translator import *

# use google
translator = GoogleTranslator()
print(translator.translate('我是中国人', dest='en'))

# use baidu api
translator = BaiduTranslator(appid, appkey)
print(translator.translate('我是中国人', dest='en'))

# use tencent api
translator = TencentTranslator(appid, appkey)
print(translator.translate('我是中国人', dest='en'))

# throttle api call frequency.
translate_func = throttle(seconds=1)(translator.translate) # call api every second
for i in range(100):
  translate_func('我是中国人', dest='en')

Project details

Release history Release notifications | RSS feed

This version


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for cloud-translator, version 1.0
Filename, size File type Python version Upload date Hashes
Filename, size cloud_translator-1.0-py3-none-any.whl (4.3 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size cloud-translator-1.0.tar.gz (3.4 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page