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.5.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 64aa3021cc6a71c2ade57de25a6931641aed2c3f5d391cf5b56e3201f27556e3 |
|
MD5 | f495875989009b3aed48d16f47f31226 |
|
BLAKE2b-256 | 646d67eb685244714389d7b2f2f2b04fbd62c7d23a9bda3df9cf575f32ecc020 |
Close
Hashes for django_text_translator-2024.5.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1304d71d9bb130a28a73a73add9ae18d47ee34c88f50927750c85d37255c853c |
|
MD5 | 57c96c415983cb9dc46b9ef34bbecc84 |
|
BLAKE2b-256 | cfdce0031be786c792c4cf910380d5b19f931ef5b573161c3e3e38092c0b7be2 |