Repository navigation
Description
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
- 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 globalgettext()/ngettext(). Video, Problem and Annotatable JS strings are translated today only because the platform's djangojs catalog has the same msgids fromxmodule/js/src/(about 55, 24 and 6 references).- Fix: set
i18n_js_namespaceon each block that has translatable JS, and call the namespacedgettext/ngettextin its JS. Each block'sxmodule/js/src/copy stays in the platform until its fix ships: Video (refactor: remove built-in Video XBlock implementation (slash-n-burn #37819) openedx-platform#38750), Problem (#38751), Annotatable (#38746).
- Fix: set
xblock_problem/capa/safe_exec/remote_exec.pyimportsdjango.utils.translation.gettextdirectly (3 codejail error messages). It's a module-level function with no block instance, so the translator has to be passed in.xblock_lti:templates/lti_form.htmlis rendered withouti18n_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) afterpull_xblock_translationsandcompile_xblock_translations, with the built-in block code removed.
Generated using Claude Code
Activity
fix: translate Problem drag-and-drop JS with the block catalog
fix: translate the Matlab "still being run" message via block i18n
feat: translate Video, Problem and Annotatable JS with block catalogs (…