Skip to main content

An Open edX plugin to auto-select the language based on course language settings.

Project description

OL Open edX Auto Select Language

An Open edX plugin to auto select the Open edX platform language based on the course language.

Purpose

Auto select the Open edX platform language based on the course language. When enabled, users will see the static site content in the course’s configured language.

Setup

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

Installation required in:

  • Studio (CMS)

  • LMS

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 and /edx/etc/cms.yml. If you’re using private.py, add these values to lms/envs/private.py and cms/envs/private.py. These should be added to the top level. Ask a fellow developer for these values.

    # Enable auto language selection
    ENABLE_AUTO_LANGUAGE_SELECTION: true
  • 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.

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_auto_select_language-0.1.0.tar.gz (7.3 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_auto_select_language-0.1.0-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for ol_openedx_auto_select_language-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ff2b5901c13d00d1e39d696e63d47cf03717888b218f37253eecad04da087263
MD5 27fcdc25feb0e85fa8136f12107aa62f
BLAKE2b-256 4770cddaad986acec41c1de5e2eb7093f3c11ceb03c4d6f1619d2dd7f1d776c5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ol_openedx_auto_select_language-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c30bbf2c4d5efc592f3d8a3b8fb4b47be0e599760d5ec163999d0d6bcf13ca7e
MD5 f4ff626464b05a5445110243de65bc83
BLAKE2b-256 37bc07d780ca280bde189db5ec42a190529e0b7992b0bcfae5ec1e1ad039c8f0

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