Skip to content
Open
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
72 changes: 72 additions & 0 deletions arrow/locales.py
Original file line number Diff line number Diff line change
Expand Up @@ -6652,3 +6652,75 @@ class UzbekLocale(Locale):
]

day_abbreviations = ["", "Dush", "Sesh", "Chor", "Pay", "Jum", "Shan", "Yak"]


class IrishGaelicLocale(Locale):
names = ["ga", "ga-ie"]

past = "{0} ó shin"
future = "i gceann {0}"

timeframes = {
"now": "anois",
"second": "soicind",
"seconds": "{0} soicind",
"minute": "nóiméad",
"minutes": "{0} nóiméad",
"hour": "uair an chloig",
"hours": "{0} uair an chloig",
"day": "lá",
"days": "{0} lá",
"week": "seachtain",
"weeks": "{0} seachtain",
"month": "mí",
"months": "{0} mí",
"quarter": "ráithe",
"quarters": "{0} ráithe",
"year": "bliain",
"years": "{0} bliain",
}

month_names = [
"",
"Eanáir",
"Feabhra",
"Márta",
"Aibreán",
"Bealtaine",
"Meitheamh",
"Iúil",
"Lúnasa",
"Meán Fómhair",
"Deireadh Fómhair",
"Samhain",
"Nollaig",
]

month_abbreviations = [
"",
"Ean",
"Feabh",
"Már",
"Aib",
"Beal",
"Meith",
"Iúil",
"Lún",
"M.F.",
"D.F.",
"Samh",
"Noll",
]

day_names = [
"",
"Luan",
"Máirt",
"Céadaoin",
"Déardaoin",
"Aoine",
"Satharn",
"Domhnach",
]

day_abbreviations = ["", "Lua", "Mái", "Céa", "Déa", "Aoi", "Sat", "Dom"]
44 changes: 44 additions & 0 deletions tests/test_locales.py
Original file line number Diff line number Diff line change
Expand Up @@ -3782,3 +3782,47 @@ def test_format_relative_past(self):

def test_format_relative_future(self):
assert self.locale._format_relative("una hora", "hour", 1) == "En una hora"


@pytest.mark.usefixtures("lang_locale")
class TestIrishGaelicLocale:
def test_timeframes(self):
assert self.locale._format_timeframe("now", 0) == "anois"

# singular
assert self.locale._format_timeframe("second", 1) == "soicind"
assert self.locale._format_timeframe("minute", 1) == "nóiméad"
assert self.locale._format_timeframe("hour", 1) == "uair an chloig"
assert self.locale._format_timeframe("day", 1) == "lá"
assert self.locale._format_timeframe("week", 1) == "seachtain"
assert self.locale._format_timeframe("month", 1) == "mí"
assert self.locale._format_timeframe("year", 1) == "bliain"

# plural
assert self.locale._format_timeframe("seconds", 2) == "2 soicind"
assert self.locale._format_timeframe("minutes", 2) == "2 nóiméad"
assert self.locale._format_timeframe("hours", 2) == "2 uair an chloig"
assert self.locale._format_timeframe("days", 2) == "2 lá"
assert self.locale._format_timeframe("weeks", 2) == "2 seachtain"
assert self.locale._format_timeframe("months", 2) == "2 mí"
assert self.locale._format_timeframe("years", 2) == "2 bliain"

def test_weekday(self):
dt = arrow.Arrow(2015, 4, 11, 17, 30, 00)
assert self.locale.day_name(dt.isoweekday()) == "Satharn"
assert self.locale.day_abbreviation(dt.isoweekday()) == "Sat"

assert self.locale.month_name(dt.month) == "Aibreán"
assert self.locale.month_abbreviation(dt.month) == "Aib"

def test_format_relative_past(self):
assert (
self.locale._format_relative("uair an chloig", "hour", -1)
== "uair an chloig ó shin"
)

def test_format_relative_future(self):
assert (
self.locale._format_relative("uair an chloig", "hour", 1)
== "i gceann uair an chloig"
)
Loading