Commit afd30bde by Matt Drayer

mattdrayer/xblock-translations: Initial attempt

parent cabfb810
# #-#-#-#-# django-partial.po (0.1a) #-#-#-#-#
# edX translation file.
# Copyright (C) 2016 EdX
# This file is distributed under the GNU AFFERO GENERAL PUBLIC LICENSE.
# EdX Team <info@edx.org>, 2016.
#
# #-#-#-#-# django-studio.po (0.1a) #-#-#-#-#
# edX translation file.
# Copyright (C) 2016 EdX
# This file is distributed under the GNU AFFERO GENERAL PUBLIC LICENSE.
# EdX Team <info@edx.org>, 2016.
#
# #-#-#-#-# mako.po (0.1a) #-#-#-#-#
# edX translation file
# Copyright (C) 2016 edX
# This file is distributed under the GNU AFFERO GENERAL PUBLIC LICENSE.
# EdX Team <info@edx.org>, 2016.
#
# #-#-#-#-# mako-studio.po (0.1a) #-#-#-#-#
# edX translation file
# Copyright (C) 2016 edX
# This file is distributed under the GNU AFFERO GENERAL PUBLIC LICENSE.
# EdX Team <info@edx.org>, 2016.
#
# #-#-#-#-# messages.po (EdX Studio) #-#-#-#-#
# edX translation file
# Copyright (C) 2013 edX
# This file is distributed under the GNU AFFERO GENERAL PUBLIC LICENSE.
#
# #-#-#-#-# wiki.po (0.1a) #-#-#-#-#
# edX translation file
# Copyright (C) 2016 edX
# This file is distributed under the GNU AFFERO GENERAL PUBLIC LICENSE.
# EdX Team <info@edx.org>, 2016.
#
msgid ""
msgstr ""
"Project-Id-Version: 0.1a\n"
"Report-Msgid-Bugs-To: openedx-translation@googlegroups.com\n"
"POT-Creation-Date: 2016-02-04 15:35+0000\n"
"PO-Revision-Date: 2016-02-04 15:35:27.804250\n"
"Last-Translator: \n"
"Language-Team: openedx-translation <openedx-translation@googlegroups.com>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 1.3\n"
"Language: en\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
msgid "Problem"
msgstr "Prößlém Ⱡ'σяєм ιρѕυм #"
msgid "Drag the items onto the image above."
msgstr "Dяag items Ⱡ'σяєм ιρѕυм #"
msgid "An isosceles triangle with three layers of similar height. It is shown upright, so the widest layer is located at the bottom, and the narrowest layer is located at the top."
msgstr "Ⱡ'σяєм ιρѕυм #"
msgid "Drag and Drop"
msgstr "Drag and Drop Ⱡ'σяєм ιρѕυм #"
msgid "Goes to the top"
msgstr "Top Ⱡ'σяєм ιρѕυм #"
msgid "Goes to the middle"
msgstr "Middle Ⱡ'σяєм ιρѕυм #"
msgid "Goes to the bottom"
msgstr "Bottom Ⱡ'σяєм ιρѕυм #"
msgid "I don't belong anywhere"
msgstr "No belong Ⱡ'σяєм ιρѕυм #"
msgid "Feedback"
msgstr "Feedback Ⱡ'σяєм ιρѕυм #"
msgid "Keyboard help"
msgstr "Keyboard Ⱡ'σяєм ιρѕυм #"
# #-#-#-#-# django-partial.po (0.1a) #-#-#-#-#
# edX translation file.
# Copyright (C) 2016 EdX
# This file is distributed under the GNU AFFERO GENERAL PUBLIC LICENSE.
# EdX Team <info@edx.org>, 2016.
#
# #-#-#-#-# django-studio.po (0.1a) #-#-#-#-#
# edX translation file.
# Copyright (C) 2016 EdX
# This file is distributed under the GNU AFFERO GENERAL PUBLIC LICENSE.
# EdX Team <info@edx.org>, 2016.
#
# #-#-#-#-# mako.po (0.1a) #-#-#-#-#
# edX translation file
# Copyright (C) 2016 edX
# This file is distributed under the GNU AFFERO GENERAL PUBLIC LICENSE.
# EdX Team <info@edx.org>, 2016.
#
# #-#-#-#-# mako-studio.po (0.1a) #-#-#-#-#
# edX translation file
# Copyright (C) 2016 edX
# This file is distributed under the GNU AFFERO GENERAL PUBLIC LICENSE.
# EdX Team <info@edx.org>, 2016.
#
# #-#-#-#-# messages.po (EdX Studio) #-#-#-#-#
# edX translation file
# Copyright (C) 2013 edX
# This file is distributed under the GNU AFFERO GENERAL PUBLIC LICENSE.
#
# #-#-#-#-# wiki.po (0.1a) #-#-#-#-#
# edX translation file
# Copyright (C) 2016 edX
# This file is distributed under the GNU AFFERO GENERAL PUBLIC LICENSE.
# EdX Team <info@edx.org>, 2016.
#
msgid ""
msgstr ""
"Project-Id-Version: 0.1a\n"
"Report-Msgid-Bugs-To: openedx-translation@googlegroups.com\n"
"POT-Creation-Date: 2016-02-04 15:35+0000\n"
"PO-Revision-Date: 2016-02-04 15:35:27.804250\n"
"Last-Translator: \n"
"Language-Team: openedx-translation <openedx-translation@googlegroups.com>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 1.3\n"
"Language: en\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
msgid "Problem"
msgstr "Prößlém Ⱡ'σяєм ιρѕυм #"
msgid "Drag the items onto the image above."
msgstr "Dяag items Ⱡ'σяєм ιρѕυм #"
msgid "An isosceles triangle with three layers of similar height. It is shown upright, so the widest layer is located at the bottom, and the narrowest layer is located at the top."
msgstr "Ⱡ'σяєм ιρѕυм #"
msgid "Drag and Drop"
msgstr "Drag and Drop Ⱡ'σяєм ιρѕυм #"
msgid "Goes to the top"
msgstr "Top Ⱡ'σяєм ιρѕυм #"
msgid "Goes to the middle"
msgstr "Middle Ⱡ'σяєм ιρѕυм #"
msgid "Goes to the bottom"
msgstr "Bottom Ⱡ'σяєм ιρѕυм #"
msgid "I don't belong anywhere"
msgstr "No belong Ⱡ'σяєм ιρѕυм #"
msgid "Feedback"
msgstr "Feedback Ⱡ'σяєм ιρѕυм #"
msgid "Keyboard help"
msgstr "Keyboard Ⱡ'σяєм ιρѕυм #"
...@@ -27,6 +27,7 @@ loader = ResourceLoader(__name__) ...@@ -27,6 +27,7 @@ loader = ResourceLoader(__name__)
# Classes ########################################################### # Classes ###########################################################
@XBlock.wants('settings') @XBlock.wants('settings')
@XBlock.needs('i18n')
class DragAndDropBlock(XBlock, XBlockWithSettingsMixin, ThemableXBlockMixin): class DragAndDropBlock(XBlock, XBlockWithSettingsMixin, ThemableXBlockMixin):
""" """
XBlock that implements a friendly Drag-and-Drop problem XBlock that implements a friendly Drag-and-Drop problem
...@@ -107,8 +108,13 @@ class DragAndDropBlock(XBlock, XBlockWithSettingsMixin, ThemableXBlockMixin): ...@@ -107,8 +108,13 @@ class DragAndDropBlock(XBlock, XBlockWithSettingsMixin, ThemableXBlockMixin):
has_score = True has_score = True
def _(self, text): def _(self, text):
""" Translate text """ """
return self.runtime.service(self, "i18n").ugettext(text) Hand the translation work off to the runtime's I18N service
"""
runtime_service = self.runtime.service(self, "i18n")
runtime_ugettext = runtime_service.ugettext
response = runtime_ugettext(text)
return response
@XBlock.supports("multi_device") # Enable this block for use in the mobile app via webview @XBlock.supports("multi_device") # Enable this block for use in the mobile app via webview
def student_view(self, context): def student_view(self, context):
...@@ -146,9 +152,16 @@ class DragAndDropBlock(XBlock, XBlockWithSettingsMixin, ThemableXBlockMixin): ...@@ -146,9 +152,16 @@ class DragAndDropBlock(XBlock, XBlockWithSettingsMixin, ThemableXBlockMixin):
and feedback. and feedback.
""" """
def items_without_answers(): def items_without_answers(self):
"""
Internal helper to construct the set of unanswered items and their fields for the XBlock
"""
items = copy.deepcopy(self.data.get('items', '')) items = copy.deepcopy(self.data.get('items', ''))
for item in items: for item in items:
if 'displayName' in item:
item['displayName'] = self._(item['displayName'])
if 'correct' in item:
item['correct'] = self,_(item['correct'])
del item['feedback'] del item['feedback']
del item['zone'] del item['zone']
item['inputOptions'] = 'inputOptions' in item item['inputOptions'] = 'inputOptions' in item
...@@ -160,16 +173,16 @@ class DragAndDropBlock(XBlock, XBlockWithSettingsMixin, ThemableXBlockMixin): ...@@ -160,16 +173,16 @@ class DragAndDropBlock(XBlock, XBlockWithSettingsMixin, ThemableXBlockMixin):
"url_name": getattr(self, 'url_name', ''), "url_name": getattr(self, 'url_name', ''),
"display_zone_labels": self.data.get('displayLabels', False), "display_zone_labels": self.data.get('displayLabels', False),
"display_zone_borders": self.data.get('displayBorders', False), "display_zone_borders": self.data.get('displayBorders', False),
"items": items_without_answers(), "items": items_without_answers(self),
"title": self.display_name, "title": self._(self.display_name),
"show_title": self.show_title, "show_title": self.show_title,
"problem_text": self.question_text, "problem_text": self._(self.question_text),
"show_problem_header": self.show_question_header, "show_problem_header": self.show_question_header,
"target_img_expanded_url": self.target_img_expanded_url, "target_img_expanded_url": self.target_img_expanded_url,
"target_img_description": self.target_img_description, "target_img_description": self._(self.target_img_description),
"item_background_color": self.item_background_color or None, "item_background_color": self.item_background_color or None,
"item_text_color": self.item_text_color or None, "item_text_color": self.item_text_color or None,
"initial_feedback": self.data['feedback']['start'], "initial_feedback": self._(self.data['feedback']['start']),
# final feedback (data.feedback.finish) is not included - it may give away answers. # final feedback (data.feedback.finish) is not included - it may give away answers.
} }
...@@ -411,6 +424,7 @@ class DragAndDropBlock(XBlock, XBlockWithSettingsMixin, ThemableXBlockMixin): ...@@ -411,6 +424,7 @@ class DragAndDropBlock(XBlock, XBlockWithSettingsMixin, ThemableXBlockMixin):
zones = [] zones = []
for zone in self.data.get('zones', []): for zone in self.data.get('zones', []):
zone = zone.copy() zone = zone.copy()
zone['title'] = self._(zone['title'])
if "uid" not in zone: if "uid" not in zone:
zone["uid"] = zone.get("title") # Older versions used title as the zone UID zone["uid"] = zone.get("title") # Older versions used title as the zone UID
# Remove old, now-unused zone attributes, if present: # Remove old, now-unused zone attributes, if present:
......
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