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.2.29.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6e60d37c6ed155ad39a7f90cfc787eeead1765b5094e6b5b932197a4042c3c02 |
|
MD5 | ad5ebaf246d02e86f9e239453fccc4a7 |
|
BLAKE2b-256 | bba564fd1704410dc81de8b81e72b7458e17a573fb497b67a6c9bdcc8eb4aca9 |
Close
Hashes for django_text_translator-2024.2.29.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0a0d768e3602213efcc45b33daf5322df9f13d93523f02138eed61ecc9de7c34 |
|
MD5 | 526d82283e6061586eb9c54c88fc9df5 |
|
BLAKE2b-256 | c9d40285bfb55565d1e9c22a14aedba3fd29b88340933f7d674b46cefef7891f |