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.26.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5120fd1c932d27d8f2b9b373534989c1eb18a418d2047f005c127aacab392efc |
|
MD5 | 6d8498787c828621e2b206b6f9d55eb0 |
|
BLAKE2b-256 | d3c5ae31b59093cdbbe3e3b3fb7ce5a09d4e4f0394c66669427a713f8fb3a3e7 |
Close
Hashes for django_text_translator-2024.3.26-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2ff0905ef52584e7c773f0c917dce560420effc638f910e9de8c3d3aa80a7c31 |
|
MD5 | a60257a91b4b9fa59bfbd3c0d01f2944 |
|
BLAKE2b-256 | 5cd83f61f0be8d5950d8f63660797e96f2c7fc1b2dbeeeb4d4756fb94030af61 |