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.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 95a44c97f99e1b09d253ea2f1de5366d4124f616ff9369eb86bd9c31eb5f1aa8 |
|
MD5 | 1d0dde1617eaefbb3bf72a428be53793 |
|
BLAKE2b-256 | c9bc1ffaeb370d904b52db65276a5fc5f45d92f0e55e25c2ea24cea69abed029 |
Close
Hashes for django_text_translator-2024.4.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 05235d74306886c4349ba9f39b24bf186bec6f1d3764a4ffba83f29f5b8e5c97 |
|
MD5 | 415e20e7c3b5f9f84e2dda200c0eda07 |
|
BLAKE2b-256 | 9695ec738b20338408311d13908baf817cb4a9178d279da69f4ebe9601fb9902 |