Skip to content

i18n: strings that bypass the block catalog (JS namespace, remote_exec, lti_form) #332

Closed

Description

@irfanuddinahmad

Follow-up to #329 (per-block translation catalogs, epic #241).

#329 gives each block its own catalog, but that catalog is only used when a string goes through the block's i18n service (XBlockI18nService in openedx-platform). Strings that skip the service are looked up in Django's global catalog. That catalog only has msgids from openedx-platform's own source, and the built-in copies of these strings are removed by the slash-n-burn PRs (openedx/openedx-platform#37819).

Gaps

  1. JS: no block defines i18n_js_namespace. compile_xblock_js_messages (common/djangoapps/xblock_django/translation.py) only builds a JS catalog for blocks that define it, and the blocks' JS calls the global gettext() / ngettext(). Video, Problem and Annotatable JS strings are translated today only because the platform's djangojs catalog has the same msgids from xmodule/js/src/ (about 55, 24 and 6 references).
  2. xblock_problem/capa/safe_exec/remote_exec.py imports django.utils.translation.gettext directly (3 codejail error messages). It's a module-level function with no block instance, so the translator has to be passed in.
  3. xblock_lti: templates/lti_form.html is rendered without i18n_service (block.py, render_django_template("templates/lti_form.html", ...)). refactor: remove built-in LTI XBlock implementation (slash-n-burn #37819) openedx-platform#38747 deletes the platform copy.

Not affected: other templates (Word Cloud, Poll, Annotatable, PDF, LTI lti.html) already pass i18n_service. Video video.html and the Discussion templates render without it, but the platform keeps its copies, so their msgids stay in the global catalog. Problem templates go through render_to_string and have had no platform copy since before slash-n-burn. That gap already exists on master and is worth a separate look.

Done when

  • The Video, Problem and Annotatable JS strings, plus the two strings above, show up translated (e.g. in ar) after pull_xblock_translations and compile_xblock_translations, with the built-in block code removed.

Generated using Claude Code

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