summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUnai Loidi <uloidi@codesyntax.eus>2025-10-22 12:22:47 +0200
committernessita <124304+nessita@users.noreply.github.com>2026-03-06 18:25:16 -0300
commit07c38764db1ba6a39ff0b3b224288e13c304f1c9 (patch)
tree4074f18cb17818b4fabc25d69d2fa790852afe42
parentc27d368b92f321e6f91704f554dccbc18df5b075 (diff)
Fixed #36679 -- Fixed Basque date formats to use parenthetical declension suffixes.
Basque (eu) grammar requires conditional suffixes on years and day articles that depend on the final sound of the preceding word. Since Django's format strings are static, the CLDR parenthetical convention ("(e)ko" instead of "ko") is used to express the optionality. Co-authored-by: Natalia <124304+nessita@users.noreply.github.com>
-rw-r--r--django/conf/locale/eu/formats.py6
-rw-r--r--tests/i18n/tests.py20
2 files changed, 23 insertions, 3 deletions
diff --git a/django/conf/locale/eu/formats.py b/django/conf/locale/eu/formats.py
index 61b16fbc6f..e707f931c7 100644
--- a/django/conf/locale/eu/formats.py
+++ b/django/conf/locale/eu/formats.py
@@ -2,10 +2,10 @@
#
# The *_FORMAT strings use the Django date format syntax,
# see https://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
-DATE_FORMAT = r"Y\k\o N j\a"
+DATE_FORMAT = r"Y(\e)\k\o N\k j"
TIME_FORMAT = "H:i"
-DATETIME_FORMAT = r"Y\k\o N j\a, H:i"
-YEAR_MONTH_FORMAT = r"Y\k\o F"
+DATETIME_FORMAT = r"Y(\e)\k\o N\k j, H:i"
+YEAR_MONTH_FORMAT = r"Y(\e)\k\o F"
MONTH_DAY_FORMAT = r"F\r\e\n j\a"
SHORT_DATE_FORMAT = "Y-m-d"
SHORT_DATETIME_FORMAT = "Y-m-d H:i"
diff --git a/tests/i18n/tests.py b/tests/i18n/tests.py
index e593d97cba..91e7c95f67 100644
--- a/tests/i18n/tests.py
+++ b/tests/i18n/tests.py
@@ -1179,6 +1179,26 @@ class FormattingTests(SimpleTestCase):
with translation.override(locale, deactivate=True):
self.assertEqual(expected, format_function(*format_args))
+ def test_basque_date_formats(self):
+ # Basque locale uses parenthetical suffixes for conditional declension:
+ # (e)ko for years and declined month/day forms.
+ with translation.override("eu", deactivate=True):
+ self.assertEqual(date_format(self.d), "2009(e)ko abe.k 31")
+ self.assertEqual(
+ date_format(self.dt, "DATETIME_FORMAT"),
+ "2009(e)ko abe.k 31, 20:50",
+ )
+ self.assertEqual(
+ date_format(self.d, "YEAR_MONTH_FORMAT"), "2009(e)ko abendua"
+ )
+ self.assertEqual(date_format(self.d, "MONTH_DAY_FORMAT"), "abenduaren 31a")
+ # Day 11 (hamaika in Basque) ends in 'a' as a word, but the
+ # numeral form does not, so appending 'a' is correct here.
+ self.assertEqual(
+ date_format(datetime.date(2009, 12, 11), "MONTH_DAY_FORMAT"),
+ "abenduaren 11a",
+ )
+
def test_sub_locales(self):
"""
Check if sublocales fall back to the main locale