From c78e35e8ee31c6f828638e147459447eb00f273c Mon Sep 17 00:00:00 2001 From: Amir <140071494+Crimson-Amir@users.noreply.github.com> Date: Tue, 22 Oct 2024 09:23:15 +0330 Subject: [PATCH] added week and quarter to persian/farsi (#1190) --- arrow/locales.py | 4 ++++ tests/test_locales.py | 21 +++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/arrow/locales.py b/arrow/locales.py index 7f91b565..94f7902d 100644 --- a/arrow/locales.py +++ b/arrow/locales.py @@ -3318,6 +3318,10 @@ class FarsiLocale(Locale): "hours": "{0} ساعت", "day": "یک روز", "days": "{0} روز", + "week": "یک هفته", + "weeks": "{0} هفته", + "quarter": "یک فصل", + "quarters": "{0} فصل", "month": "یک ماه", "months": "{0} ماه", "year": "یک سال", diff --git a/tests/test_locales.py b/tests/test_locales.py index f58eb221..3eff7f44 100644 --- a/tests/test_locales.py +++ b/tests/test_locales.py @@ -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):