Skip to main content

Free Google translate module that uses async/await syntax.

Project description

aiotranslate

Free google translate module that uses async/await syntax.

Example

from aiotranslate import Translator
import asyncio

async def main():
    translator = Translator() 

    # you can add aiohttp session if you want like -> Translator(session=aiohttp.ClientSession())
    # also you can save the translates like -> Translator(save_translates=True)
    
    translated = await translator.translate("hello", "tr", "en")

    # first argument: the text will be translated
    # second argument: the language will converted
    # last argument: the language that text

    print(translated) # -> Merhaba
    print(translator.history()) # shows all translates that saved.

if __name__ == "__main__":
    loop = asyncio.get_event_loop()
    loop.run_until_complete(main())

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

aiotranslate-0.0.1.tar.gz (2.2 kB view hashes)

Uploaded Source

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