Skip to content

Commit

Permalink
Add Georgian Locale (arrow-py#1088)
Browse files Browse the repository at this point in the history
  • Loading branch information
cyriaka90 authored Feb 14, 2022
1 parent cdc8d33 commit 5ad47f1
Show file tree
Hide file tree
Showing 4 changed files with 142 additions and 0 deletions.
2 changes: 2 additions & 0 deletions arrow/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@
"ta-lk",
"ur",
"ur-pk",
"ka",
"ka-ge",
"kk",
"kk-kz",
}
85 changes: 85 additions & 0 deletions arrow/locales.py
Original file line number Diff line number Diff line change
Expand Up @@ -5704,6 +5704,91 @@ class AlbanianLocale(Locale):
]


class GeorgianLocale(Locale):

names = ["ka", "ka-ge"]

past = "{0} แƒฌแƒ˜แƒœ" # tsโ€™in
future = "{0} แƒจแƒ”แƒ›แƒ“แƒ”แƒ’" # shemdeg
and_word = "แƒ“แƒ" # da

timeframes = {
"now": "แƒแƒฎแƒšแƒ", # akhla
# When a cardinal qualifies a noun, it stands in the singular
"second": "แƒฌแƒแƒ›แƒ˜แƒก", # tsโ€™amis
"seconds": "{0} แƒฌแƒแƒ›แƒ˜แƒก",
"minute": "แƒฌแƒฃแƒ—แƒ˜แƒก", # tsโ€™utis
"minutes": "{0} แƒฌแƒฃแƒ—แƒ˜แƒก",
"hour": "แƒกแƒแƒแƒ—แƒ˜แƒก", # saatis
"hours": "{0} แƒกแƒแƒแƒ—แƒ˜แƒก",
"day": "แƒ“แƒฆแƒ˜แƒก", # dghis
"days": "{0} แƒ“แƒฆแƒ˜แƒก",
"week": "แƒ™แƒ•แƒ˜แƒ แƒ˜แƒก", # kโ€™viris
"weeks": "{0} แƒ™แƒ•แƒ˜แƒ แƒ˜แƒก",
"month": "แƒ—แƒ•แƒ˜แƒก", # tvis
"months": "{0} แƒ—แƒ•แƒ˜แƒก",
"year": "แƒฌแƒšแƒ˜แƒก", # tsโ€™lis
"years": "{0} แƒฌแƒšแƒ˜แƒก",
}

month_names = [
# modern month names
"",
"แƒ˜แƒแƒœแƒ•แƒแƒ แƒ˜", # Ianvari
"แƒ—แƒ”แƒ‘แƒ”แƒ แƒ•แƒแƒšแƒ˜", # Tebervali
"แƒ›แƒแƒ แƒขแƒ˜", # Mart'i
"แƒแƒžแƒ แƒ˜แƒšแƒ˜", # Ap'rili
"แƒ›แƒแƒ˜แƒกแƒ˜", # Maisi
"แƒ˜แƒ•แƒœแƒ˜แƒกแƒ˜", # Ivnisi
"แƒ˜แƒ•แƒšแƒ˜แƒกแƒ˜", # Ivlisi
"แƒแƒ’แƒ•แƒ˜แƒกแƒขแƒ", # Agvist'o
"แƒกแƒ”แƒฅแƒขแƒ”แƒ›แƒ‘แƒ”แƒ แƒ˜", # Sekt'emberi
"แƒแƒฅแƒขแƒแƒ›แƒ‘แƒ”แƒ แƒ˜", # Okt'omberi
"แƒœแƒแƒ”แƒ›แƒ‘แƒ”แƒ แƒ˜", # Noemberi
"แƒ“แƒ”แƒ™แƒ”แƒ›แƒ‘แƒ”แƒ แƒ˜", # Dek'emberi
]

