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.25.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 66264654c6ed543edfc9ee3aa0b398b0c85249313ff1557678bb4fe672ba8e6c |
|
MD5 | a8e87a88e4595cd30adea47d3f585218 |
|
BLAKE2b-256 | 5b564297afed33346a8635466517b5c01d8ffe672a7e0f0f41de4f34f4f4ae21 |
Close
Hashes for django_text_translator-2024.4.25.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ae6cf2470bfb0aa72c52f3b5aa9bc9ce4cb77f1db1db35fc70884d3bc00ab1cb |
|
MD5 | ddcba308a903d5bc7df3d344d7a8a9af |
|
BLAKE2b-256 | b847f78acabb0428916f61f2b00d9ce73aae58b97cfea5c605e114c908fa0892 |