Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #3918 -- Handle technical message IDs correctly when settings.U…

…SE_I18N is

False.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@4931 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 8424ea39f81bb23d4386db442dbac4f7630555a2 1 parent b30c505
@malcolmt malcolmt authored
Showing with 14 additions and 1 deletion.
  1. +14 −1 django/utils/translation/trans_null.py
View
15 django/utils/translation/trans_null.py
@@ -9,7 +9,6 @@ def ngettext(singular, plural, number):
return plural
ngettext_lazy = ngettext
-gettext = gettext_noop = gettext_lazy = _ = lambda x: x
string_concat = lambda *strings: ''.join([str(el) for el in strings])
activate = lambda x: None
deactivate = install = lambda: None
@@ -19,6 +18,20 @@ def ngettext(singular, plural, number):
get_partial_date_formats = lambda: (settings.YEAR_MONTH_FORMAT, settings.MONTH_DAY_FORMAT)
check_for_language = lambda x: True
+TECHNICAL_ID_MAP = {
+ "DATE_WITH_TIME_FULL": settings.DATETIME_FORMAT,
+ "DATE_FORMAT": settings.DATE_FORMAT,
+ "DATETIME_FORMAT": settings.DATETIME_FORMAT,
+ "TIME_FORMAT": settings.TIME_FORMAT,
+ "YEAR_MONTH_FORMAT": settings.YEAR_MONTH_FORMAT,
+ "MONTH_DAY_FORMAT": settings.MONTH_DAY_FORMAT,
+}
+
+def gettext(message):
+ return TECHNICAL_ID_MAP.get(message, message)
+
+gettext_noop = gettext_lazy = gettext
+
def to_locale(language):
p = language.find('-')
if p >= 0:
Please sign in to comment.
Something went wrong with that request. Please try again.