Ticket #6693: datetime-i18n.3.diff

File datetime-i18n.3.diff, 8.0 KB (added by Petr Marhoun <petr.marhoun@…>, 17 years ago)

patch which dont' change po files

  • django/conf/global_settings.py

    === modified file 'django/conf/global_settings.py'
     
    226226
    227227# Default formatting for date objects. See all available format strings here:
    228228# http://www.djangoproject.com/documentation/templates/#now
    229 DATE_FORMAT = 'N j, Y'
     229DATE_FORMAT = gettext_noop('N j, Y')
    230230
    231231# Default formatting for datetime objects. See all available format strings here:
    232232# http://www.djangoproject.com/documentation/templates/#now
    233 DATETIME_FORMAT = 'N j, Y, P'
     233DATETIME_FORMAT = gettext_noop('N j, Y, P')
    234234
    235235# Default formatting for time objects. See all available format strings here:
    236236# http://www.djangoproject.com/documentation/templates/#now
    237 TIME_FORMAT = 'P'
     237TIME_FORMAT = gettext_noop('P')
    238238
    239239# Default formatting for date objects when only the year and month are relevant.
    240240# See all available format strings here:
    241241# http://www.djangoproject.com/documentation/templates/#now
    242 YEAR_MONTH_FORMAT = 'F Y'
     242YEAR_MONTH_FORMAT = gettext_noop('F Y')
    243243
    244244# Default formatting for date objects when only the month and day are relevant.
    245245# See all available format strings here:
    246246# http://www.djangoproject.com/documentation/templates/#now
    247 MONTH_DAY_FORMAT = 'F j'
     247MONTH_DAY_FORMAT = gettext_noop('F j')
    248248
    249249# Do you want to manage transactions manually?
    250250# Hint: you really don't!
  • django/contrib/admin/templatetags/admin_list.py

    === modified file 'django/contrib/admin/templatetags/admin_list.py'
     
    77from django.utils.html import escape, conditional_escape
    88from django.utils.text import capfirst
    99from django.utils.safestring import mark_safe
    10 from django.utils.translation import get_date_formats, get_partial_date_formats, ugettext as _
     10from django.utils.translation import ugettext as _
    1111from django.utils.encoding import smart_unicode, smart_str, force_unicode
    1212from django.template import Library
    1313import datetime
     
    161161            # Dates and times are special: They're formatted in a certain way.
    162162            elif isinstance(f, models.DateField) or isinstance(f, models.TimeField):
    163163                if field_val:
    164                     (date_format, datetime_format, time_format) = get_date_formats()
    165164                    if isinstance(f, models.DateTimeField):
    166                         result_repr = capfirst(dateformat.format(field_val, datetime_format))
     165                        result_repr = capfirst(dateformat.format(field_val, _(settings.DATETIME_FORMAT)))
    167166                    elif isinstance(f, models.TimeField):
    168                         result_repr = capfirst(dateformat.time_format(field_val, time_format))
     167                        result_repr = capfirst(dateformat.time_format(field_val, _(settings.TIME_FORMAT)))
    169168                    else:
    170                         result_repr = capfirst(dateformat.format(field_val, date_format))
     169                        result_repr = capfirst(dateformat.format(field_val, _(settings.DATE_FORMAT)))
    171170                else:
    172171                    result_repr = EMPTY_CHANGELIST_VALUE
    173172                row_class = ' class="nowrap"'
     
    221220        year_lookup = cl.params.get(year_field)
    222221        month_lookup = cl.params.get(month_field)
    223222        day_lookup = cl.params.get(day_field)
    224         year_month_format, month_day_format = get_partial_date_formats()
    225223
    226224        link = lambda d: mark_safe(cl.get_query_string(d, [field_generic]))
    227225
     
    231229                'show': True,
    232230                'back': {
    233231                    'link': link({year_field: year_lookup, month_field: month_lookup}),
    234                     'title': dateformat.format(day, year_month_format)
     232                    'title': dateformat.format(day, _(settings.YEAR_MONTH_FORMAT))
    235233                },
    236                 'choices': [{'title': dateformat.format(day, month_day_format)}]
     234                'choices': [{'title': dateformat.format(day, _(settings.MONTH_DAY_FORMAT))}]
    237235            }
    238236        elif year_lookup and month_lookup:
    239237            days = cl.query_set.filter(**{year_field: year_lookup, month_field: month_lookup}).dates(field_name, 'day')
     
    245243                },
    246244                'choices': [{
    247245                    'link': link({year_field: year_lookup, month_field: month_lookup, day_field: day.day}),
    248                     'title': dateformat.format(day, month_day_format)
     246                    'title': dateformat.format(day, _(settings.MONTH_DAY_FORMAT))
    249247                } for day in days]
    250248            }
    251249        elif year_lookup:
     
    258256                },
    259257                'choices': [{
    260258                    'link': link({year_field: year_lookup, month_field: month.month}),
    261                     'title': dateformat.format(month, year_month_format)
     259                    'title': dateformat.format(month, _(settings.YEAR_MONTH_FORMAT))
    262260                } for month in months]
    263261            }
    264262        else:
  • django/contrib/databrowse/datastructures.py

    === modified file 'django/contrib/databrowse/datastructures.py'
     
    33convenience functionality and permalink functions for the databrowse app.
    44"""
    55
     6from django.conf import settings
    67from django.db import models
    78from django.utils import dateformat
    89from django.utils.text import capfirst
    9 from django.utils.translation import get_date_formats
     10from django.utils.translation import ugettext as _
    1011from django.utils.encoding import smart_unicode, smart_str, iri_to_uri
    1112from django.utils.safestring import mark_safe
    1213from django.db.models.query import QuerySet
     
    156157            objs = dict(self.field.choices).get(self.raw_value, EMPTY_VALUE)
    157158        elif isinstance(self.field, models.DateField) or isinstance(self.field, models.TimeField):
    158159            if self.raw_value:
    159                 date_format, datetime_format, time_format = get_date_formats()
    160160                if isinstance(self.field, models.DateTimeField):
    161                     objs = capfirst(dateformat.format(self.raw_value, datetime_format))
     161                    objs = capfirst(dateformat.format(self.raw_value, _(settings.DATETIME_FORMAT)))
    162162                elif isinstance(self.field, models.TimeField):
    163                     objs = capfirst(dateformat.time_format(self.raw_value, time_format))
     163                    objs = capfirst(dateformat.time_format(self.raw_value, _(settings.TIME_FORMAT)))
    164164                else:
    165                     objs = capfirst(dateformat.format(self.raw_value, date_format))
     165                    objs = capfirst(dateformat.format(self.raw_value, _(settings.DATE_FORMAT)))
    166166            else:
    167167                objs = EMPTY_VALUE
    168168        elif isinstance(self.field, models.BooleanField) or isinstance(self.field, models.NullBooleanField):
  • django/contrib/databrowse/plugins/calendars.py

    === modified file 'django/contrib/databrowse/plugins/calendars.py'
     
    44from django.contrib.databrowse.sites import DatabrowsePlugin
    55from django.shortcuts import render_to_response
    66from django.utils.text import capfirst
    7 from django.utils.translation import get_date_formats
    87from django.utils.encoding import force_unicode
    98from django.utils.safestring import mark_safe
    109from django.views.generic import date_based
  • django/template/defaultfilters.py

    === modified file 'django/template/defaultfilters.py'
     
    620620    if not value:
    621621        return u''
    622622    if arg is None:
    623         arg = settings.DATE_FORMAT
     623        arg = ugettext(settings.DATE_FORMAT)
    624624    return format(value, arg)
    625625date.is_safe = False
    626626
     
    630630    if value in (None, u''):
    631631        return u''
    632632    if arg is None:
    633         arg = settings.TIME_FORMAT
     633        arg = ugettext(settings.TIME_FORMAT)
    634634    return time_format(value, arg)
    635635time.is_safe = False
    636636
Back to Top