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.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4b714223cbab66f6c5e69f9f15639fefb2439453631ee6215aeae2b95371e265 |
|
MD5 | dd213eeee96942377fa8503d2b5771e8 |
|
BLAKE2b-256 | 6d6d2c4982484a299428ff9c03d43880eb185570e0deab3a03264c43cef8abb1 |
Close
Hashes for django_text_translator-2024.2.29.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 51141033df47d8f03d88c7598843a549e2c101052c4fac7a24f3c3f55112db3a |
|
MD5 | 084f148e8ec3a11fdf4e62225127f01d |
|
BLAKE2b-256 | a3de12683d3263ae49eb310d84e4a07a31aadcc8efde11707e29a6d2b2c8295a |