A Django application that supports adding multiple third-party engines for text translation.
Project description
django-text-translator
A Django application that supports adding multiple third-party engines for text translation.
Currently, it supports the following engines:
- DeepL
- DeepLX
- OpenAI
- ClaudeAI
- Azure OpenAI
- Google Gemini
- Google Translate(Web)
- Microsoft Translate API
- Caiyun API
Installation
- Install:
pip install django-text-translator
- Add "django_text_translator" to your INSTALLED_APPS setting like this:
INSTALLED_APPS = [ ..., "django_text_translator", ]
- Run
python manage.py makemigrations
andpython manage.py migrate
to create the models. - Start the development server and visit the admin to add a translator.
- Translate a text:
from django_text_translator.models import OpenAITranslator openai_translator = OpenAITranslator.filter(valid=True).first() results = openai_translator.translate(text="Hello, world!",target_language="Chinese") print(results.text) # 你好,世界! print(results.tokens) # 51
- More details can be found in the models.py file.
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
Built Distribution
Close
Hashes for django-text-translator-2024.3.17.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2d26059715c7f4b50c81cb7b6d284122a49e73c7eaa99bf41be1a550dcd405de |
|
MD5 | f807dd4a99b657f9db75e8163fb20ad4 |
|
BLAKE2b-256 | 2b744d53b3fed3c95adc2fce25d34afaa9da0d7733ca53d47f3d4c0717bc0a73 |
Close
Hashes for django_text_translator-2024.3.17.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 251b70ea9ea9249f651839bf1840dd239207526486b85733761c99b067faa184 |
|
MD5 | c0cce41162a427b76abfe5ae9c457453 |
|
BLAKE2b-256 | 0731b110aa055aaf8e5e6de5c0e5bbdb7fd1a24b23e319643aed01ecb2e6327b |