Skip to content

Commit 5ad47f1

Browse files
authored
Add Georgian Locale (#1088)
1 parent cdc8d33 commit 5ad47f1

File tree

4 files changed

+142
-0
lines changed

4 files changed

+142
-0
lines changed

arrow/constants.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,8 @@
162162
"ta-lk",
163163
"ur",
164164
"ur-pk",
165+
"ka",
166+
"ka-ge",
165167
"kk",
166168
"kk-kz",
167169
}

arrow/locales.py

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5704,6 +5704,91 @@ class AlbanianLocale(Locale):
57045704
]
57055705

57065706

5707+
class GeorgianLocale(Locale):
5708+
5709+
names = ["ka", "ka-ge"]
5710+
5711+
past = "{0} წინ" # ts’in
5712+
future = "{0} შემდეგ" # shemdeg
5713+
and_word = "და" # da
5714+
5715+
timeframes = {
5716+
"now": "ახლა", # akhla
5717+
# When a cardinal qualifies a noun, it stands in the singular
5718+
"second": "წამის", # ts’amis
5719+
"seconds": "{0} წამის",
5720+
"minute": "წუთის", # ts’utis
5721+
"minutes": "{0} წუთის",
5722+
"hour": "საათის", # saatis
5723+
"hours": "{0} საათის",
5724+
"day": "დღის", # dghis
5725+
"days": "{0} დღის",
5726+
"week": "კვირის", # k’viris
5727+
"weeks": "{0} კვირის",
5728+
"month": "თვის", # tvis
5729+
"months": "{0} თვის",
5730+
"year": "წლის", # ts’lis
5731+
"years": "{0} წლის",
5732+
}
5733+
5734+
month_names = [
5735+
# modern month names
5736+
"",
5737+
"იანვარი", # Ianvari
5738+
"თებერვალი", # Tebervali
5739+
"მარტი", # Mart'i
5740+
"აპრილი", # Ap'rili
5741+
"მაისი", # Maisi
5742+
"ივნისი", # Ivnisi
5743+
"ივლისი", # Ivlisi
5744+
"აგვისტო", # Agvist'o
5745+
"სექტემბერი", # Sekt'emberi
5746+
"ოქტომბერი", # Okt'omberi
5747+
"ნოემბერი", # Noemberi
5748+
"დეკემბერი", # Dek'emberi
5749+
]
5750+
5751+
month_abbreviations = [
5752+
# no abbr. found yet
5753+
"",
5754+
"იანვარი", # Ianvari
5755+
"თებერვალი", # Tebervali
5756+
"მარტი", # Mart'i
5757+
"აპრილი", # Ap'rili
5758+
"მაისი", # Maisi
5759+
"ივნისი", # Ivnisi
5760+
"ივლისი", # Ivlisi
5761+
"აგვისტო", # Agvist'o
5762+
"სექტემბერი", # Sekt'emberi
5763+
"ოქტომბერი", # Okt'omberi
5764+
"ნოემბერი", # Noemberi
5765+
"დეკემბერი", # Dek'emberi
5766+
]
5767+
5768+
day_names = [
5769+
"",
5770+
"ორშაბათი", # orshabati
5771+
"სამშაბათი", # samshabati
5772+
"ოთხშაბათი", # otkhshabati
5773+
"ხუთშაბათი", # khutshabati
5774+
"პარასკევი", # p’arask’evi
5775+
"შაბათი", # shabati
5776+
# "k’vira" also serves as week; to avoid confusion "k’vira-dge" can be used for Sunday
5777+
"კვირა", # k’vira
5778+
]
5779+
5780+
day_abbreviations = [
5781+
"",
5782+
"ორშაბათი", # orshabati
5783+
"სამშაბათი", # samshabati
5784+
"ოთხშაბათი", # otkhshabati
5785+
"ხუთშაბათი", # khutshabati
5786+
"პარასკევი", # p’arask’evi
5787+
"შაბათი", # shabati
5788+
"კვირა", # k’vira
5789+
]
5790+
5791+
57075792
class SinhalaLocale(Locale):
57085793

