Repository navigation
Conversation
WordCloudBlock had no i18n_js_namespace, so the runtime built no JS catalog for it and word_cloud.js never used the block's translations, even though its django.po already has them. Set the namespace, load the catalog before the block JS, and use a namespaced gettext, as openedx#336 did for Annotatable, Problem and Video. Co-Authored-By: Claude Opus 5.5 <[email protected]>
farhan
force-pushed
the
farhan/word-cloud-js-i18n
branch
from
November 26, 2026 14:25
dc165e3 to
a2472b8
Compare
farhan
marked this pull request as ready for review
November 26, 2026 14:30
17 tasks done
irfanuddinahmad
approved these changes
Nov 26, 2026
irfanuddinahmad
left a comment
Contributor
There was a problem hiding this comment.
LGTM. Tested on Tutor: the catalogs compile, load before word_cloud.js, and es_419 gives palabras enviadas en total.
Non-blocking, not new here: the title_word_/text_word_ element ids go through gettext, and fr translates them inconsistently, which breaks aria-describedby. Could be a follow-up.
Generated using Claude Code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follows up #336, which did this for Annotatable, Problem and Video but not Word Cloud. Related: openedx/openedx-platform#38745.
Problem
WordCloudBlockhas noi18n_js_namespace, so the runtime builds no JS catalog for it.word_cloud.jsnever uses the block's own translations, even though itsdjango.poalready translates them (for example{start_strong}{total}{end_strong} words submitted in total.). Learners see these strings in English.Fix
block.py: seti18n_js_namespace = "XBlockWordCloudI18N"and load the catalog before the block JS, with the same_add_i18n_js_catalogas Annotatable.word_cloud.js:drawWordClouduses a localgettextthat readswindow.XBlockWordCloudI18N, then falls back to the globalgettext, then to the msgid.Backward compatibility
get_javascript_i18n_catalog_urladds no script, and the JS behaves as before.Testing
TestWordCloudBlockI18nJsCatalog: the namespace; no script when the i18n service returns no URL or lacks the method;student_viewadds the catalog URL before the block JS.pytest src/xblock_word_cloud: 12 passed.ruff check,ruff format --check,pylintandnode --check word_cloud.jspass.🤖 Generated with Claude Code