Fixed #33661 -- Corrected Catalan date-format localization.

Changed DATE_FORMAT, DATETIME_FORMAT and MONTH_DAY_FORMAT
to use E placeholder (Month, locale specific alternative)
to handle both “de gener” and contracted “d’abril” cases.

Thanks to Ferran Jovell for review.
This commit is contained in:
mpachas 2022-04-28 15:12:15 +02:00 committed by Carlton Gibson
parent ce586ed693
commit aa28c392b9
4 changed files with 19 additions and 16 deletions

View File

@ -1071,51 +1071,51 @@ msgstr "Des."
msgctxt "alt. month" msgctxt "alt. month"
msgid "January" msgid "January"
msgstr "gener" msgstr "de gener"
msgctxt "alt. month" msgctxt "alt. month"
msgid "February" msgid "February"
msgstr "febrer" msgstr "de febrer"
msgctxt "alt. month" msgctxt "alt. month"
msgid "March" msgid "March"
msgstr "març" msgstr "de març"
msgctxt "alt. month" msgctxt "alt. month"
msgid "April" msgid "April"
msgstr "abril" msgstr "d'abril"
msgctxt "alt. month" msgctxt "alt. month"
msgid "May" msgid "May"
msgstr "maig" msgstr "de maig"
msgctxt "alt. month" msgctxt "alt. month"
msgid "June" msgid "June"
msgstr "juny" msgstr "de juny"
msgctxt "alt. month" msgctxt "alt. month"
msgid "July" msgid "July"
msgstr "juliol" msgstr "de juliol"
msgctxt "alt. month" msgctxt "alt. month"
msgid "August" msgid "August"
msgstr "agost" msgstr "d'agost"
msgctxt "alt. month" msgctxt "alt. month"
msgid "September" msgid "September"
msgstr "setembre" msgstr "de setembre"
msgctxt "alt. month" msgctxt "alt. month"
msgid "October" msgid "October"
msgstr "octubre" msgstr "d'octubre"
msgctxt "alt. month" msgctxt "alt. month"
msgid "November" msgid "November"
msgstr "novembre" msgstr "de novembre"
msgctxt "alt. month" msgctxt "alt. month"
msgid "December" msgid "December"
msgstr "desembre" msgstr "de desembre"
msgid "This is not a valid IPv6 address." msgid "This is not a valid IPv6 address."
msgstr "Aquesta no és una adreça IPv6 vàlida." msgstr "Aquesta no és una adreça IPv6 vàlida."

View File

@ -2,11 +2,11 @@
# #
# The *_FORMAT strings use the Django date format syntax, # The *_FORMAT strings use the Django date format syntax,
# see https://docs.djangoproject.com/en/dev/ref/templates/builtins/#date # see https://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = r"j \d\e F \d\e Y" DATE_FORMAT = r"j E \d\e Y"
TIME_FORMAT = "G:i" TIME_FORMAT = "G:i"
DATETIME_FORMAT = r"j \d\e F \d\e Y \a \l\e\s G:i" DATETIME_FORMAT = r"j E \d\e Y \a \l\e\s G:i"
YEAR_MONTH_FORMAT = r"F \d\e\l Y" YEAR_MONTH_FORMAT = r"F \d\e\l Y"
MONTH_DAY_FORMAT = r"j \d\e F" MONTH_DAY_FORMAT = r"j E"
SHORT_DATE_FORMAT = "d/m/Y" SHORT_DATE_FORMAT = "d/m/Y"
SHORT_DATETIME_FORMAT = "d/m/Y G:i" SHORT_DATETIME_FORMAT = "d/m/Y G:i"
FIRST_DAY_OF_WEEK = 1 # Monday FIRST_DAY_OF_WEEK = 1 # Monday

View File

@ -865,11 +865,14 @@ class FormattingTests(SimpleTestCase):
self.maxDiff = 3000 self.maxDiff = 3000
# Catalan locale # Catalan locale
with translation.override("ca", deactivate=True): with translation.override("ca", deactivate=True):
self.assertEqual(r"j \d\e F \d\e Y", get_format("DATE_FORMAT")) self.assertEqual(r"j E \d\e Y", get_format("DATE_FORMAT"))
self.assertEqual(1, get_format("FIRST_DAY_OF_WEEK")) self.assertEqual(1, get_format("FIRST_DAY_OF_WEEK"))
self.assertEqual(",", get_format("DECIMAL_SEPARATOR")) self.assertEqual(",", get_format("DECIMAL_SEPARATOR"))
self.assertEqual("10:15", time_format(self.t)) self.assertEqual("10:15", time_format(self.t))
self.assertEqual("31 de desembre de 2009", date_format(self.d)) self.assertEqual("31 de desembre de 2009", date_format(self.d))
self.assertEqual(
"1 d'abril de 2009", date_format(datetime.date(2009, 4, 1))
)
self.assertEqual( self.assertEqual(
"desembre del 2009", date_format(self.d, "YEAR_MONTH_FORMAT") "desembre del 2009", date_format(self.d, "YEAR_MONTH_FORMAT")
) )