Skip to main content

yesglot

https://pypi.org/project/yesglot https://github.com/efe/yesglot/actions?query=branch%3Amain https://github.com/efe/yesglot/blob/main/LICENSE

LLM-powered Django translations ✨

A Django app that autofills missing translations in .po files using an LLM, while respecting ICU format placeholders and source references.

Why yesglot?

  • 🧠 LLM-powered: works with 100+ LLM models through LiteLLM’s unified API
  • 🔒 Placeholder-safe: keeps {name}, {{handlebars}}, URLs, and emails intact
  • 📦 Django-native: one management command: python manage.py translatemessages
  • 🧮 Cost-aware: prints per-file and total cost (via LiteLLM)
  • 🧱 Token-safe batching: automatically splits work to avoid context overflows

🚀Quick Start

Installation

pip install yesglot

Add yesglot to your Django settings:

INSTALLED_APPS = [
    # ...
    "yesglot",
]

Configuration

Set the model from 100+ LLM models and API key in your Django settings:

YESGLOT_LLM_MODEL = "openai/gpt-4o-mini"
YESGLOT_API_KEY = "sk-..."

Usage

A typical workflow with Django translations:

  1. Extract messages into .po files (creates entries with empty msgstr):
python manage.py makemessages -all
  1. Autofill missing translations with yesglot:
python manage.py translatemessages

Example output:

▶ Translation run started.
Using translation model: openai/gpt-4o-mini

• Language: French [fr]
  - Scanning: locale/fr/LC_MESSAGES/django.po
    Missing entries: 12. Translating…
    Filled 12 entries in 3.21s • Cost: $0.0123

============================================================
Done in 3.76s • Files: 1 • Missing found: 12 • Filled: 12 • Total cost: $0.0123
  1. Compile translations into .mo files (so Django can use them at runtime):
python manage.py compilemessages

Advantage Usage

Optional parameters,

  • YESGLOT_SAFETY_MARGIN: 1000 (default)
  • YESGLOT_PER_ITEM_OUTPUT: 100 (default)
  • YESGLOT_LLM_MODEL_TEMPERATURE: 0 (default)

System Prompt

It is preconfigured, though you may override it to tailor the behavior of your translation.

  • SYSTEM_PROMPT_FUNCTION: for example, "myproject.myapp.utils.get_system_prompt"
  • SYSTEM_PROMPT: string

Default:

You are a professional translator. Translate into the target language.

  • Keep placeholders like {name} / {{handlebars}} unchanged.
  • Keep URLs and emails unchanged.
  • Return ONLY a JSON array of strings in the same order.

Preamble Template

It’s already configured, but you can override it to adjust how your translation behaves.

  • PREAMBLE_TEMPLATE_FUNCTION: for example, "myproject.myapp.utils.get_preamble"
  • PREAMBLE_TEMPLATE: string

Default:

Translate these items into {language}. Return ONLY a JSON array:

License

Mozilla Public License Version 2.0

Yesglot Logo

Metadata

Release files for yesglot 1.0.0

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

Source distribution (sdist)

Source distribution for yesglot 1.0.0
File Size Uploaded
yesglot-1.0.0.tar.gz 15.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for yesglot 1.0.0
File Interpreter ABI Platform
yesglot-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 35.2 kB

Release files / yesglot-1.0.0.tar.gz

Download URL yesglot-1.0.0.tar.gz
Size 15.1 kB
Tags Source
SHA-256 checksum
How to use checksums
2b2df9847c5ab070fa594b15070765445149c9dc32513a1707c52c733b9dae4b
BLAKE2b-256 checksum
How to use checksums
2ea56939c2d615e832e88ba5f38b309db07a866f4173105f15b32e70008376ca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.1

Release files / yesglot-1.0.0-py3-none-any.whl

Download URL yesglot-1.0.0-py3-none-any.whl
Size 20.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
71d0fbdea359e7685782f790c2bd7cd0cf79668966928e7ff08347be9823ec40
BLAKE2b-256 checksum
How to use checksums
fd333cb267a25eaa0a220eabf853caa1b65f9154c800b91f885b6a9a0159baf0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.1
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