Skip to content

Commit 5a5efe9

Browse files
author
Asad Iqbal
committed
Merge pull request #66 from edx-solutions/asadiqbal08/WL-373
WL-373 i18n support drag and drop v2
2 parents 37637e4 + 515082b commit 5a5efe9

File tree

7 files changed

+1004
-11
lines changed

7 files changed

+1004
-11
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ install:
99
- "sh install_test_deps.sh"
1010
- "pip uninstall -y xblock-drag-and-drop-v2"
1111
- "python setup.py sdist"
12-
- "pip install dist/xblock-drag-and-drop-v2-2.0.4.tar.gz"
12+
- "pip install dist/xblock-drag-and-drop-v2-2.0.5.tar.gz"
1313
script:
1414
- pep8 drag_and_drop_v2 tests --max-line-length=120
1515
- pylint drag_and_drop_v2 tests

Changelog.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
Development version:
2-
--------------------
1+
Version 2.0.5 (2016-03-30)
2+
--------------------------
33

4+
* Marked strings for translations (PR #66)
45
* Added the ability to specify automatic alignment of dropped items. (PR #57)
56

67
Version 2.0.4 (2016-03-10)

drag_and_drop_v2/drag_and_drop_v2.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
# Classes ###########################################################
2828

2929
@XBlock.wants('settings')
30+
@XBlock.needs('i18n')
3031
class DragAndDropBlock(XBlock, XBlockWithSettingsMixin, ThemableXBlockMixin):
3132
"""
3233
XBlock that implements a friendly Drag-and-Drop problem
@@ -106,10 +107,6 @@ class DragAndDropBlock(XBlock, XBlockWithSettingsMixin, ThemableXBlockMixin):
106107
block_settings_key = 'drag-and-drop-v2'
107108
has_score = True
108109

109-
def _(self, text):
110-
""" Translate text """
111-
return self.runtime.service(self, "i18n").ugettext(text)
112-
113110
@XBlock.supports("multi_device") # Enable this block for use in the mobile app via webview
114111
def student_view(self, context):
115112
"""
@@ -186,7 +183,7 @@ def studio_view(self, context):
186183

187184
js_templates = loader.load_unicode('/templates/html/js_templates.html')
188185
help_texts = {
189-
field_name: self._(field.help)
186+
field_name: self.ugettext(field.help)
190187
for field_name, field in self.fields.viewitems() if hasattr(field, "help")
191188
}
192189
context = {

0 commit comments

Comments
 (0)