Skip to main content

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

  1. Install: pip install django-text-translator
  2. Add "django_text_translator" to your INSTALLED_APPS setting like this:
        INSTALLED_APPS = [
            ...,
            "django_text_translator",
        ]
    
  3. Run python manage.py makemigrations and python manage.py migrate to create the models.
  4. Start the development server and visit the admin to add a translator.
  5. 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
    
    
  6. More details can be found in the models.py file.

Release files for django-text-translator 2024.5.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-text-translator 2024.5.1
File Size Uploaded
django_text_translator-2024.5.1.tar.gz 15.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-text-translator 2024.5.1
File Interpreter ABI Platform
django_text_translator-2024.5.1-py3-none-any.whl Python 3 none any Details

Total release size: 61.8 kB

Release files / django_text_translator-2024.5.1.tar.gz

Download URL django_text_translator-2024.5.1.tar.gz
Size 15.5 kB
Tags Source
SHA-256 checksum
How to use checksums
64aa3021cc6a71c2ade57de25a6931641aed2c3f5d391cf5b56e3201f27556e3
BLAKE2b-256 checksum
How to use checksums
646d67eb685244714389d7b2f2f2b04fbd62c7d23a9bda3df9cf575f32ecc020
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.9.19

Release files / django_text_translator-2024.5.1-py3-none-any.whl

Download URL django_text_translator-2024.5.1-py3-none-any.whl
Size 46.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1304d71d9bb130a28a73a73add9ae18d47ee34c88f50927750c85d37255c853c
BLAKE2b-256 checksum
How to use checksums
cfdce0031be786c792c4cf910380d5b19f931ef5b573161c3e3e38092c0b7be2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.9.19
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page