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
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.3.5.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3b8e7a7868e271a515ac0a5830cd8279266670406f61b9d037b98ea226a399d5 |
|
MD5 | cff67501be50b6b7ca0d17f160d76973 |
|
BLAKE2b-256 | 734650533a1cc595093d31f07abbae34516007d4b6498fa3d5ae530639bf2198 |
Close
Hashes for django_text_translator-2024.3.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6e810d72904db9365df398b3e256d756c7180346305b5bb47de197d3dec6b652 |
|
MD5 | 803424f881228ba10418dfb39b80d14b |
|
BLAKE2b-256 | 1a8322cb442379e42a088580187a5e45a505941f6d9edd9bff69ee3a8841388c |