From 4a50a989da075c65262949e0bd340225acec49f9 Mon Sep 17 00:00:00 2001 From: Farhad Fouladi Date: Wed, 17 Apr 2024 10:13:10 +0200 Subject: [PATCH 1/4] fix: adding persian names of months in Gregorian calendar --- arrow/locales.py | 50 ++++++++++++++++++++++++------------------------ 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/arrow/locales.py b/arrow/locales.py index 34b2a098..50ad6ff8 100644 --- a/arrow/locales.py +++ b/arrow/locales.py @@ -3339,33 +3339,33 @@ class FarsiLocale(Locale): month_names = [ "", - "January", - "February", - "March", - "April", - "May", - "June", - "July", - "August", - "September", - "October", - "November", - "December", + "ژانویه", + "فوریه", + "مارس", + "آوریل", + "مه", + "ژوئن", + "ژوئیه", + "اوت", + "سپتامبر", + "اکتبر", + "نوامبر", + "دسامبر", ] month_abbreviations = [ "", - "Jan", - "Feb", - "Mar", - "Apr", - "May", - "Jun", - "Jul", - "Aug", - "Sep", - "Oct", - "Nov", - "Dec", + "ژانویه", + "فوریه", + "مارس", + "آوریل", + "مه", + "ژوئن", + "ژوئیه", + "اوت", + "سپتامبر", + "اکتبر", + "نوامبر", + "دسامبر", ] day_names = [ @@ -3378,7 +3378,7 @@ class FarsiLocale(Locale): "شنبه", "یکشنبه", ] - day_abbreviations = ["", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"] + day_abbreviations = ["", "دو شنبه", "سه شنبه", "چهارشنبه", "پنجشنبه", "جمعه", "شنبه", "یکشنبه"] class HebrewLocale(Locale): From ab1ff6281334716867f856b31f1d09d7f6e4fe5b Mon Sep 17 00:00:00 2001 From: Farhad Fouladi Date: Wed, 17 Apr 2024 10:43:08 +0200 Subject: [PATCH 2/4] test: running all tests --- arrow/locales.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/arrow/locales.py b/arrow/locales.py index 50ad6ff8..260145a9 100644 --- a/arrow/locales.py +++ b/arrow/locales.py @@ -3378,7 +3378,16 @@ class FarsiLocale(Locale): "شنبه", "یکشنبه", ] - day_abbreviations = ["", "دو شنبه", "سه شنبه", "چهارشنبه", "پنجشنبه", "جمعه", "شنبه", "یکشنبه"] + day_abbreviations = [ + "", + "دو شنبه", + "سه شنبه", + "چهارشنبه", + "پنجشنبه", + "جمعه", + "شنبه", + "یکشنبه", + ] class HebrewLocale(Locale): From ee2926c4bfac64ef77cccc46c1fc3c14272bee98 Mon Sep 17 00:00:00 2001 From: Farhad Fouladi Date: Fri, 25 Oct 2024 11:56:30 +0200 Subject: [PATCH 3/4] test: add tests for weekdays in farsi --- tests/test_locales.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/test_locales.py b/tests/test_locales.py index 3eff7f44..d722689e 100644 --- a/tests/test_locales.py +++ b/tests/test_locales.py @@ -1463,6 +1463,11 @@ def test_timeframes(self): assert self.locale._format_timeframe("months", 2) == "2 ماه" assert self.locale._format_timeframe("years", 2) == "2 سال" + def test_weekday(self): + fa = arrow.Arrow(2024, 10, 25, 17, 30, 00) + assert self.locale.day_name(fa.isoweekday()) == "جمعه" + assert self.locale.day_abbreviation(fa.isoweekday()) == "جمعه" + @pytest.mark.usefixtures("lang_locale") class TestNepaliLocale: From cd6db81987485f31e419390c04101d487bdc6876 Mon Sep 17 00:00:00 2001 From: Farhad Fouladi Date: Fri, 25 Oct 2024 16:18:40 +0200 Subject: [PATCH 4/4] test: add 2 more tests for month-name and mont-abbr. --- tests/test_locales.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/test_locales.py b/tests/test_locales.py index d722689e..b1916ae0 100644 --- a/tests/test_locales.py +++ b/tests/test_locales.py @@ -1467,6 +1467,8 @@ def test_weekday(self): fa = arrow.Arrow(2024, 10, 25, 17, 30, 00) assert self.locale.day_name(fa.isoweekday()) == "جمعه" assert self.locale.day_abbreviation(fa.isoweekday()) == "جمعه" + assert self.locale.month_name(fa.month) == "اکتبر" + assert self.locale.month_abbreviation(fa.month) == "اکتبر" @pytest.mark.usefixtures("lang_locale")