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.22.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 311f7e4e2ae9e04c5101e6986527e6b51e67284726ff231e820f2b05d096f568 |
|
MD5 | 91332bd3e775f7cdd20d6014896293d4 |
|
BLAKE2b-256 | df522b6770b20d98e036d620ed35f5111c27bc1b2ec37835c5238ddef13c5633 |
Close
Hashes for django_text_translator-2024.4.22-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d16ecc7cb32f8fc3ef2bd069acf309410afe8c1305ee06adc02453d232305889 |
|
MD5 | 2f462aa5540bf05a91b5683d58753e44 |
|
BLAKE2b-256 | 06e7cd62b2cf34a61210178214f73de4b119e33b0fe6b82ffbc218b774af34aa |