Skip to content

Commit 4b2be20

Browse files
committed
Merge branch 'master' into refresh
2 parents 7c092ed + 2a538f9 commit 4b2be20

File tree

9 files changed

+454
-25
lines changed

9 files changed

+454
-25
lines changed

.github/workflows/release.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
run: |
2121
make linux_release
2222
- name: Upload distributions artifacts
23-
uses: actions/upload-artifact@v1
23+
uses: actions/upload-artifact@v2
2424
with:
2525
name: pendulum-dist
2626
path: dist/wheelhouse
@@ -38,7 +38,7 @@ jobs:
3838
run: |
3939
echo ::set-output name=tag::${GITHUB_REF#refs/tags/}
4040
- name: Set up Python ${{ matrix.python-version }}
41-
uses: actions/setup-python@v1
41+
uses: actions/setup-python@v2
4242
with:
4343
python-version: ${{ matrix.python-version }}
4444
- name: Install and set up Poetry
@@ -49,7 +49,7 @@ jobs:
4949
source $HOME/.poetry/env
5050
poetry build -vvv
5151
- name: Upload distribution artifacts
52-
uses: actions/upload-artifact@v1
52+
uses: actions/upload-artifact@v2
5353
with:
5454
name: pendulum-dist
5555
path: dist
@@ -68,7 +68,7 @@ jobs:
6868
run: |
6969
echo ::set-output name=tag::${GITHUB_REF#refs/tags/}
7070
- name: Set up Python ${{ matrix.python-version }}
71-
uses: actions/setup-python@v1
71+
uses: actions/setup-python@v2
7272
with:
7373
python-version: ${{ matrix.python-version }}
7474
- name: Install and setup Poetry
@@ -79,7 +79,7 @@ jobs:
7979
$env:Path += ";$env:Userprofile\.poetry\bin"
8080
poetry build -vvv
8181
- name: Upload distribution artifact
82-
uses: actions/upload-artifact@v1
82+
uses: actions/upload-artifact@v2
8383
with:
8484
name: pendulum-dist
8585
path: dist
@@ -104,7 +104,7 @@ jobs:
104104
run: |
105105
curl -fsS https://install.python-poetry.org | python - --preview -y
106106
- name: Set up cache
107-
uses: actions/cache@v1
107+
uses: actions/cache@v2
108108
with:
109109
path: .venv
110110
key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }}

pendulum/locales/cs/__init__.py

Whitespace-only changes.

pendulum/locales/cs/custom.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
"""
2+
cs custom locale file.
3+
"""
4+
5+
translations = {
6+
"units": {"few_second": "pár vteřin"},
7+
# Relative time
8+
"ago": "{} zpět",
9+
"from_now": "za {}",
10+
"after": "{0} po",
11+
"before": "{0} zpět",
12+
# Ordinals
13+
"ordinal": {"one": ".", "two": ".", "few": ".", "other": "."},
14+
# Date formats
15+
"date_formats": {
16+
"LTS": "h:mm:ss",
17+
"LT": "h:mm",
18+
"L": "DD. M. YYYY",
19+
"LL": "D. MMMM, YYYY",
20+
"LLL": "D. MMMM, YYYY h:mm",
21+
"LLLL": "dddd, D. MMMM, YYYY h:mm",
22+
},
23+
}

pendulum/locales/cs/locale.py

