Skip to main content

An Open edX plugin to translate courses

Project description

OL Open edX Course Translations

An Open edX plugin to manage course translations.

Purpose

Translate course content into multiple languages to enhance accessibility for a global audience.

Setup

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

Installation required in:

  • Studio (CMS)

  • LMS (for auto language selection feature)

Configuration

  • Add the following configuration values to the config file in Open edX. For any release after Juniper, that config file is /edx/etc/lms.yml. If you’re using private.py, add these values to lms/envs/private.py. These should be added to the top level. Ask a fellow developer for these values.

    DEEPL_API_KEY: <YOUR_DEEPL_API_KEY_HERE>
    ENABLE_AUTO_LANGUAGE_SELECTION: true  # Enable auto language selection based on course language
  • For Tutor installations, these values can also be managed through a custom Tutor plugin.

Auto Language Selection

The plugin includes an auto language selection feature that automatically sets the user’s language preference based on the course language. When enabled, users will see the static site content in the course’s configured language.

To enable auto language selection:

  1. Set ENABLE_AUTO_LANGUAGE_SELECTION to true in your settings.

  2. Set SHARED_COOKIE_DOMAIN to your domain (e.g., .local.openedx.io for local tutor setup) to allow cookies to be shared between LMS and CMS.

How it works:

  • LMS: The CourseLanguageCookieMiddleware automatically detects course URLs and sets the language preference based on the course’s configured language.

  • CMS: The CourseLanguageCookieResetMiddleware ensures Studio always uses English for the authoring interface.

  • Admin areas: Admin URLs (/admin, /sysadmin, instructor dashboards) are forced to use English regardless of course language.

MFE Integration

To make auto language selection work with Micro-Frontends (MFEs), you need to use a custom Footer component that handles language detection and switching.

Setup:

  1. Use the Footer component from src/bridge/settings/openedx/mfe/slot_config/Footer.jsx in the ol-infrastructure repository.

  2. Enable auto language selection in each MFE by adding the following to their .env.development file:

    ENABLE_AUTO_LANGUAGE_SELECTION="true"
  3. This custom Footer component: - Detects the current course context in MFEs - Automatically switches the MFE language based on the course’s configured language - Ensures consistent language experience across the platform

  4. Configure your MFE slot overrides to use this custom Footer component instead of the default one.

Note: The custom Footer is required because MFEs run as separate applications and need their own mechanism to detect and respond to course language settings. The environment variable must be set in each MFE’s configuration for the feature to work properly.

Translating a Course

  1. Open the course in Studio.

  2. Go to Tools -> Export Course.

  3. Export the course as a .tar.gz file.

  4. Go to the CMS shell

  5. Run the management command to translate the course:

    ./manage.py cms translate_course --source-language <SOURCE_LANGUAGE_CODE, defaults to `EN`> --translation-language <TRANSLATION_LANGUAGE_CODE i.e. AR> --course-dir <PATH_TO_EXPORTED_COURSE_TAR_GZ>

License

The code in this repository is licensed under the AGPL 3.0 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_course_translations-0.2.0.tar.gz (11.2 kB view details)

Uploaded Source

Built Distribution

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

ol_openedx_course_translations-0.2.0-py3-none-any.whl (15.2 kB view details)

Uploaded Python 3

File details

Details for the file ol_openedx_course_translations-0.2.0.tar.gz.

File metadata

File hashes

Hashes for ol_openedx_course_translations-0.2.0.tar.gz
Algorithm Hash digest
SHA256 36d550c53861f3ed8e4419cd04f88b5b3e6543f3ff16e768eebbbb720bdd56e6
MD5 d47c3150fa70700fa4446e6622d7e5fe
BLAKE2b-256 b8a0eddb0e1838d8660b35d033256e39f3dc1a2a736bdd4a5f3d3b4e9cd924d9

See more details on using hashes here.

File details

Details for the file ol_openedx_course_translations-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for ol_openedx_course_translations-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ee9d87565508cea28b5eb76f1f58a77fe3594db9086d2614906fb0e6681b9504
MD5 f359537248e2714b7326552b6c43f050
BLAKE2b-256 2ff85328bac54c073ddfedb12690c668135e92b4e67a97473b7de05808cc90d4

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