No project description provided
Project description
tra-yan
awesome free asynchronous translator for python
Installation
pip install -U tra-yan
Usage
async def use():
from trayan import (
TraYan, AsyncTraYan,
detect, translate,
async_detect, async_translate,
get_supported_langs
)
from trayan.models.translator import Language
ru = 'красивый мужчина в отличных трусах'
en = 'a handsome man in great underpants'
proxy = None # 'scheme://login:password@ip:port'
with TraYan() as t:
print(f'{ru} — {t.detect(ru, Language.RU)}')
print(f'ru-en — {t.translate(ru, Language.RU, Language.EN)}')
print(f'{en} — {detect(en)}')
print(f'en-ru — {translate(en)}')
async with AsyncTraYan(proxy=proxy) as t:
print(f'{en} — {await t.detect(en, (Language.RU,))}')
print(f'en-ru — {await t.translate(en, Language.EN, Language.RU)}')
print(f'{ru} — {await async_detect(ru, proxy=proxy)}')
print(f'ru-en — {await async_translate(ru, proxy=proxy)}')
print(f'поддерживаемые языки: {TraYan.supported_langs}')
print(f'supported langs: {get_supported_langs()}')
if __name__ == '__main__':
import asyncio
asyncio.run(use())
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
tra-yan-0.1.0.tar.gz
(7.6 kB
view details)
Built Distribution
tra_yan-0.1.0-py3-none-any.whl
(12.0 kB
view details)
File details
Details for the file tra-yan-0.1.0.tar.gz
.
File metadata
- Download URL: tra-yan-0.1.0.tar.gz
- Upload date:
- Size: 7.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ad67e89dcf8dd94328e9416a61a4b28c5ee6970e002f6d215b3245227b7cffb0 |
|
MD5 | 146f43c9cc85e741ff39ae4b2f1c5e20 |
|
BLAKE2b-256 | dffa79e769cf72f2b12212493f36e702b4556db7a04ba73eb2cb1854ed4cfab5 |
File details
Details for the file tra_yan-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: tra_yan-0.1.0-py3-none-any.whl
- Upload date:
- Size: 12.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f2177c8713ff999188a20c4feab67d29114fb231ba8a4d705860d2743c78e20f |
|
MD5 | b035e835306c0fcd76db52e3dfd25d78 |
|
BLAKE2b-256 | b8811b59e98dab6ebb9b239c1f9f41ec82a35995a4edf65b00c549419cd2bb19 |