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.2.29.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | f49e91d5fabda0f2e0a08fc912742f3d712639178deecf3e86219b1c86059bfb |
|
MD5 | 0dd837cce1225e50a3483a0db837e5d7 |
|
BLAKE2b-256 | aed6edc16e2c860eeeb4f3c65e74f4af5aeb65a9f41f1277a4da4009c085acf3 |
Close
Hashes for django_text_translator-2024.2.29.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bf6b23fff1b7bce7b5cf7b010435595473fc198f853a9903e56c52799daf9b3e |
|
MD5 | 602c9dd9100cf699e4ed56417036a442 |
|
BLAKE2b-256 | ae998de5236d96a9e7ebcaae7e5881865d66f7ee3f405c9b0d7dbaeb3bf4f654 |