Commit 7f1fc01f by Ned Batchelder

Change XModule i18n to use runtime.service

LMS-1597
parent ef6c8a95
......@@ -22,7 +22,6 @@ from xmodule.exceptions import NotFoundError, ProcessingError
from xblock.fields import Scope, String, Boolean, Dict, Integer, Float
from .fields import Timedelta, Date
from django.utils.timezone import UTC
from django.utils.translation import ugettext as _
log = logging.getLogger("edx.courseware")
......@@ -359,6 +358,7 @@ class CapaModule(CapaFields, XModule):
"""
# The logic flow is a little odd so that _('xxx') strings can be found for
# translation while also running _() just once for each string.
_ = self.runtime.service(self, "i18n").ugettext
check = _('Check')
final_check = _('Final Check')
......
......@@ -21,7 +21,6 @@ import copy
from django.http import Http404
from django.conf import settings
from django.utils.translation import ugettext as _
from xmodule.x_module import XModule
from xmodule.editing_module import TabsEditingDescriptor
......@@ -302,6 +301,7 @@ class VideoDescriptor(VideoFields, TabsEditingDescriptor, EmptyDataRawDescriptor
else:
return ''
_ = self.runtime.service(self, "i18n").ugettext
video_url.update({
'help': _('A YouTube URL or a link to a file hosted anywhere on the web.'),
'display_name': 'Video URL',
......
......@@ -362,6 +362,7 @@ descriptor_attr = partial(ProxyAttribute, 'descriptor') # pylint: disable=inval
module_runtime_attr = partial(ProxyAttribute, 'xmodule_runtime') # pylint: disable=invalid-name
@XBlock.needs("i18n")
class XModule(XModuleMixin, HTMLSnippet, XBlock): # pylint: disable=abstract-method
""" Implements a generic learning module.
......@@ -563,6 +564,7 @@ class ResourceTemplates(object):
return None
@XBlock.needs("i18n")
class XModuleDescriptor(XModuleMixin, HTMLSnippet, ResourceTemplates, XBlock):
"""
An XModuleDescriptor is a specification for an element of a course. This
......
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