Monkey patch 'django.utils.translation'
Modify Django's translation library, such that the gettext family of
functions return an empty string when attempting to translate a
falsey value. This overrides the default behavior [0]:
> It is convention with GNU gettext to include meta-data as the
> translation for the empty string.
This patch provides a holistic solution to replace the current piecemeal
approach [1][2].
Affected Methods:
- gettext
- ugettext
[0] https://docs.python.org/2.7/library/gettext.html#the-gnutranslations-class
[1] bad803e451
[2] https://github.com/edx/edx-platform/pull/4653
This commit is contained in:
@@ -7,12 +7,15 @@ from django.conf import settings
|
||||
settings.INSTALLED_APPS # pylint: disable=W0104
|
||||
|
||||
from django_startup import autostartup
|
||||
from monkey_patch import django_utils_translation
|
||||
|
||||
|
||||
def run():
|
||||
"""
|
||||
Executed during django startup
|
||||
"""
|
||||
django_utils_translation.patch()
|
||||
|
||||
autostartup()
|
||||
|
||||
add_mimetypes()
|
||||
|
||||
Reference in New Issue
Block a user