Skip to content

Commit

Permalink
Use Django for runtime i18n
Browse files Browse the repository at this point in the history
The django.utils.translation module has the right interface to serve as a
gettext.Translations object, so we use it for the runtime i18n service.

LMS-1597
  • Loading branch information
Ned Batchelder committed Jan 9, 2014
1 parent 7f1fc01 commit d138a2c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lms/djangoapps/courseware/module_render.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
from django.core.cache import cache
from django.core.exceptions import PermissionDenied
from django.core.urlresolvers import reverse
from django.http import Http404
from django.http import HttpResponse
from django.http import Http404, HttpResponse
import django.utils
from django.views.decorators.csrf import csrf_exempt, csrf_protect

from capa.xqueue_interface import XQueueInterface
Expand Down Expand Up @@ -419,6 +419,12 @@ def publish(event, custom_user=None):
mixins=descriptor.runtime.mixologist._mixins, # pylint: disable=protected-access
wrappers=block_wrappers,
get_real_user=user_by_anonymous_id,
services={
# django.utils.translation implements the gettext.Translations
# interface (it has ugettext, ungettext, etc), so we can use it
# directly as the runtime i18n service.
'i18n': django.utils.translation,
},
)

# pass position specified in URL to module through ModuleSystem
Expand Down

0 comments on commit d138a2c

Please sign in to comment.