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.16.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 524fce904c5dea12ed9e8434bd3bafc609bcd9f0276fd2829290b9a8072801af |
|
MD5 | bdeaaf8c2b5d1c1582e0cd3a123de0df |
|
BLAKE2b-256 | 67d1c2c88acc5da74b7210d79c3ae36901ba43bdfeb9f191e38738d066f7021f |
Close
Hashes for django_text_translator-2024.4.16-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 58961aa8b41340f00a400918fa70be3398511d860b81230d559d048f3d114edd |
|
MD5 | 50b814a68322d5c1113bb40f54ed63ec |
|
BLAKE2b-256 | a6b2c83792d7ad2f6785a07f3f13813f9a50d1661a66ab21cb42112f4d75af5a |