Code

Ticket #8626: 8626.diff

File 8626.diff, 802 bytes (added by arien, 6 years ago)

Patch the locale.locale_alias dict for 'en'.

Line 
1Index: django/utils/translation/trans_real.py
2===================================================================
3--- django/utils/translation/trans_real.py      (revision 8739)
4+++ django/utils/translation/trans_real.py      (working copy)
5@@ -10,6 +10,11 @@
6 from django.utils.safestring import mark_safe, SafeData
7 from django.utils.thread_support import currentThread
8 
9+# Monkey patch to allow translations for the 'en' locale.  (In the locale
10+# module, 'en' is mapped to the 'en_US.ISO8859-1' alias, which causes the
11+# en_US .mo file to be loaded for the 'en' locale.)  See ticket #8626.
12+locale.locale_alias['en'] = 'en.ISO8859-1'
13+
14 # Translations are cached in a dictionary for every language+app tuple.
15 # The active translations are stored by threadid to make them thread local.
16 _translations = {}