summaryrefslogtreecommitdiff
path: root/django/utils
diff options
context:
space:
mode:
authorGeorg Bauer <gb@hugo.westfalen.de>2005-11-12 22:08:54 +0000
committerGeorg Bauer <gb@hugo.westfalen.de>2005-11-12 22:08:54 +0000
commitf3319e45e4aaceb9caaa5c5fe2a96fc6eac39884 (patch)
tree9dfeb555be8d8e289bc1bc33e24897a4275d6cf8 /django/utils
parent367ce0ce923d4efe114f65300d2f4668cf7fbd4d (diff)
fixes #109 - added translation possibilities for date and time formats (and updated translation files for the new message IDs)
git-svn-id: http://code.djangoproject.com/svn/django/trunk@1208 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/utils')
-rw-r--r--django/utils/translation.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/django/utils/translation.py b/django/utils/translation.py
index a58188e87f..426faaaff0 100644
--- a/django/utils/translation.py
+++ b/django/utils/translation.py
@@ -325,6 +325,24 @@ def get_language_from_request(request):
return settings.LANGUAGE_CODE
+def get_date_formats():
+ """
+ This function checks wether translation files provide a translation for some
+ technical message ID to store date and time formats. If it doesn't contain
+ one, the formats provided in the settings will be used.
+ """
+ from django.conf.settings import DATE_FORMAT, DATETIME_FORMAT, TIME_FORMAT
+ date_format = _('DATE_FORMAT')
+ datetime_format = _('DATETIME_FORMAT')
+ time_format = _('TIME_FORMAT')
+ if date_format == 'DATE_FORMAT':
+ date_format = DATE_FORMAT
+ if datetime_format == 'DATETIME_FORMAT':
+ datetime_format = DATETIME_FORMAT
+ if time_format == 'TIME_FORMAT':
+ time_format = TIME_FORMAT
+ return (date_format, datetime_format, time_format)
+
def install():
"""
Installs the gettext function as the default translation function under