catly_translate
Simple & Easy Way For Baidu Translation
Here're some basic usages.
>>> import catly_translate
>>> catly_translate.translate("Hello")
['你好']
>>> catly_translate.translate("こんにちは")
['你好']
>>> catly_translate.translate("Hello\nWorld")
['你好', '世界']
>>> catly_translate.translate("こんにちは\r\n世界")
['你好', '世界']
The default setting is auto language to Chinese Simplified(zh).
def translate(text: str, from_lang="auto", to_lang="zh") -> str:
...
from_lang=auto is suitable in most case, try change when translation not as expected.
You can also manualy specify keyword from_lang, to_lang or both.
>>> catly_translate.translate("Hello", "en", "jp")
['こんにちは']
>>> catly_translate.translate("你好", to_lang="en")
['Hello']
>>> catly_translate.translate("你好", to_lang="jp")
['こんにちは']
# Note: Max string length is 5000 per translation due to Baidu API limit.
Metadata
Release files for catly-translate 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| catly_translate-0.1.2.tar.gz | 5.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| catly_translate-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.9 kB
Release files / catly_translate-0.1.2.tar.gz
| Download URL | catly_translate-0.1.2.tar.gz |
|---|---|
| Size | 5.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c4e210a102d67bac8cb07b76b6475546ea87a28eabb19ddb7ee995e87d9f87f0
|
|
BLAKE2b-256 checksum How to use checksums |
83e1668556ae021ac2f598fd115443c9fbbef95405e78268f69367fc692b5ea6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.13
|
Release files / catly_translate-0.1.2-py3-none-any.whl
| Download URL | catly_translate-0.1.2-py3-none-any.whl |
|---|---|
| Size | 5.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c72ab5dd746675e19250aea1aaa0f9bb27683acf72886f7dc0f68bb5294b0489
|
|
BLAKE2b-256 checksum How to use checksums |
da88bdbd871e550f5c5a2297853e7fe3543f1570066f56273880e567ee3962a4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.13
|