57095794
names = ["si", "si-lk"]

tests/test_arrow.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2466,6 +2466,8 @@ def locale_list_no_weeks() -> List[str]:
24662466
"ta-lk",
24672467
"ur",
24682468
"ur-pk",
2469+
"ka",
2470+
"ka-ge",
24692471
"kk",
24702472
"kk-kz",
24712473
]

tests/test_locales.py

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1161,6 +1161,59 @@ def test_ordinal_number(self):
11611161
assert self.locale.ordinal_number(1) == "1."
11621162

11631163

1164+
@pytest.mark.usefixtures("lang_locale")
1165+
class TestGeorgianLocale:
1166+
def test_format_timeframe(self):
1167+
# Now
1168+
assert self.locale._format_timeframe("now", 0) == "ახლა"
1169+
1170+
# Second(s)
1171+
assert self.locale._format_timeframe("second", -1) == "წამის"
1172+
assert self.locale._format_timeframe("second", 1) == "წამის"
1173+
assert self.locale._format_timeframe("seconds", -3) == "3 წამის"
1174+
assert self.locale._format_timeframe("seconds", 3) == "3 წამის"
1175+
1176+
# Minute(s)
1177+
assert self.locale._format_timeframe("minute", -1) == "წუთის"
1178+
assert self.locale._format_timeframe("minute", 1) == "წუთის"
1179+
assert self.locale._format_timeframe("minutes", -4) == "4 წუთის"
1180+
assert self.locale._format_timeframe("minutes", 4) == "4 წუთის"
1181+
1182+
# Hour(s)
1183+
assert self.locale._format_timeframe("hour", -1) == "საათის"
1184+
assert self.locale._format_timeframe("hour", 1) == "საათის"
1185+
assert self.locale._format_timeframe("hours", -23) == "23 საათის"
1186+
assert self.locale._format_timeframe("hours", 23) == "23 საათის"
1187+
1188+
# Day(s)
1189+
assert self.locale._format_timeframe("day", -1) == "დღის"
1190+
assert self.locale._format_timeframe("day", 1) == "დღის"
1191+
assert self.locale._format_timeframe("days", -12) == "12 დღის"
1192+
assert self.locale._format_timeframe("days", 12) == "12 დღის"
1193+
1194+
# Day(s)
1195+
assert self.locale._format_timeframe("week", -1) == "კვირის"
1196+
assert self.locale._format_timeframe("week", 1) == "კვირის"
1197+
assert self.locale._format_timeframe("weeks", -12) == "12 კვირის"
1198+
assert self.locale._format_timeframe("weeks", 12) == "12 კვირის"
1199+
1200+
# Month(s)
1201+
assert self.locale._format_timeframe("month", -1) == "თვის"
1202+
assert self.locale._format_timeframe("month", 1) == "თვის"
1203+
assert self.locale._format_timeframe("months", -2) == "2 თვის"
1204+
assert self.locale._format_timeframe("months", 2) == "2 თვის"
1205+
1206+
# Year(s)
1207+
assert self.locale._format_timeframe("year", -1) == "წლის"
1208+
assert self.locale._format_timeframe("year", 1) == "წლის"
1209+
assert self.locale._format_timeframe("years", -2) == "2 წლის"
1210+
assert self.locale._format_timeframe("years", 2) == "2 წლის"
1211+
1212+
def test_weekday(self):
1213+
dt = arrow.Arrow(2015, 4, 11, 17, 30, 00)
1214+
assert self.locale.day_name(dt.isoweekday()) == "შაბათი"
1215+
1216+
11641217
@pytest.mark.usefixtures("lang_locale")
11651218
class TestGermanLocale:
11661219
def test_ordinal_number(self):

0 commit comments

Comments
 (0)