month_abbreviations = [
# no abbr. found yet
"",
"แƒ˜แƒแƒœแƒ•แƒแƒ แƒ˜", # Ianvari
"แƒ—แƒ”แƒ‘แƒ”แƒ แƒ•แƒแƒšแƒ˜", # Tebervali
"แƒ›แƒแƒ แƒขแƒ˜", # Mart'i
"แƒแƒžแƒ แƒ˜แƒšแƒ˜", # Ap'rili
"แƒ›แƒแƒ˜แƒกแƒ˜", # Maisi
"แƒ˜แƒ•แƒœแƒ˜แƒกแƒ˜", # Ivnisi
"แƒ˜แƒ•แƒšแƒ˜แƒกแƒ˜", # Ivlisi
"แƒแƒ’แƒ•แƒ˜แƒกแƒขแƒ", # Agvist'o
"แƒกแƒ”แƒฅแƒขแƒ”แƒ›แƒ‘แƒ”แƒ แƒ˜", # Sekt'emberi
"แƒแƒฅแƒขแƒแƒ›แƒ‘แƒ”แƒ แƒ˜", # Okt'omberi
"แƒœแƒแƒ”แƒ›แƒ‘แƒ”แƒ แƒ˜", # Noemberi
"แƒ“แƒ”แƒ™แƒ”แƒ›แƒ‘แƒ”แƒ แƒ˜", # Dek'emberi
]

day_names = [
"",
"แƒแƒ แƒจแƒแƒ‘แƒแƒ—แƒ˜", # orshabati
"แƒกแƒแƒ›แƒจแƒแƒ‘แƒแƒ—แƒ˜", # samshabati
"แƒแƒ—แƒฎแƒจแƒแƒ‘แƒแƒ—แƒ˜", # otkhshabati
"แƒฎแƒฃแƒ—แƒจแƒแƒ‘แƒแƒ—แƒ˜", # khutshabati
"แƒžแƒแƒ แƒแƒกแƒ™แƒ”แƒ•แƒ˜", # pโ€™araskโ€™evi
"แƒจแƒแƒ‘แƒแƒ—แƒ˜", # shabati
# "kโ€™vira" also serves as week; to avoid confusion "kโ€™vira-dge" can be used for Sunday
"แƒ™แƒ•แƒ˜แƒ แƒ", # kโ€™vira
]

day_abbreviations = [
"",
"แƒแƒ แƒจแƒแƒ‘แƒแƒ—แƒ˜", # orshabati
"แƒกแƒแƒ›แƒจแƒแƒ‘แƒแƒ—แƒ˜", # samshabati
"แƒแƒ—แƒฎแƒจแƒแƒ‘แƒแƒ—แƒ˜", # otkhshabati
"แƒฎแƒฃแƒ—แƒจแƒแƒ‘แƒแƒ—แƒ˜", # khutshabati
"แƒžแƒแƒ แƒแƒกแƒ™แƒ”แƒ•แƒ˜", # pโ€™araskโ€™evi
"แƒจแƒแƒ‘แƒแƒ—แƒ˜", # shabati
"แƒ™แƒ•แƒ˜แƒ แƒ", # kโ€™vira
]


class SinhalaLocale(Locale):

names = ["si", "si-lk"]
Expand Down
2 changes: 2 additions & 0 deletions tests/test_arrow.py
Original file line number Diff line number Diff line change
Expand Up @@ -2466,6 +2466,8 @@ def locale_list_no_weeks() -> List[str]:
"ta-lk",
"ur",
"ur-pk",
"ka",
"ka-ge",
"kk",
"kk-kz",
]
Expand Down
53 changes: 53 additions & 0 deletions tests/test_locales.py
Original file line number Diff line number Diff line change
Expand Up @@ -1161,6 +1161,59 @@ def test_ordinal_number(self):
assert self.locale.ordinal_number(1) == "1."


@pytest.mark.usefixtures("lang_locale")
class TestGeorgianLocale:
def test_format_timeframe(self):
# Now
assert self.locale._format_timeframe("now", 0) == "แƒแƒฎแƒšแƒ"

