Skip to main content

Translation Service API Module.

Project description

translang

Translation Service Module

Install

pip install translang

Usage

Google Translator

translator = TranslationService(translator="google")

text = "Hello, how are you?"
destination_lang = "es"  # Spanish

translated_text = asyncio.run(translator.translate(text, destination_lang))
print(f"Translated Text (Google Translate): {translated_text}")

DeepL

translator = TranslationService(translator="deepl", deepl_api="YOUR_DEEPL_API_KEY")

text = "Hello, how are you?"
destination_lang = "es"  # Spanish

translated_text = asyncio.run(translator.translate(text, destination_lang))
print(f"Translated Text (DeepL Translate): {translated_text}")

Bard

translator = TranslationService(translator="bard", bard_api="YOUR_BARD_API_KEY")

text = "Hello, how are you?"
destination_lang = "es"  # Spanish

translated_text = asyncio.run(translator.translate(text, destination_lang))
print(f"Translated Text (Bard Translate): {translated_text}")

OpenAI

translator = TranslationService(translator="openai", openai_api="YOUR_OPENAI_API_KEY")

text = "Hello, how are you?"
destination_lang = "es"  # Spanish

translated_text = asyncio.run(translator.translate(text, destination_lang))
print(f"Translated Text (OpenAI Translate): {translated_text}")

License

MIT
I hold no legal responsibility;

The MIT License (MIT)

Copyright (c) 2023 Minwoo Park

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Bugs and Issues

Sincerely grateful for any reports on new features or bugs. Your valuable feedback on the code is highly appreciated.

Contacts

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

translang-0.1.0.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

translang-0.1.0-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

Details for the file translang-0.1.0.tar.gz.

File metadata

  • Download URL: translang-0.1.0.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.12

File hashes

Hashes for translang-0.1.0.tar.gz
Algorithm Hash digest
SHA256 36f00f03faa64856e181cca579d14ba063c296d06ac979a3008e6bc65eb71884
MD5 2e604e688485b8851f1242231288dd77
BLAKE2b-256 6eae794fd987a62727b36c5017f5ecf9fd09c920cb3087d53ae14684327e60e8

See more details on using hashes here.

File details

Details for the file translang-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: translang-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.12

File hashes

Hashes for translang-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 84bf2efdd13fdd2af5fe90557990dd3f87dde586bc2789d3755eb49ffb37fdd2
MD5 79019830663e80791c45322f50b86bf1
BLAKE2b-256 bac66d2ff0caf130b541a8d225f9e70fc7535ef7165a715baf591d6f3a6e7e3f

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