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 makemigrationsandpython manage.py migrateto 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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_text_translator-2024.5.1.tar.gz.
File metadata
- Download URL: django_text_translator-2024.5.1.tar.gz
- Upload date:
- Size: 15.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.9.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
64aa3021cc6a71c2ade57de25a6931641aed2c3f5d391cf5b56e3201f27556e3
|
|
| MD5 |
f495875989009b3aed48d16f47f31226
|
|
| BLAKE2b-256 |
646d67eb685244714389d7b2f2f2b04fbd62c7d23a9bda3df9cf575f32ecc020
|
File details
Details for the file django_text_translator-2024.5.1-py3-none-any.whl.
File metadata
- Download URL: django_text_translator-2024.5.1-py3-none-any.whl
- Upload date:
- Size: 46.3 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 |
1304d71d9bb130a28a73a73add9ae18d47ee34c88f50927750c85d37255c853c
|
|
| MD5 |
57c96c415983cb9dc46b9ef34bbecc84
|
|
| BLAKE2b-256 |
cfdce0031be786c792c4cf910380d5b19f931ef5b573161c3e3e38092c0b7be2
|