@@ -80,6 +80,8 @@ class DragAndDropBlock(
80
80
SOLUTION_INCORRECT : None
81
81
}
82
82
83
+ i18n_js_namespace = 'DragAndDropI18N'
84
+
83
85
display_name = String (
84
86
display_name = _ ("Title" ),
85
87
help = _ ("The title of the drag and drop problem. The title is displayed to learners." ),
@@ -320,10 +322,13 @@ def _learner_raw_score(self):
320
322
return correct_count / float (total_count )
321
323
322
324
@staticmethod
323
- def _get_statici18n_js_url ():
325
+ def get_deprecated_i18n_js_url ():
324
326
"""
325
- Returns the Javascript translation file for the currently selected language, if any found by
327
+ Returns the deprecated JavaScript translation file for the currently selected language, if any found by
326
328
`pkg_resources`
329
+
330
+ This method is returns pre-OEP-58 i18n files and will be deprecated in favor
331
+ of `get_javascript_i18n_catalog_url`.
327
332
"""
328
333
lang_code = translation .get_language ()
329
334
if not lang_code :
@@ -335,6 +340,19 @@ def _get_statici18n_js_url():
335
340
return text_js .format (lang_code = code )
336
341
return None
337
342
343
+ def _get_statici18n_js_url (self ):
344
+ """
345
+ Return the JavaScript translation file provided by the XBlockI18NService.
346
+ """
347
+ if url_getter_func := getattr (self .i18n_service , 'get_javascript_i18n_catalog_url' , None ):
348
+ if javascript_url := url_getter_func (self ):
349
+ return javascript_url
350
+
351
+ if deprecated_url := DragAndDropBlock .get_deprecated_i18n_js_url ():
352
+ return self .runtime .local_resource_url (self , deprecated_url )
353
+
354
+ return None
355
+
338
356
@XBlock .supports ("multi_device" ) # Enable this block for use in the mobile app via webview
339
357
def student_view (self , context ):
340
358
"""
0 commit comments