Skip to content

Commit

Permalink
added week and quarter to persian/farsi (arrow-py#1190)
Browse files Browse the repository at this point in the history
  • Loading branch information
Crimson-Amir authored Oct 22, 2024
1 parent d5bd7db commit c78e35e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
4 changes: 4 additions & 0 deletions arrow/locales.py
Original file line number Diff line number Diff line change
Expand Up @@ -3318,6 +3318,10 @@ class FarsiLocale(Locale):
"hours": "{0} ساعت",
"day": "یک روز",
"days": "{0} روز",
"week": "یک هفته",
"weeks": "{0} هفته",
"quarter": "یک فصل",
"quarters": "{0} فصل",
"month": "یک ماه",
"months": "{0} ماه",
"year": "یک سال",
Expand Down
21 changes: 21 additions & 0 deletions tests/test_locales.py
Original file line number Diff line number Diff line change
Expand Up @@ -1443,6 +1443,27 @@ def test_timeframes(self):
assert self.locale._format_timeframe("years", 115) == "115 سنة"


@pytest.mark.usefixtures("lang_locale")
class TestFarsiLocale:
def test_timeframes(self):
assert self.locale._format_timeframe("now", 0) == "اکنون"
# single
assert self.locale._format_timeframe("minute", 1) == "یک دقیقه"
assert self.locale._format_timeframe("hour", 1) == "یک ساعت"
assert self.locale._format_timeframe("day", 1) == "یک روز"
assert self.locale._format_timeframe("week", 1) == "یک هفته"
assert self.locale._format_timeframe("month", 1) == "یک ماه"
assert self.locale._format_timeframe("year", 1) == "یک سال"

# double
assert self.locale._format_timeframe("minutes", 2) == "2 دقیقه"
assert self.locale._format_timeframe("hours", 2) == "2 ساعت"
assert self.locale._format_timeframe("days", 2) == "2 روز"
assert self.locale._format_timeframe("weeks", 2) == "2 هفته"
assert self.locale._format_timeframe("months", 2) == "2 ماه"
assert self.locale._format_timeframe("years", 2) == "2 سال"


@pytest.mark.usefixtures("lang_locale")
class TestNepaliLocale:
def test_format_timeframe(self):
Expand Down

0 comments on commit c78e35e

Please sign in to comment.