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.25.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 09e6bf32aa3ec35403cad38f6e3f2bbc282de234ab3da049e04a4b5efac01181 |
|
MD5 | b9ce612b413bb242a67086b296df7a4d |
|
BLAKE2b-256 | f3bb73704f723650b4254c327b8ed5cb9636ab42cd38715342bebf514866a3de |
Close
Hashes for django_text_translator-2024.3.25-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 718eb4365788290fa9fedc0ffd7777e6c039fb6275a2b85f3fefd69bb27bb5fd |
|
MD5 | 293642c5a1b6530bda3be01cc757c421 |
|
BLAKE2b-256 | 062c7e9f5ac4a73f653b0a898dbcc5d2597294e5933fb29f2c5ece786f8eb966 |