translation
translation is a python translation package based on website service.
It provids google, youdao, baidu, iciba translation service.
Installation
pip install translation
Usage
from translation import baidu, google, youdao, iciba
print(google('hello world!', dst = 'zh-CN'))
print(google('hello world!', dst = 'ru'))
print(baidu('hello world!', dst = 'zh'))
print(baidu('hello world!', dst = 'ru'))
print(youdao('hello world!', dst = 'zh-CN'))
print(iciba('hello world!', dst = 'zh'))
print(bing('hello world!', dst = 'zh-CHS'))
Documents
You may find document here
Advanced usage
Proxies
You may not use some of the function without proxies.
Proxies can be set as following.
from translation import google, ConnectError
# 127.0.0.1:1080 is a vaild proxies
try:
print(google('hello world!', dst = 'zh-CN', proxies = {'http': '127.0.0.1:1080'}))
except ConnectError:
print('Invaild proxy')
Default
You may change default setting such as:
default source language (auto if not set)
default destination language (zh-CN if not set)
default translation (youdao if not set)
default proxies (no proxy if not set)
from translation import (set_default_translation, set_default_language,
set_default_proxies, get, ConnectError)
set_default_translation('google')
set_default_language('auto', 'zh-CN')
set_default_proxies({'http': '127.0.0.1:1080'})
try:
print(get('hello world!'))
except ConnectError:
print('Invaild proxy')
More
More functions are introduced in the document.
Language
Language list of all the translation are provided in document.
Somehow, iciba and youdao can only provide English translation.
el : Greek,
eo : Esperanto,
en : English,
af : Afrikaans,
sw : Swahili,
ca : Catalan,
it : Italian,
iw : Hebrew,
sv : Swedish,
cs : Czech,
cy : Welsh,
ar : Arabic,
ur : Urdu,
ga : Irish,
eu : Basque,
et : Estonian,
az : Azerbaijani,
id : Indonesian,
es : Spanish,
ru : Russian,
gl : Galician,
nl : Dutch,
pt : Portuguese,
la : Latin,
tr : Turkish,
tl : Filipino,
lv : Latvian,
lt : Lithuanian,
th : Thai,
vi : Vietnamese,
gu : Gujarati,
ro : Romanian,
is : Icelandic,
pl : Polish,
ta : Tamil,
yi : Yiddish,
be : Belarusian,
fr : French,
bg : Bulgarian,
uk : Ukrainian,
hr : Croatian,
bn : Bengali,
sl : Slovenian,
ht : Haitian Creole,
da : Danish,
fa : Persian,
hi : Hindi,
fi : Finnish,
hu : Hungarian,
ja : Japanese,
ka : Georgian,
te : Telugu,
zh-TW : Chinese Traditional,
sq : Albanian,
no : Norwegian,
ko : Korean,
kn : Kannada,
mk : Macedonian,
zh-CN : Chinese Simplified,
sk : Slovak,
mt : Maltese,
de : German,
ms : Malay,
sr : Serbian
Comments
If you have any problem or suggestion, you may contact me in this issue.
Metadata
Release files for translation 1.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| translation-1.0.5.zip | 14.5 kB | Without provenance | Details for translation-1.0.5.zip |
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| translation-1.0.5-py3-none-any.whl | Python 3 | none | any | Details for translation-1.0.5-py3-none-any.whl |
| translation-1.0.5-py2-none-any.whl | Python 2 | none | any | Details for translation-1.0.5-py2-none-any.whl |
Total release size: 36.0 kB
Release files / translation-1.0.5.zip
| Download URL | translation-1.0.5.zip |
|---|---|
| Size | 14.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6228e2ae4882a3dae73a8b5b1864f2df1e22a07a186b9ad26aa8094f9b5db627
|
|
BLAKE2b-256 checksum How to use checksums |
abc11e498a4df819838794db35a50a2483079b35c9911aaa0e300214ca70e2e4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / translation-1.0.5-py3-none-any.whl
| Download URL | translation-1.0.5-py3-none-any.whl |
|---|---|
| Size | 9.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
64dfdb33c2203130eba683214f38428a97e77c74d842e2d0e7e406df77f98a81
|
|
BLAKE2b-256 checksum How to use checksums |
7cb08e2c6a46d36ccb52c2e05a3b81c9d7ad8fd3a99193bb378400899b3d812c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / translation-1.0.5-py2-none-any.whl
| Download URL | translation-1.0.5-py2-none-any.whl |
|---|---|
| Size | 12.3 kB |
| Tags | Python 2 |
|
SHA-256 checksum How to use checksums |
e44349b6e4e6a8cca82a90d2ee218472d75d08000b6f000bd40d9865b8ef1a28
|
|
BLAKE2b-256 checksum How to use checksums |
461fe3e54131591e62f6604ccc77bdd4bff95292cc03d698ba821da0c99782c4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for translation 1.0.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.