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.20.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | bbefddb005bd59dccd7e28e692ce8607d1f60fccaebeb18e5034a5d5a4bfaa8a |
|
MD5 | 079ee4127f075b7622140fcf6f274cda |
|
BLAKE2b-256 | 3128d30eda1da925fed10139bf63643936677346ff2b6b80d83cb0d6605cd09c |
Close
Hashes for django_text_translator-2024.4.20-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a84f0b5531cd98863337d11ffa79964730b53741365619da136e2f42bfd795f6 |
|
MD5 | f0f28ff032371e15c0724e8700747091 |
|
BLAKE2b-256 | c1bc527370005b80a9397a4f32b45b1ab7addcc8e5abf6abc7374dc657ddab90 |