Commit 9148d2e1 by Andy Armstrong

Merge pull request #3875 from louyihua/translation-fix

i18n: Make values that has 'display_name' be displayed localized in editor
parents 58198b91 f048a584
......@@ -756,9 +756,12 @@ class XModuleDescriptor(XModuleMixin, HTMLSnippet, ResourceTemplates, XBlock):
Can be limited by extending `non_editable_metadata_fields`.
"""
def jsonify_value(field, json_choice):
if isinstance(json_choice, dict) and 'value' in json_choice:
if isinstance(json_choice, dict):
json_choice = dict(json_choice) # make a copy so below doesn't change the original
json_choice['value'] = field.to_json(json_choice['value'])
if 'display_name' in json_choice:
json_choice['display_name'] = get_text(json_choice['display_name'])
if 'value' in json_choice:
json_choice['value'] = field.to_json(json_choice['value'])
else:
json_choice = field.to_json(json_choice)
return json_choice
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment