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.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | f230f9e628da54d380f8d7c9320a09ff3828b8ef2c6f8aba3b984a7fdc713947 |
|
MD5 | 84a9ff62df856dac41b9d132b0fbdba8 |
|
BLAKE2b-256 | 65d5beca2044d1b36d9a70d05aad8f203ea6e70bfd3d38166f2ae1c4cce35294 |
Close
Hashes for django_text_translator-2024.4.25.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f25e9b667f777024848f865ab79ae1b5622d7a3bfd3dbfe4834b6347dcbb880f |
|
MD5 | 3d6fb81579d76fd088456a573b5de6da |
|
BLAKE2b-256 | 7552ccc36b38d0acb3ccaad2a558736a0d236f8f6355fe7de0ae8efe570e301f |