Skip to main content

Free python library to translate text to different languages.

Project description

py-trans

from py_trans import PyTranslator

tr = PyTranslator()
print(tr.google("Hi", "es"))

A Fast, hassle-free way to translate text 📖

Features Install Usage

Features

  • Simple and free
  • Multiple translators to choose
  • Both synchronous & asynchronous versions

Supported translators

Engine Function
Google Translate google
translate.com translate_com
MyMemory my_memory
Translate Dict translate_dict

Installation

pip3 install py-trans
Install from source
pip install git+https://github.com/Itz-fork/py-trans.git

Usage

# Sync version
from py_trans import PyTranslator

# Async version
from py_trans import Async_PyTranslator
  • Detect language of the provided text
    • detect
    • tr.detect("Hello!")
      
  • Translate text using Google translate
    • google
    • tr.google("Hello!", "es")
      
  • Translate text using Translate.com
    • translate_com
    • tr.translate_com("Hello!", "es")
      
  • Translate text using My Memory
    • my_memory
    • tr.my_memory("Hello!", "es")
      
  • Translate text using Translate dict
    • translate_dict
    • tr.translate_dict("Hello!", "es")
      
  • Get language code/name

      ```py
      # Sync version
      tr.get_lang_code("arabic")
      tr.get_lang_name("ar")
    
      # Async version
      tr.get_lang_code_async("arabic")
      tr.get_lang_name_async("ar")
      ```
    

[!NOTE] All the above examples also applies to async version (Async_PyTranslator)

License

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

py-trans-0.6.1.tar.gz (8.3 kB view hashes)

Uploaded Source

Built Distribution

py_trans-0.6.1-py3-none-any.whl (8.9 kB view hashes)

Uploaded Python 3

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