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
File details
Details for the file django_text_translator-2024.3.22.1.tar.gz
.
File metadata
- Download URL: django_text_translator-2024.3.22.1.tar.gz
- Upload date:
- Size: 13.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8c63b141711bf36c261ecb83e24f76ffbd41221d017f616e00137ef0cfb87d0b |
|
MD5 | ee4fb616c16a83c739722ed39c44d7c3 |
|
BLAKE2b-256 | a12eecf4ec2981f4a71364c2d586fadad09badb53b613baa28466badcdf2c0a0 |
File details
Details for the file django_text_translator-2024.3.22.1-py3-none-any.whl
.
File metadata
- Download URL: django_text_translator-2024.3.22.1-py3-none-any.whl
- Upload date:
- Size: 40.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 848139cef8c80ae3023356387f85efb8423d3e5a79ee22dd7fd0d68a0ce4e0da |
|
MD5 | 3f32b84680e8824dfd072b468dd7ed03 |
|
BLAKE2b-256 | 7a17a7bcb1734f0e2f91c71bcc2fd3a3c33d766fa7c9cb5005e0b703dbe014f9 |