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.3.21.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | da3aed494877fa73b056e989d1a825387ea9637d0a814756955f00d543bef5e9 |
|
MD5 | 40192326c7c98fa93519d97df9bb57f0 |
|
BLAKE2b-256 | a637628d8ca076b4e06df6c345dbc51151e37f87ce4179015c68133ddd2603fb |
Close
Hashes for django_text_translator-2024.3.21-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | abcc22f3bd467b8957ed22ba949475946f82b5c6a5fd5af9e65c2a89d58ca9e3 |
|
MD5 | 822e46f30a361817a86b0cac8f0372c5 |
|
BLAKE2b-256 | dc27bdfe61bdf7fdc72b3b1de284fb11f141c81641ababf797004c398a65cfc9 |