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.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | c5df731f8fd636eebeaf625b06f71d00ac9c146c0942e224942f162ee5928d7e |
|
MD5 | 2ebadd205354f655f9840010c5bcd7b9 |
|
BLAKE2b-256 | 7e4bd1a531a5b6ddc8897c74fb863fc92db1c6183e33b754865e0bc0e1d5ec20 |
Close
Hashes for django_text_translator-2024.4.25-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 20f8377d8228816a6d4a59454afd1d926e7c0caa45c2be74bb317182c80f0b58 |
|
MD5 | 037320d95615b383f478c1a281413845 |
|
BLAKE2b-256 | f7e0e3bb7c19dc3851f1819ef0e54aaf47d6d495cd4e31ed20ba02b8686a3509 |