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.19.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7bc11664c333909f0c95f8ce1fd58e87fd9d6c2c7c4d6b5b562ec54a22f03340 |
|
MD5 | 1494a6eeb62597efd24592f26d4c3754 |
|
BLAKE2b-256 | 9a425ab13ab987acc950a3ba3610b0900a978d161d2d69606872e0271cfb8cf9 |
Close
Hashes for django_text_translator-2024.3.19-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d0a88fa5d4263e3ba1c91e9a6f4f685e6f53333988d5658e88f809619231bf06 |
|
MD5 | 5891060b62fcc08cd4e0c5e092512125 |
|
BLAKE2b-256 | 77898305e7aa9a1cf5cebaf2a9d7b827390c4e742190eacc9fac0d56301e904f |