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.3.17.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | c3a6a35059275688c0e78c3aa555a6e9ec7ffcac429a5de2a0e3c13cf56ad056 |
|
MD5 | b97db7f88101f23737f0aa1dc731dbc3 |
|
BLAKE2b-256 | 757b0d88e9f0f73763421952eb85fcbaa305ff9fb234c056598d944497047437 |
Close
Hashes for django_text_translator-2024.3.17-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 69907b00d5a49c07a8c6afc9183242fd018a6cbef4aa6ab3b9a64eacd0da626f |
|
MD5 | 430795d68b929c40a0fec4262a243a59 |
|
BLAKE2b-256 | 6f5df8da6d9e0e8110d72396746482b7c1dbb09806cc1fc6a472ac970d8ac13b |