fix: fixed some translations in cms and lms#227
fix: fixed some translations in cms and lms#227Asespinel wants to merge 1 commit intoopen-craft:masterfrom
Conversation
|
Hey @itsjeyd hope you’re doing well! 🙂 |
|
Hi @Asespinel, thank you for this contribution! I won't be reviewing this PR myself but I'll create an internal ticket for the next OpenCraft sprint to make sure you'll get feedback soon. |
|
Hi @Asespinel, thank you for the detailed PR description! Would you mind adding an information about how you switch the user language? I tried the following approaches using the
In both cases, the Authoring MFE looked like this: The I also tested this approach in one of our production Sumac instances (this time with the legacy Studio experience), and noticed that the XBlock was partially translated: Is this something Teak-specific or are you using a different method to define the user's language? |
|
@Agrendalath sorry for the late reply, yeah to switch the user language you can modify the corresponding lang cookie like you said or you can navigate to the account MFE to switch it as needed. When We tested this we used a teak env but in my understanding, this was happening in sumac as well. We may have time to check this again in the following sprint. In the meantime would you like something to be changed? |




Description
The Poll XBlock had translation infrastructure (.po/.mo files in multiple languages) but translations were not being applied to the UI. Template strings remained in English regardless of the user's language preference.
Why not use Django's {% trans %} template tags?
We initially explored using Django's standard {% trans %} tags, which would be the typical Django approach. However, XBlocks run in a specialized runtime context that is incompatible with Django's translation system:
The i18n service to have a _catalog attribute compatible with DjangoTranslation.merge()
Proposed solution
Translation file fixes
Testing
Tested in teak environment with multiple languages (English, Spanish, French). All strings now translate correctly based on user language preference. To set your lang preference you can choose your language from the account MFE or change the lang cookie using your dev tools.