# Second(s)
assert self.locale._format_timeframe("second", -1) == "แƒฌแƒแƒ›แƒ˜แƒก"
assert self.locale._format_timeframe("second", 1) == "แƒฌแƒแƒ›แƒ˜แƒก"
assert self.locale._format_timeframe("seconds", -3) == "3 แƒฌแƒแƒ›แƒ˜แƒก"
assert self.locale._format_timeframe("seconds", 3) == "3 แƒฌแƒแƒ›แƒ˜แƒก"

# Minute(s)
assert self.locale._format_timeframe("minute", -1) == "แƒฌแƒฃแƒ—แƒ˜แƒก"
assert self.locale._format_timeframe("minute", 1) == "แƒฌแƒฃแƒ—แƒ˜แƒก"
assert self.locale._format_timeframe("minutes", -4) == "4 แƒฌแƒฃแƒ—แƒ˜แƒก"
assert self.locale._format_timeframe("minutes", 4) == "4 แƒฌแƒฃแƒ—แƒ˜แƒก"

# Hour(s)
assert self.locale._format_timeframe("hour", -1) == "แƒกแƒแƒแƒ—แƒ˜แƒก"
assert self.locale._format_timeframe("hour", 1) == "แƒกแƒแƒแƒ—แƒ˜แƒก"
assert self.locale._format_timeframe("hours", -23) == "23 แƒกแƒแƒแƒ—แƒ˜แƒก"
assert self.locale._format_timeframe("hours", 23) == "23 แƒกแƒแƒแƒ—แƒ˜แƒก"

# Day(s)
assert self.locale._format_timeframe("day", -1) == "แƒ“แƒฆแƒ˜แƒก"
assert self.locale._format_timeframe("day", 1) == "แƒ“แƒฆแƒ˜แƒก"
assert self.locale._format_timeframe("days", -12) == "12 แƒ“แƒฆแƒ˜แƒก"
assert self.locale._format_timeframe("days", 12) == "12 แƒ“แƒฆแƒ˜แƒก"

# Day(s)
assert self.locale._format_timeframe("week", -1) == "แƒ™แƒ•แƒ˜แƒ แƒ˜แƒก"
assert self.locale._format_timeframe("week", 1) == "แƒ™แƒ•แƒ˜แƒ แƒ˜แƒก"
assert self.locale._format_timeframe("weeks", -12) == "12 แƒ™แƒ•แƒ˜แƒ แƒ˜แƒก"
assert self.locale._format_timeframe("weeks", 12) == "12 แƒ™แƒ•แƒ˜แƒ แƒ˜แƒก"

# Month(s)
assert self.locale._format_timeframe("month", -1) == "แƒ—แƒ•แƒ˜แƒก"
assert self.locale._format_timeframe("month", 1) == "แƒ—แƒ•แƒ˜แƒก"
assert self.locale._format_timeframe("months", -2) == "2 แƒ—แƒ•แƒ˜แƒก"
assert self.locale._format_timeframe("months", 2) == "2 แƒ—แƒ•แƒ˜แƒก"

# Year(s)
assert self.locale._format_timeframe("year", -1) == "แƒฌแƒšแƒ˜แƒก"
assert self.locale._format_timeframe("year", 1) == "แƒฌแƒšแƒ˜แƒก"
assert self.locale._format_timeframe("years", -2) == "2 แƒฌแƒšแƒ˜แƒก"
assert self.locale._format_timeframe("years", 2) == "2 แƒฌแƒšแƒ˜แƒก"

def test_weekday(self):
dt = arrow.Arrow(2015, 4, 11, 17, 30, 00)
assert self.locale.day_name(dt.isoweekday()) == "แƒจแƒแƒ‘แƒแƒ—แƒ˜"


@pytest.mark.usefixtures("lang_locale")
class TestGermanLocale:
def test_ordinal_number(self):
Expand Down

0 comments on commit 5ad47f1

Please sign in to comment.