Ticket #2062: partial_date_formats.diff

File partial_date_formats.diff, 2.1 KB (added by Ramiro Morales, 18 years ago)

Patch w/o the conf/locale/en/LC_MESSAGES/django.po changes

  • django/conf/global_settings.py

    diff -ruN dj-date-formats-base/django/conf/global_settings.py dj-date-formats/django/conf/global_settings.py
    old new  
    203203# http://www.djangoproject.com/documentation/templates/#now
    204204TIME_FORMAT = 'P'
    205205
     206# Default formatting for time objects when only the year and month are relevant.
     207# See all available format strings here:
     208# http://www.djangoproject.com/documentation/templates/#now
     209YEAR_MONTH_FORMAT = 'F Y'
     210
     211# Default formatting for time objects when only the month and day are relevant.
     212# See all available format strings here:
     213# http://www.djangoproject.com/documentation/templates/#now
     214MONTH_DAY_FORMAT = 'F j'
     215
    206216# Whether to enable Psyco, which optimizes Python code. Requires Psyco.
    207217# http://psyco.sourceforge.net/
    208218ENABLE_PSYCO = False
  • django/utils/translation.py

    diff -ruN dj-date-formats-base/django/utils/translation.py dj-date-formats/django/utils/translation.py
    old new  
    371371        time_format = settings.TIME_FORMAT
    372372    return (date_format, datetime_format, time_format)
    373373
     374def get_partial_date_formats():
     375    """
     376    This function checks whether translation files provide a translation for some
     377    technical message ID to store partial date formats. If it doesn't contain
     378    one, the formats provided in the settings will be used.
     379    """
     380    from django.conf import settings
     381    year_month_format = _('YEAR_MONTH_FORMAT')
     382    month_day_format = _('MONTH_DAY_FORMAT')
     383    if year_month_format == 'YEAR_MONTH_FORMAT':
     384        year_month_format = settings.YEAR_MONTH_FORMAT
     385    if month_day_format == 'MONTH_DAY_FORMAT':
     386        month_day_format = settings.MONTH_DAY_FORMAT
     387    return (year_month_format, month_day_format)
     388
    374389def install():
    375390    """
    376391    Installs the gettext function as the default translation function under
Back to Top