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.20.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6fc5a65162e529c8fb78c416a52deeb409ff5dd94184f1df3e8d4c7a58be1c66 |
|
MD5 | 2798c5a3a70ee61110a147945b44c8ec |
|
BLAKE2b-256 | cffa58da50828359d82b7c69dc06372f16c1b9495c9a87e3cef022b0116d2210 |
Close
Hashes for django_text_translator-2024.3.20-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 853bdbfb7e0f7c9cadcb5f4e4980059a1738d380a1ac051c84a67622444a1d22 |
|
MD5 | ef5c465f9e66c96fa8e18fd9503485fd |
|
BLAKE2b-256 | 0eb4af78fa596b46fd3155607f371da4504684b47db184b5abebe478bde33e40 |