Translate the default XBlock data

Thanks. That’s understood. The dummy function works well as we can see the strings being extracted and pushed to Transifex.

I haven’t covered all of the details yet but looks like the Promise/JSON issue has a much better method to solve that exception, which is to use a better JSONEncoder

Thanks for the extra info, I wasn’t aware of the StudioEditableMixin. It looks like the Poll XBlock can make use of it since it doesn’t use it.

Yes, the StudioEditableXBlockMixin is used in most XBlocks including DiscussionXBlock, which always shows Week 1 as the default value for discussion_category, because the XBlock utils does not translate that default value.

I’m looking for something that’s more rooted in the XBlocks and not just in Studio, also definitely not just for the field names. The hack I provided definitely does what I want – in the worst possible way!

Ideally I would like to be able to just use uggettext_lazy as we do in Django Forms and other Django-based code. What if we used a JSONEncoder that supports Promise, that should work even for complex default values (example from the Poll XBlock).

What do you think?