Skip to content

i18n: lms doesn't read the cross-app language preference that os already sets #259

Open

Description

@opaksbyron

Summary

os sets a cross-subdomain language preference that lms never reads, so a
language chosen in one IBL app doesn't carry into the LMS.

From os/i18n/config.ts:

/**
 * Shared Open edX language-preference cookie. Set on the registrable parent
 * domain (e.g. `.iblai.app`) so the selected language is synced across all
 * subdomain apps (auth, learn, mentor, …).
 */
export const OPENEDX_LOCALE_COOKIE = 'openedx-language-preference';

lms is one of those subdomain apps, but it has no i18n at all — no
next-intl, no messages/, no locale resolution in any of its 75
dependencies. So the mechanism for syncing language across apps is already
built and deployed, and the LMS is the hole in it. A learner who picks
Français in the mentor app lands on an English course catalogue.

Why it may be worth prioritising

os already ships fr, es and zh at 2,137 keys each. The learner-facing
product is the one that stays English-only — which is backwards if the LMS is
what gets deployed to non-English-speaking workforces.

Why the port is cheaper than the file count suggests

lms has 594 .tsx files across 86 routes, but os resolves locale from a
cookie with no i18n routing — so none of those routes need restructuring.
No [locale] segments, no middleware rewrite. The work is the provider plus
string extraction, which can be done surface by surface.

The tooling ports almost verbatim too: scripts/validate-i18n.mjs already
checks key parity across catalogs and flags entries byte-identical to English
as probably-untranslated, with a SAME_OK allowlist for terms like LLM and
SSO. .github/workflows/pr-i18n.yml gates merges on it.

Proposed first PR

Rather than one large change, a beachhead that establishes the pattern and lets
the rest happen incrementally:

  1. Add next-intl, and port i18n/config.ts and i18n/request.ts from os
    so lms reads the same openedx-language-preference cookie with the same
    resolveLocale normalisation (fr-FR → fr, zh-hans → zh)
  2. Add messages/en.json and messages/fr.json
  3. Convert one surface end to end — the navigation shell plus course discovery,
    i.e. what a learner sees first
  4. Port scripts/validate-i18n.mjs and .github/workflows/pr-i18n.yml so every
    later PR is held to key parity from the start
  5. Document the extraction pattern in the PR so remaining routes can follow

Questions before I build it

  1. Is i18n in lms wanted, or deliberately deferred?
  2. Should it follow os's next-intl + cookie setup exactly, or is a different
    approach preferred here?
  3. Same locale set as os (en/fr/es/zh), or start with en/fr?
  4. Any preference on which surface goes first?

Happy to open the PR against whatever answers those get. I've read
AGENTS.md and .claude/skills/ — prettier on changed files, no
--no-verify, and e2e/coverage.json kept from regressing.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions