[go: up one dir, main page]

Skip to content

Text translation library with wrappers for Google Translate, My memory and more...

License

Notifications You must be signed in to change notification settings

Itz-fork/py-trans

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

    # 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