Skip to content

Commit

Permalink
Add Latin locale (#955)
Browse files Browse the repository at this point in the history
  • Loading branch information
cyriaka90 authored Apr 8, 2021
1 parent 6941e32 commit 57c67d0
Show file tree
Hide file tree
Showing 2 changed files with 103 additions and 0 deletions.
81 changes: 81 additions & 0 deletions arrow/locales.py
Original file line number Diff line number Diff line change
Expand Up @@ -4562,6 +4562,87 @@ def _format_timeframe(
return form.format(delta)


class LatinLocale(Locale):

names = ["la", "la-va"]

past = "ante {0}"
future = "in {0}"
and_word = "et"

timeframes: ClassVar[Mapping[TimeFrameLiteral, Union[str, Mapping[str, str]]]] = {
"now": "nunc",
"second": "secundum",
"seconds": "{0} secundis",
"minute": "minutam",
"minutes": "{0} minutis",
"hour": "horam",
"hours": "{0} horas",
"day": "diem",
"days": "{0} dies",
"week": "hebdomadem",
"weeks": "{0} hebdomades",
"month": "mensem",
"months": "{0} mensis",
"year": "annum",
"years": "{0} annos",
}

month_names = [
"",
"Ianuarius",
"Februarius",
"Martius",
"Aprilis",
"Maius",
"Iunius",
"Iulius",
"Augustus",
"September",
"October",
"November",
"December",
]

month_abbreviations = [
"",
"Ian",
"Febr",
"Mart",
"Apr",
"Mai",
"Iun",
"Iul",
"Aug",
"Sept",
"Oct",
"Nov",
"Dec",
]

day_names = [
"",
"dies Lunae",
"dies Martis",
"dies Mercurii",
"dies Iovis",
"dies Veneris",
"dies Saturni",
"dies Solis",
]

day_abbreviations = [
"",
"dies Lunae",
"dies Martis",
"dies Mercurii",
"dies Iovis",
"dies Veneris",
"dies Saturni",
"dies Solis",
]


class LithuanianLocale(Locale):

names = ["lt", "lt-lt"]
Expand Down
22 changes: 22 additions & 0 deletions tests/test_locales.py
Original file line number Diff line number Diff line change
Expand Up @@ -1147,6 +1147,28 @@ def test_weekday(self):
assert self.locale.day_abbreviation(dt.isoweekday()) == "su"


@pytest.mark.usefixtures("lang_locale")
class TestLatinLocale:
def test_format_timeframe(self):
assert self.locale._format_timeframe("now", 0) == "nunc"
assert self.locale._format_timeframe("second", 1) == "secundum"
assert self.locale._format_timeframe("seconds", 3) == "3 secundis"
assert self.locale._format_timeframe("minute", 1) == "minutam"
assert self.locale._format_timeframe("minutes", 4) == "4 minutis"
assert self.locale._format_timeframe("hour", 1) == "horam"
assert self.locale._format_timeframe("hours", 23) == "23 horas"
assert self.locale._format_timeframe("day", 1) == "diem"
assert self.locale._format_timeframe("days", 12) == "12 dies"
assert self.locale._format_timeframe("month", 1) == "mensem"
assert self.locale._format_timeframe("months", 11) == "11 mensis"
assert self.locale._format_timeframe("year", 1) == "annum"
assert self.locale._format_timeframe("years", 2) == "2 annos"

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


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

0 comments on commit 57c67d0

Please sign in to comment.