From 8424ea39f81bb23d4386db442dbac4f7630555a2 Mon Sep 17 00:00:00 2001 From: Malcolm Tredinnick Date: Thu, 5 Apr 2007 03:22:49 +0000 Subject: [PATCH] Fixed #3918 -- Handle technical message IDs correctly when settings.USE_I18N is False. git-svn-id: http://code.djangoproject.com/svn/django/trunk@4931 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/utils/translation/trans_null.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/django/utils/translation/trans_null.py b/django/utils/translation/trans_null.py index 75ad573357..2ee09483e1 100644 --- a/django/utils/translation/trans_null.py +++ b/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 @@ get_date_formats = lambda: (settings.DATE_FORMAT, settings.DATETIME_FORMAT, sett 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: