diff --git a/arrow/constants.py b/arrow/constants.py index 53be6e8c..3fb00c12 100644 --- a/arrow/constants.py +++ b/arrow/constants.py @@ -130,6 +130,8 @@ "or-in", "lb", "lb-lu", + "sq", + "sq-al", "ta", "ta-in", "ta-lk", diff --git a/arrow/locales.py b/arrow/locales.py index 615217ce..e006fe75 100644 --- a/arrow/locales.py +++ b/arrow/locales.py @@ -5528,3 +5528,84 @@ def _ordinal_number(self, n: int) -> str: return f"{n}ஆம்" else: return "" + + +class AlbanianLocale(Locale): + + names = ["sq", "sq-al"] + + past = "{0} më parë" + future = "në {0}" + and_word = "dhe" + + timeframes = { + "now": "tani", + "second": "sekondë", + "seconds": "{0} sekonda", + "minute": "minutë", + "minutes": "{0} minuta", + "hour": "orë", + "hours": "{0} orë", + "day": "ditë", + "days": "{0} ditë", + "week": "javë", + "weeks": "{0} javë", + "month": "muaj", + "months": "{0} muaj", + "year": "vit", + "years": "{0} vjet", + } + + month_names = [ + "", + "janar", + "shkurt", + "mars", + "prill", + "maj", + "qershor", + "korrik", + "gusht", + "shtator", + "tetor", + "nëntor", + "dhjetor", + ] + + month_abbreviations = [ + "", + "jan", + "shk", + "mar", + "pri", + "maj", + "qer", + "korr", + "gush", + "sht", + "tet", + "nën", + "dhj", + ] + + day_names = [ + "", + "e hënë", + "e martë", + "e mërkurë", + "e enjte", + "e premte", + "e shtunë", + "e diel", + ] + + day_abbreviations = [ + "", + "hën", + "mar", + "mër", + "enj", + "pre", + "sht", + "die", + ] diff --git a/tests/test_arrow.py b/tests/test_arrow.py index cef9ee6d..096b9701 100644 --- a/tests/test_arrow.py +++ b/tests/test_arrow.py @@ -2407,6 +2407,8 @@ def locale_list_no_weeks(): "se-se", "lb", "lb-lu", + "sq", + "sq-al", "ta", "ta-in", "ta-lk", diff --git a/tests/test_locales.py b/tests/test_locales.py index bc02df3a..072f2ce1 100644 --- a/tests/test_locales.py +++ b/tests/test_locales.py @@ -1383,6 +1383,36 @@ def test_weekday(self): assert self.locale.day_name(dt.isoweekday()) == "uMgqibelo" +@pytest.mark.usefixtures("lang_locale") +class TestAlbanianLocale: + def test_format_timeframe(self): + assert self.locale._format_timeframe("now", 0) == "tani" + assert self.locale._format_timeframe("second", -1) == "sekondë" + assert self.locale._format_timeframe("second", 1) == "sekondë" + assert self.locale._format_timeframe("seconds", -3) == "3 sekonda" + assert self.locale._format_timeframe("minute", 1) == "minutë" + assert self.locale._format_timeframe("minutes", -4) == "4 minuta" + assert self.locale._format_timeframe("hour", 1) == "orë" + assert self.locale._format_timeframe("hours", -23) == "23 orë" + assert self.locale._format_timeframe("day", 1) == "ditë" + assert self.locale._format_timeframe("days", -12) == "12 ditë" + assert self.locale._format_timeframe("week", 1) == "javë" + assert self.locale._format_timeframe("weeks", -12) == "12 javë" + assert self.locale._format_timeframe("month", 1) == "muaj" + assert self.locale._format_timeframe("months", -2) == "2 muaj" + assert self.locale._format_timeframe("year", 1) == "vit" + assert self.locale._format_timeframe("years", -2) == "2 vjet" + + def test_weekday_and_month(self): + dt = arrow.Arrow(2015, 4, 11, 17, 30, 00) + # Saturday + assert self.locale.day_name(dt.isoweekday()) == "e shtunë" + assert self.locale.day_abbreviation(dt.isoweekday()) == "sht" + # June + assert self.locale.month_name(dt.isoweekday()) == "qershor" + assert self.locale.month_abbreviation(dt.isoweekday()) == "qer" + + @pytest.mark.usefixtures("lang_locale") class TestEstonianLocale: def test_format_timeframe(self):