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
- Moonshot AI
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.4.2.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 74265662aee79fd46ce49949500d3d086dde361102dab322724e99012f8ec384 |
|
MD5 | 43c8f2e1dca22cfcc16562303f80a71f |
|
BLAKE2b-256 | 09d4f5f75a88c00cc0babc3968f8a51b86ff904b800c32ded9f8cc2e1d74b2bc |
Close
Hashes for django_text_translator-2024.4.2.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 47f739d85d90efbee4cc34200ccc778f8eb9248570340a784afb218231432e36 |
|
MD5 | 38406052b923216d94b425ade98d99fe |
|
BLAKE2b-256 | 778befff09fa78e8175e9f406f728ea1758829caec0c3fdc1687871cd00635b5 |