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.23.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0f2d7b472f4cccfc7786e28aab07d83d9fc9e6ed80d380a5ae4f4ae6f9f6587f |
|
MD5 | 80ebd1cb1a8f6164a23fd85ac37179bd |
|
BLAKE2b-256 | b8ccfd554d288a6bc9b3e8e075ebfa25a26e7758fd7c522c45645f972c0b8a77 |
Close
Hashes for django_text_translator-2024.4.23-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | aeaffbf4ddd1155c8dacef77aea33af83882ef217548514fb42e80a7138f3b7e |
|
MD5 | 9550eb0e56edcbe3dcd2a75e50bd37da |
|
BLAKE2b-256 | 37837ae1704da29cba9c00adf0ab771392af3e9a0ada3001871aa6618c662f9d |