Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added week and quarter to persian/farsi #1190

Merged
merged 7 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 ماه"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing tests for quarters, otherwise 👍

assert self.locale._format_timeframe("years", 2) == "2 سال"


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