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.3.22.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 37ee42cf6d1f964d9d232947a942d59d3a0f63418b9f76a72a01c57b3b4a9f57 |
|
MD5 | 60f569a17def2bd9f408546fdb0e0787 |
|
BLAKE2b-256 | 4e5641090e284b42f5545866dcb2c9bd13580d38dcc395d4de09808d02f4bd1e |
Close
Hashes for django_text_translator-2024.3.22-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f609c0caa61f9c2e353210d7c67d7ebd529ca374dbe94eecf636b670a29007f3 |
|
MD5 | f38672b145bad82f6cd3e003b83f4f7e |
|
BLAKE2b-256 | a093791a8f6033a4f2b60700e6c2c6bd0352376aaffe2bb1bb52cd51f4232fbd |