Skip to content

Commit 016fb9e

Browse files
fouladiFarhad Fouladijadchaar
authored
fix: adding persian names of months and month-abbreviations and day-abbreviations in Gregorian calendar (#1172)
* fix: adding persian names of months in Gregorian calendar * test: running all tests * test: add tests for weekdays in farsi * test: add 2 more tests for month-name and mont-abbr. --------- Co-authored-by: Farhad Fouladi <[email protected]> Co-authored-by: Jad Chaar <[email protected]>
1 parent c2dfa12 commit 016fb9e

File tree

2 files changed

+41
-25
lines changed

2 files changed

+41
-25
lines changed

arrow/locales.py

+34-25
Original file line numberDiff line numberDiff line change
@@ -3389,33 +3389,33 @@ class FarsiLocale(Locale):
33893389

33903390
month_names = [
33913391
"",
3392-
"January",
3393-
"February",
3394-
"March",
3395-
"April",
3396-
"May",
3397-
"June",
3398-
"July",
3399-
"August",
3400-
"September",
3401-
"October",
3402-
"November",
3403-
"December",
3392+
"ژانویه",
3393+
"فوریه",
3394+
"مارس",
3395+
"آوریل",
3396+
"مه",
3397+
"ژوئن",
3398+
"ژوئیه",
3399+
"اوت",
3400+
"سپتامبر",
3401+
"اکتبر",
3402+
"نوامبر",
3403+
"دسامبر",
34043404
]
34053405
month_abbreviations = [
34063406
"",
3407-
"Jan",
3408-
"Feb",
3409-
"Mar",
3410-
"Apr",
3411-
"May",
3412-
"Jun",
3413-
"Jul",
3414-
"Aug",
3415-
"Sep",
3416-
"Oct",
3417-
"Nov",
3418-
"Dec",
3407+
"ژانویه",
3408+
"فوریه",
3409+
"مارس",
3410+
"آوریل",
3411+
"مه",
3412+
"ژوئن",
3413+
"ژوئیه",
3414+
"اوت",
3415+
"سپتامبر",
3416+
"اکتبر",
3417+
"نوامبر",
3418+
"دسامبر",
34193419
]
34203420

34213421
day_names = [
@@ -3428,7 +3428,16 @@ class FarsiLocale(Locale):
34283428
"شنبه",
34293429
"یکشنبه",
34303430
]
3431-
day_abbreviations = ["", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]
3431+
day_abbreviations = [
3432+
"",
3433+
"دو شنبه",
3434+
"سه شنبه",
3435+
"چهارشنبه",
3436+
"پنجشنبه",
3437+
"جمعه",
3438+
"شنبه",
3439+
"یکشنبه",
3440+
]
34323441

34333442

34343443
class HebrewLocale(Locale):

tests/test_locales.py

+7
Original file line numberDiff line numberDiff line change
@@ -1463,6 +1463,13 @@ def test_timeframes(self):
14631463
assert self.locale._format_timeframe("months", 2) == "2 ماه"
14641464
assert self.locale._format_timeframe("years", 2) == "2 سال"
14651465

1466+
def test_weekday(self):
1467+
fa = arrow.Arrow(2024, 10, 25, 17, 30, 00)
1468+
assert self.locale.day_name(fa.isoweekday()) == "جمعه"
1469+
assert self.locale.day_abbreviation(fa.isoweekday()) == "جمعه"
1470+
assert self.locale.month_name(fa.month) == "اکتبر"
1471+
assert self.locale.month_abbreviation(fa.month) == "اکتبر"
1472+
14661473

14671474
@pytest.mark.usefixtures("lang_locale")
14681475
class TestNepaliLocale:

0 commit comments

Comments
 (0)