From aa28c392b9491f02330905cb73b7078b1cd18c60 Mon Sep 17 00:00:00 2001 From: mpachas Date: Thu, 28 Apr 2022 15:12:15 +0200 Subject: [PATCH] Fixed #33661 -- Corrected Catalan date-format localization. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- django/conf/locale/ca/LC_MESSAGES/django.mo | Bin 27427 -> 27460 bytes django/conf/locale/ca/LC_MESSAGES/django.po | 24 ++++++++++---------- django/conf/locale/ca/formats.py | 6 ++--- tests/i18n/tests.py | 5 +++- 4 files changed, 19 insertions(+), 16 deletions(-) diff --git a/django/conf/locale/ca/LC_MESSAGES/django.mo b/django/conf/locale/ca/LC_MESSAGES/django.mo index ca8826b7227f610561edac5101493fc4c6af2db1..93ad20548216fcf8963a34bac94afa7438866dc0 100644 GIT binary patch delta 511 zcmXZWJxjw-6vpurtZx)`5W8AjI{LQh;>!onP2EiGO-!3Mkfwr2?c@h=b`&fkh)@uh zE-JVb1%EjbJw}+Pd7$IWZ4t3u3{QDaU8dB4EHqW z(awe1Pc+xj?wz6CJJ)=H4!MabyjE}3mM4w>4-eXCtB>jn4zu{Gxr6pXZ#aTI?SH7B zXn**n`CI+L3Hra7!L%o%M{59#~;vg=%h$0H6n#9yJfiw{uB%6rfQV^FSh)@R? zrQjwV6c-oiP#4Eef^P19Uvm)d^FEh5-uIk diff --git a/django/conf/locale/ca/LC_MESSAGES/django.po b/django/conf/locale/ca/LC_MESSAGES/django.po index d315fd5024..4798a87600 100644 --- a/django/conf/locale/ca/LC_MESSAGES/django.po +++ b/django/conf/locale/ca/LC_MESSAGES/django.po @@ -1071,51 +1071,51 @@ msgstr "Des." msgctxt "alt. month" msgid "January" -msgstr "gener" +msgstr "de gener" msgctxt "alt. month" msgid "February" -msgstr "febrer" +msgstr "de febrer" msgctxt "alt. month" msgid "March" -msgstr "març" +msgstr "de març" msgctxt "alt. month" msgid "April" -msgstr "abril" +msgstr "d'abril" msgctxt "alt. month" msgid "May" -msgstr "maig" +msgstr "de maig" msgctxt "alt. month" msgid "June" -msgstr "juny" +msgstr "de juny" msgctxt "alt. month" msgid "July" -msgstr "juliol" +msgstr "de juliol" msgctxt "alt. month" msgid "August" -msgstr "agost" +msgstr "d'agost" msgctxt "alt. month" msgid "September" -msgstr "setembre" +msgstr "de setembre" msgctxt "alt. month" msgid "October" -msgstr "octubre" +msgstr "d'octubre" msgctxt "alt. month" msgid "November" -msgstr "novembre" +msgstr "de novembre" msgctxt "alt. month" msgid "December" -msgstr "desembre" +msgstr "de desembre" msgid "This is not a valid IPv6 address." msgstr "Aquesta no és una adreça IPv6 vàlida." diff --git a/django/conf/locale/ca/formats.py b/django/conf/locale/ca/formats.py index 2f91009119..e6162990d1 100644 --- a/django/conf/locale/ca/formats.py +++ b/django/conf/locale/ca/formats.py @@ -2,11 +2,11 @@ # # The *_FORMAT strings use the Django date format syntax, # 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" -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" -MONTH_DAY_FORMAT = r"j \d\e F" +MONTH_DAY_FORMAT = r"j E" SHORT_DATE_FORMAT = "d/m/Y" SHORT_DATETIME_FORMAT = "d/m/Y G:i" FIRST_DAY_OF_WEEK = 1 # Monday diff --git a/tests/i18n/tests.py b/tests/i18n/tests.py index 45f0ea9a9b..a25f6bcd9e 100644 --- a/tests/i18n/tests.py +++ b/tests/i18n/tests.py @@ -865,11 +865,14 @@ class FormattingTests(SimpleTestCase): self.maxDiff = 3000 # Catalan locale 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(",", get_format("DECIMAL_SEPARATOR")) self.assertEqual("10:15", time_format(self.t)) 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( "desembre del 2009", date_format(self.d, "YEAR_MONTH_FORMAT") )