Skip to main content

Python Client Library for Translo API.

Project description

PyTranslo

Python Client Library for Translo API. https://rapidapi.com/armangokka/api/translo

Installing

pip install -U PyTranslo

Usage

from PyTranslo import PyTranslo

api = PyTranslo("<TOKEN>")

api.translate("Отличная библиотека", "en")  # "Excellent library"

api.translate("Knows many languages", "ru")  # "Знает много языков"

api.translate("没有必要指出翻译来自哪种语言。", "en")  # "There is no need to indicate which language the translation comes from."
api.translate("Но можно если нужно", "en", from_lang="ru")  # "But you can if you need"

api.detect("Что это за язык?") # "ru"

What is batch translate?

If you need to translate several messages at a time, you will definitely like this

batch_translate example

from PyTranslo import PyTranslo

api = PyTranslo("<TOKEN>")

batch = [
    {
        "from": "en",
        "to": "ru",
        "text": "банан"
    },
    {
        "from": "ru",
        "to": "en",
        "text": "Картошка была очень вкусная"
    },
    {
        "from": "auto",
        "to": "bn",
        "text": "bonjour"
    }
]

api.batch_translate(batch)

# returns
# [{'from': 'en', 'to': 'ru', 'text': 'банан'}
#  {'from': 'ru', 'to': 'en', 'text': 'The potatoes were very tasty.'},)
#  {'from': 'fr', 'to': 'bn', 'text': 'হ্যালো'}])

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

PyTranslo-1.1.tar.gz (15.3 kB view details)

Uploaded Source

Built Distribution

PyTranslo-1.1-py3-none-any.whl (15.3 kB view details)

Uploaded Python 3

File details

Details for the file PyTranslo-1.1.tar.gz.

File metadata

  • Download URL: PyTranslo-1.1.tar.gz
  • Upload date:
  • Size: 15.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.15

File hashes

Hashes for PyTranslo-1.1.tar.gz
Algorithm Hash digest
SHA256 44c6b9774ea3352af846558d8fee8bd9c36f27ba66476dceca7900bc8424920c
MD5 028638955f680fc7802db9ca29576a21
BLAKE2b-256 fe2b3625d013cc14f65eb08319e9a729846297c3358f7859def99c0d42d94bbd

See more details on using hashes here.

File details

Details for the file PyTranslo-1.1-py3-none-any.whl.

File metadata

  • Download URL: PyTranslo-1.1-py3-none-any.whl
  • Upload date:
  • Size: 15.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.15

File hashes

Hashes for PyTranslo-1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 029470fbf0e2f132f27a655b41bea2d921d626c156aa92a593fd0a511309ca76
MD5 696e8acb95d7c29d6303e4ce2c2a5125
BLAKE2b-256 2594fc9c09aecb89b6175ebd2296d149fbbb64f68b80b166b1f001b7bd2b199f

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