[2.0.x] Fixed #28710 -- Fixed the Basque DATE_FORMAT string
Thanks Eneko Illarramendi for the report and initial patch.
Backport of 8c538871bd
from master.
This commit is contained in:
parent
73d025a042
commit
5595eccd4f
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# The *_FORMAT strings use the Django date format syntax,
|
||||
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
|
||||
DATE_FORMAT = r'Yeko M\re\n d\a'
|
||||
DATE_FORMAT = r'Y\k\o N j\a'
|
||||
TIME_FORMAT = 'H:i'
|
||||
# DATETIME_FORMAT =
|
||||
# YEAR_MONTH_FORMAT =
|
||||
|
|
|
@ -11,3 +11,5 @@ Bugfixes
|
|||
|
||||
* Prevented ``cache.get_or_set()`` from caching ``None`` if the ``default``
|
||||
argument is a callable that returns ``None`` (:ticket:`28601`).
|
||||
|
||||
* Fixed the Basque ``DATE_FORMAT`` string (:ticket:`28710`).
|
||||
|
|
|
@ -9,6 +9,7 @@ from threading import local
|
|||
|
||||
from django import forms
|
||||
from django.conf import settings
|
||||
from django.conf.locale import LANG_INFO
|
||||
from django.conf.urls.i18n import i18n_patterns
|
||||
from django.template import Context, Template
|
||||
from django.test import (
|
||||
|
@ -335,6 +336,23 @@ class FormattingTests(SimpleTestCase):
|
|||
'l': self.long,
|
||||
})
|
||||
|
||||
def test_all_format_strings(self):
|
||||
all_locales = LANG_INFO.keys()
|
||||
today = datetime.date.today()
|
||||
now = datetime.datetime.now()
|
||||
current_year = str(today.year)
|
||||
current_day = str(today.day)
|
||||
current_minute = str(now.minute)
|
||||
for locale in all_locales:
|
||||
with self.subTest(locale=locale), translation.override(locale):
|
||||
self.assertIn(current_year, date_format(today)) # Uses DATE_FORMAT by default
|
||||
self.assertIn(current_minute, time_format(now)) # Uses TIME_FORMAT by default
|
||||
self.assertIn(current_year, date_format(now, format=get_format('DATETIME_FORMAT')))
|
||||
self.assertIn(current_year, date_format(today, format=get_format('YEAR_MONTH_FORMAT')))
|
||||
self.assertIn(current_day, date_format(today, format=get_format('MONTH_DAY_FORMAT')))
|
||||
self.assertIn(current_year, date_format(today, format=get_format('SHORT_DATE_FORMAT')))
|
||||
self.assertIn(current_year, date_format(now, format=get_format('SHORT_DATETIME_FORMAT')))
|
||||
|
||||
def test_locale_independent(self):
|
||||
"""
|
||||
Localization of numbers
|
||||
|
|
Loading…
Reference in New Issue