Lines changed: 266 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,266 @@
1+
from .custom import translations as custom_translations
2+
3+
4+
"""
5+
cs locale file.
6+
7+
It has been generated automatically and must not be modified directly.
8+
"""
9+
10+
11+
locale = {
12+
"plural": lambda n: "few"
13+
if ((n == n and (n >= 2 and n <= 4)) and (0 == 0 and (0 == 0)))
14+
else "many"
15+
if (not (0 == 0 and (0 == 0)))
16+
else "one"
17+
if ((n == n and (n == 1)) and (0 == 0 and (0 == 0)))
18+
else "other",
19+
"ordinal": lambda n: "other",
20+
"translations": {
21+
"days": {
22+
"abbreviated": {
23+
0: "ne",
24+
1: "po",
25+
2: "út",
26+
3: "st",
27+
4: "čt",
28+
5: "pá",
29+
6: "so",
30+
},
31+
"narrow": {
32+
0: "N",
33+
1: "P",
34+
2: "Ú",
35+
3: "S",
36+
4: "Č",
37+
5: "P",
38+
6: "S",
39+
},
40+
"short": {
41+
0: "ne",
42+
1: "po",
43+
2: "út",
44+
3: "st",
45+
4: "čt",
46+
5: "pá",
47+
6: "so",
48+
},
49+
"wide": {
50+
0: "neděle",
51+
1: "pondělí",
52+
2: "úterý",
53+
3: "středa",
54+
4: "čtvrtek",
55+
5: "pátek",
56+
6: "sobota",
57+
},
58+
},
59+
"months": {
60+
"abbreviated": {
61+
1: "led",
62+
2: "úno",
63+
3: "bře",
64+
4: "dub",
65+
5: "kvě",
66+
6: "čvn",
67+
7: "čvc",
68+
8: "srp",
69+
9: "zář",
70+
10: "říj",
71+
11: "lis",
72+
12: "pro",
73+
},
74+
"narrow": {
75+
1: "1",
76+
2: "2",
77+
3: "3",
78+
4: "4",
79+
5: "5",
80+
6: "6",
81+
7: "7",
82+
8: "8",
83+
9: "9",
84+
10: "10",
85+
11: "11",
86+
12: "12",
87+
},
88+
"wide": {
89+
1: "ledna",
90+
2: "února",
91+
3: "března",
92+
4: "dubna",
93+
5: "května",
94+
6: "června",
95+
7: "července",
96+
8: "srpna",
97+
9: "září",
98+
10: "října",
99+
11: "listopadu",
100+
12: "prosince",
101+
},
102+
},
103+
"units": {
104+
"year": {
105+
"one": "{0} rok",
106+
"few": "{0} roky",
107+
"many": "{0} roku",
108+
"other": "{0} let",
109+
},
110+
"month": {
111+
"one": "{0} měsíc",
112+
"few": "{0} měsíce",
113+
"many": "{0} měsíce",
114+
"other": "{0} měsíců",
115+
},
116+
"week": {
117+
"one": "{0} týden",
118+
"few": "{0} týdny",
119+
"many": "{0} týdne",
120+
"other": "{0} týdnů",
121+
},
122+
"day": {
123+
"one": "{0} den",
124+
"few": "{0} dny",
125+
"many": "{0} dne",
126+
"other": "{0} dní",
127+
},
128+
"hour": {
129+
"one": "{0} hodina",
130+
"few": "{0} hodiny",
131+
"many": "{0} hodiny",
132+
"other": "{0} hodin",
133+
},
134+
"minute": {
135+
"one": "{0} minuta",
136+
"few": "{0} minuty",
137+
"many": "{0} minuty",
138+
"other": "{0} minut",
139+
},
140+
"second": {
141+
"one": "{0} sekunda",
142+
"few": "{0} sekundy",
143+
"many": "{0} sekundy",
144+
"other": "{0} sekund",
145+
},
146+
"microsecond": {
147+
"one": "{0} mikrosekunda",
148+
"few": "{0} mikrosekundy",
149+
"many": "{0} mikrosekundy",
150+
"other": "{0} mikrosekund",
151+
},
152+
},
153+
"relative": {
154+
"year": {
155+
"future": {
156+
"other": "za {0} let",
157+
"one": "za {0} rok",
158+
"few": "za {0} roky",
159+
"many": "za {0} roku",
160+
},
161+
"past": {
162+
"other": "před {0} lety",
163+
"one": "před {0} rokem",
164+
"few": "před {0} lety",
165+
"many": "před {0} roku",
166+
},
167+
},
168+
"month": {
169+
"future": {
170+
"other": "za {0} měsíců",
171+
"one": "za {0} měsíc",
172+
"few": "za {0} měsíce",
173+
"many": "za {0} měsíce",
174+
},
175+
"past": {
176+
"other": "před {0} měsíci",
177+
"one": "před {0} měsícem",
178+
"few": "před {0} měsíci",
179+
"many": "před {0} měsíce",
180+
},
181+
},
182+
"week": {
183+
"future": {
184+
"other": "za {0} týdnů",
185+
"one": "za {0} týden",
186+
"few": "za {0} týdny",
187+
"many": "za {0} týdne",
188+
},
189+
"past": {
190+
"other": "před {0} týdny",
191+
"one": "před {0} týdnem",
192+
"few": "před {0} týdny",
193+
"many": "před {0} týdne",
194+
},
195+
},
196+
"day": {
197+
"future": {
198+
"other": "za {0} dní",
199+
"one": "za {0} den",
200+
"few": "za {0} dny",
201+
"many": "za {0} dne",
202+
},
203+
"past": {
204+
"other": "před {0} dny",
205+
"one": "před {0} dnem",
206+
"few": "před {0} dny",
207+
"many": "před {0} dne",
208+
},
209+
},
210+
"hour": {
211+
"future": {
212+
"other": "za {0} hodin",
213+
"one": "za {0} hodinu",
214+
"few": "za {0} hodiny",
215+
"many": "za {0} hodiny",
216+
},
217+
"past": {
218+
"other": "před {0} hodinami",
219+
"one": "před {0} hodinou",
220+
"few": "před {0} hodinami",
221+
"many": "před {0} hodiny",
222+
},
223+
},
224+
"minute": {
225+
"future": {
226+
"other": "za {0} minut",
227+
"one": "za {0} minutu",
228+
"few": "za {0} minuty",
229+
"many": "za {0} minuty",
230+
},
231+
"past": {
232+
"other": "před {0} minutami",
233+
"one": "před {0} minutou",
234+
"few": "před {0} minutami",
235+
"many": "před {0} minuty",
236+
},
237+
},
238+
"second": {
239+
"future": {
240+
"other": "za {0} sekund",
241+
"one": "za {0} sekundu",
242+
"few": "za {0} sekundy",
243+
"many": "za {0} sekundy",
244+
},
245+
"past": {
246+
"other": "před {0} sekundami",
247+
"one": "před {0} sekundou",
248+
"few": "před {0} sekundami",
249+
"many": "před {0} sekundy",
250+
},
251+
},
252+
},
253+
"day_periods": {
254+
"midnight": "půlnoc",
255+
"am": "dop.",
256+
"noon": "poledne",
257+
"pm": "odp.",
258+
"morning1": "ráno",
259+
"morning2": "dopoledne",
260+
"afternoon1": "odpoledne",
261+
"evening1": "večer",
262+
"night1": "v noci",
263+
},
264+
},
265+
"custom": custom_translations,
266+
}

pendulum/locales/locale.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import os
21
import re
2+
import sys
33

44
from importlib import import_module
55
from typing import Any
@@ -8,6 +8,12 @@
88
from typing import Union
99

1010

11+
if sys.version_info >= (3, 9):
12+
from importlib import resources
13+
else:
14+
import importlib_resources as resources
15+
16+
1117
class Locale:
1218
"""
1319
Represent a specific locale.
@@ -31,8 +37,8 @@ def load(cls, locale: Union[str, "Locale"]) -> "Locale":
3137

3238
# Checking locale existence
3339
actual_locale = locale
34-
locale_path = os.path.join(os.path.dirname(__file__), actual_locale)
35-
while not os.path.exists(locale_path):
40+
locale_path = resources.files(__package__).joinpath(actual_locale)
41+
while not locale_path.exists():
3642
if actual_locale == locale:
3743
raise ValueError(f"Locale [{locale}] does not exist.")
3844

0 commit comments

Comments
 (0)