Skip to main content

Simple & Easy Way For Baidu Translation

Project description

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.

Project details


Download files

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

Source Distribution

catly_translate-0.1.2.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

catly_translate-0.1.2-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file catly_translate-0.1.2.tar.gz.

File metadata

  • Download URL: catly_translate-0.1.2.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for catly_translate-0.1.2.tar.gz
Algorithm Hash digest
SHA256 c4e210a102d67bac8cb07b76b6475546ea87a28eabb19ddb7ee995e87d9f87f0
MD5 3023ddc000f98bedd35777113fe9573a
BLAKE2b-256 83e1668556ae021ac2f598fd115443c9fbbef95405e78268f69367fc692b5ea6

See more details on using hashes here.

File details

Details for the file catly_translate-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for catly_translate-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c72ab5dd746675e19250aea1aaa0f9bb27683acf72886f7dc0f68bb5294b0489
MD5 3fe70c9aa2813793f702b08426f0c3b5
BLAKE2b-256 da88bdbd871e550f5c5a2297853e7fe3543f1570066f56273880e567ee3962a4

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page