Skip to main content

An Open edX plugin for AI-powered static translation management

Project description

OL Open edX AI Static Translations

An Open edX plugin that provides AI-powered static translation management. It syncs translation keys, translates them using LLM providers, and creates pull requests with translated content.

Purpose

This plugin provides the sync_and_translate_language management command for syncing and translating Open edX static strings (frontend JSON and backend PO files) using LLM providers (OpenAI, Gemini, Mistral) with optional glossary support.

Setup

For detailed installation instructions, please refer to the plugin installation guide.

Installation required in:

  • Studio (CMS)

Configuration

This plugin shares settings with ol_openedx_course_translations. Ensure the following settings are configured:

TRANSLATIONS_PROVIDERS: {
    "default_provider": "mistral",
    "openai": {"api_key": "", "default_model": "gpt-5.2"},
    "gemini": {"api_key": "", "default_model": "gemini-3-pro-preview"},
    "mistral": {"api_key": "", "default_model": "mistral-large-latest"},
}
TRANSLATIONS_GITHUB_TOKEN: <YOUR_GITHUB_TOKEN>  # Personal access token with repo write permissions for creating PRs
TRANSLATIONS_REPO_PATH: ""  # Local filesystem path where the translations repo will be cloned/checked out
TRANSLATIONS_REPO_URL: "https://github.com/mitodl/mitxonline-translations.git"  # URL of the remote translations repository

Generating static content translations

This command synchronizes translation keys from edx-platform and MFE’s, translates empty keys using LLM, and automatically creates a pull request in the translations repository.

What it does:

  1. Syncs translation keys from edx-platform and MFE’s to the translations repository

  2. Extracts empty translation keys that need translation

  3. Translates empty keys using the specified LLM provider and model

  4. Applies translations to JSON and PO files

  5. Commits changes to a new branch

  6. Creates a pull request with translation statistics

Usage:

  1. Go to the CMS shell

  2. Run the management command:

    ./manage.py cms sync_and_translate_language <LANGUAGE_CODE> [OPTIONS]

Required arguments:

  • LANGUAGE_CODE: Language code (e.g., el, fr, es_ES)

Optional arguments:

  • --iso-code: ISO code for JSON files (default: same as language code)

  • --provider: Translation provider (openai, gemini, mistral). Default is taken from TRANSLATIONS_PROVIDERS['default_provider'] setting

  • --model: LLM model name. If not specified, uses the default_model for the selected provider from TRANSLATIONS_PROVIDERS. Examples: gpt-5.2, gemini-3-pro-preview, mistral-large-latest

  • --repo-path: Path to mitxonline-translations repository (can also be set via TRANSLATIONS_REPO_PATH setting or environment variable)

  • --repo-url: GitHub repository URL (default: https://github.com/mitodl/mitxonline-translations.git, can also be set via TRANSLATIONS_REPO_URL setting or environment variable)

  • --glossary: Path to glossary directory (optional). Should contain language-specific files (e.g. {iso_code}.txt).

  • --batch-size: Number of keys to translate per API request (default: 200, recommended: 200-300 for most models)

  • --mfe: Filter by specific MFE(s). Use edx-platform for backend translations

  • --dry-run: Run without committing or creating PR

Examples:

# Use default provider (from TRANSLATIONS_PROVIDERS['default_provider']) with its default model
./manage.py cms sync_and_translate_language el

# Use OpenAI provider with its default model (gpt-5.2)
./manage.py cms sync_and_translate_language el --provider openai

# Use OpenAI provider with a specific model
./manage.py cms sync_and_translate_language el --provider openai --model gpt-5.2

# Use Mistral provider with a specific model and glossary
./manage.py cms sync_and_translate_language el --provider mistral --model mistral-large-latest --glossary /path/to/glossary --batch-size 250

License

The code in this repository is licensed under the BSD 3-Clause license unless otherwise noted.

Please see LICENSE.txt for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ol_openedx_ai_static_translations-0.1.0.tar.gz (44.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file ol_openedx_ai_static_translations-0.1.0.tar.gz.

File metadata

File hashes

Hashes for ol_openedx_ai_static_translations-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b7483d56f7273bfc173830e93606a57e08627549fc30be262cb1bc238d62f8b9
MD5 4d0f2f50d42686b9cc11e5c8486235ad
BLAKE2b-256 231f2a4d4827f76a2aeff15f41015a2512ce17a1419aa677d6a07641482e5c27

See more details on using hashes here.

File details

Details for the file ol_openedx_ai_static_translations-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for ol_openedx_ai_static_translations-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 53db7aa68cb21f5e1400bb651aea99447575c2eebc5899b49706922e7b574157
MD5 e5355ed1c52a5f63dca3b9f9794aca3b
BLAKE2b-256 08367d42365c1b5a5b05316f32fbbacfbc6f0f9fbf0683c7d073243020054f5b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page