Skip to content

Commit 3258088

Browse files
committed
Make Ukrainian locale name follow ISO, update it and add tests
1 parent 0a88aec commit 3258088

File tree

6 files changed

+404
-305
lines changed

6 files changed

+404
-305
lines changed

src/pendulum/locales/locale.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,11 @@ def normalize_locale(cls, locale: str) -> str:
5353
if m:
5454
return f"{m.group(1).lower()}_{m.group(2).lower()}"
5555
else:
56-
return locale.lower()
56+
lower = locale.lower()
57+
if lower == 'ua':
58+
# Backward compatibility. Ukrainian was 'ua' initially.
59+
lower = 'uk'
60+
return lower
5761

5862
def get(self, key: str, default: Any | None = None) -> Any:
5963
if key in self._key_cache:

src/pendulum/locales/ua/locale.py

Lines changed: 0 additions & 281 deletions
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
1-
"""
2-
ua custom locale file.
3-
"""
4-
from __future__ import annotations
5-
6-
7-
translations = {
8-
"units": {"few_second": "кілька секунд"},
9-
# Relative time
10-
"ago": "{} тому",
11-
"from_now": "за {}",
12-
"after": "{0} посіля",
13-
"before": "{0} до",
14-
# Date formats
15-
"date_formats": {
16-
"LTS": "HH:mm:ss",
17-
"LT": "HH:mm",
18-
"L": "DD.MM.YYYY",
19-
"LL": "D MMMM YYYY р.",
20-
"LLL": "D MMMM YYYY р., HH:mm",
21-
"LLLL": "dddd, D MMMM YYYY р., HH:mm",
22-
},
23-
}
1+
"""
2+
uk custom locale file.
3+
"""
4+
from __future__ import annotations
5+
6+
7+
translations = {
8+
"units": {"few_second": "кілька секунд"},
9+
# Relative time
10+
"ago": "{} тому",
11+
"from_now": "через {}",
12+
"after": "через {0}",
13+
"before": "{0} тому",
14+
# Date formats
15+
"date_formats": {
16+
"LTS": "HH:mm:ss",
17+
"LT": "HH:mm",
18+
"L": "DD.MM.YYYY",
19+
"LL": "D MMMM YYYY",
20+
"LLL": "D MMMM YYYY, HH:mm",
21+
"LLLL": "ddd, D MMMM YYYY, HH:mm",
22+
},
23+
}

0 commit comments

Comments
 (0)