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
This commit is contained in:
Malcolm Tredinnick 2007-04-05 03:22:49 +00:00
parent b30c505d0d
commit 8424ea39f8
1 changed files with 14 additions and 1 deletions

View File

@ -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: