Skip to content

Commit 948d0f7

Browse files
committed
feat: add bg locale translations
The translations for days, months, and units in the Bulgarian (bg) locale have been updated. This update includes changes to the abbreviated, narrow, short, and wide forms of the translations. The translations for relative time expressions (e.g., "след" and "преди") have also been updated for the year, month, week, and day units.
1 parent 3e3fec6 commit 948d0f7

File tree

4 files changed

+330
-0
lines changed

4 files changed

+330
-0
lines changed

Diff for: src/pendulum/locales/bg/__init__.py

Whitespace-only changes.

Diff for: src/pendulum/locales/bg/custom.py

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
"""
2+
bg custom locale file.
3+
"""
4+
from __future__ import annotations
5+
6+
7+
translations = {
8+
# Relative time
9+
"ago": "преди {}",
10+
"from_now": "след {}",
11+
"after": "след {0}",
12+
"before": "преди {0}",
13+
# Date formats
14+
"date_formats": {
15+
"LTS": "HH:mm:ss",
16+
"LT": "HH:mm",
17+
"L": "DD.MM.YYYY",
18+
"LL": "D MMMM YYYY г.",
19+
"LLL": "D MMMM YYYY г., HH:mm",
20+
"LLLL": "dddd, D MMMM YYYY г., HH:mm",
21+
},
22+
}

Diff for: src/pendulum/locales/bg/locale.py

+221
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,221 @@
1+
from .custom import translations as custom_translations
2+
3+
4+
"""
5+
bg locale file.
6+
7+
It has been generated automatically and must not be modified directly.
8+
"""
9+
10+
11+
locale = {
12+
'plural': lambda n: 'one' if (n == n and ((n == 1))) else 'other',
13+
'ordinal': lambda n: 'other',
14+
'translations': {
15+
'days': {
16+
'abbreviated': {
17+
0: 'пн',
18+
1: 'вт',
19+
2: 'ср',
20+
3: 'чт',
21+
4: 'пт',
22+
5: 'сб',
23+
6: 'нд',
24+
},
25+
'narrow': {
26+
0: 'п',
27+
1: 'в',
28+
2: 'с',
29+
3: 'ч',
30+
4: 'п',
31+
5: 'с',
32+
6: 'н',
33+
},
34+
'short': {
35+
0: 'пн',
36+
1: 'вт',
37+
2: 'ср',
38+
3: 'чт',
39+
4: 'пт',
40+
5: 'сб',
41+
6: 'нд',
42+
},
43+
'wide': {
44+
0: 'понеделник',
45+
1: 'вторник',
46+
2: 'сряда',
47+
3: 'четвъртък',
48+
4: 'петък',
49+
5: 'събота',
50+
6: 'неделя',
51+
},
52+
},
53+
'months': {
54+
'abbreviated': {
55+
1: 'яну',
56+
2: 'фев',
57+
3: 'март',
58+
4: 'апр',
59+
5: 'май',
60+
6: 'юни',
61+
7: 'юли',
62+
8: 'авг',
63+
9: 'сеп',
64+
10: 'окт',
65+
11: 'ное',
66+
12: 'дек',
67+
},
68+
'narrow': {
69+
1: 'я',
70+
2: 'ф',
71+
3: 'м',
72+
4: 'а',
73+
5: 'м',
74+
6: 'ю',
75+
7: 'ю',
76+
8: 'а',
77+
9: 'с',
78+
10: 'о',
79+
11: 'н',
80+
12: 'д',
81+
},
82+
'wide': {
83+
1: 'януари',
84+
2: 'февруари',
85+
3: 'март',
86+
4: 'април',
87+
5: 'май',
88+
6: 'юни',
89+
7: 'юли',
90+
8: 'август',
91+
9: 'септември',
92+
10: 'октомври',
93+
11: 'ноември',
94+
12: 'декември',
95+
},
96+
},
97+
'units': {
98+
'year': {
99+
'one': '{0} година',
100+
'other': '{0} години',
101+
},
102+
'month': {
103+
'one': '{0} месец',
104+
'other': '{0} месеца',
105+
},
106+
'week': {
107+
'one': '{0} седмица',
108+
'other': '{0} седмици',
109+
},
110+
'day': {
111+
'one': '{0} ден',
112+
'other': '{0} дни',
113+
},
114+
'hour': {
115+
'one': '{0} час',
116+
'other': '{0} часа',
117+
},
118+
'minute': {
119+
'one': '{0} минута',
120+
'other': '{0} минути',
121+
},
122+
'second': {
123+
'one': '{0} секунда',
124+
'other': '{0} секунди',
125+
},
126+
'microsecond': {
127+
'one': '{0} микросекунда',
128+
'other': '{0} микросекунди',
129+
},
130+
},
131+
'relative': {
132+
'year': {
133+
'future': {
134+
'other': 'след {0} години',
135+
'one': 'след {0} година',
136+
},
137+
'past': {
138+
'other': 'преди {0} години',
139+
'one': 'преди {0} година',
140+
},
141+
},
142+
'month': {
143+
'future': {
144+
'other': 'след {0} месеца',
145+
'one': 'след {0} месец',
146+
},
147+
'past': {
148+
'other': 'преди {0} месеца',
149+
'one': 'преди {0} месец',
150+
},
151+
},
152+
'week': {
153+
'future': {
154+
'other': 'след {0} седмици',
155+
'one': 'след {0} седмица',
156+
},
157+
'past': {
158+
'other': 'преди {0} седмици',
159+
'one': 'преди {0} седмица',
160+
},
161+
},
162+
'day': {
163+
'future': {
164+
'other': 'след {0} дни',
165+
'one': 'след {0} ден',
166+
},
167+
'past': {
168+
'other': 'преди {0} дни',
169+
'one': 'преди {0} ден',
170+
},
171+
},
172+
'hour': {
173+
'future': {
174+
'other': 'след {0} часа',
175+
'one': 'след {0} час',
176+
},
177+
'past': {
178+
'other': 'преди {0} часа',
179+
'one': 'преди {0} час',
180+
},
181+
},
182+
'minute': {
183+
'future': {
184+
'other': 'след {0} минути',
185+
'one': 'след {0} минута',
186+
},
187+
'past': {
188+
'other': 'преди {0} минути',
189+
'one': 'преди {0} минута',
190+
},
191+
},
192+
'second': {
193+
'future': {
194+
'other': 'след {0} секунди',
195+
'one': 'след {0} секунда',
196+
},
197+
'past': {
198+
'other': 'преди {0} секунди',
199+
'one': 'преди {0} секунда',
200+
},
201+
},
202+
},
203+
'day_periods': {
204+
'midnight': 'полунощ',
205+
'am': 'пр.об.',
206+
'pm': 'сл.об.',
207+
'morning1': 'сутринта',
208+
'morning2': 'на обяд',
209+
'afternoon1': 'следобед',
210+
'evening1': 'вечерта',
211+
'night1': 'през нощта',
212+
},
213+
'week_data': {
214+
'min_days': 1,
215+
'first_day': 0,
216+
'weekend_start': 5,
217+
'weekend_end': 6,
218+
},
219+
},
220+
'custom': custom_translations
221+
}

Diff for: tests/localization/test_bg.py

+87
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
from __future__ import annotations
2+
3+
import pendulum
4+
5+
6+
locale = "bg"
7+
8+
9+
def test_diff_for_humans():
10+
with pendulum.travel_to(pendulum.datetime(2016, 8, 29), freeze=True):
11+
diff_for_humans()
12+
13+
14+
def diff_for_humans():
15+
d = pendulum.now().subtract(seconds=1)
16+
assert d.diff_for_humans(locale=locale) == "преди 1 секунда"
17+
18+
d = pendulum.now().subtract(seconds=2)
19+
assert d.diff_for_humans(locale=locale) == "преди 2 секунди"
20+
21+
d = pendulum.now().subtract(seconds=5)
22+
assert d.diff_for_humans(locale=locale) == "преди 5 секунди"
23+
24+
d = pendulum.now().subtract(seconds=21)
25+
assert d.diff_for_humans(locale=locale) == "преди 21 секунди"
26+
27+
d = pendulum.now().subtract(minutes=1)
28+
assert d.diff_for_humans(locale=locale) == "преди 1 минута"
29+
30+
d = pendulum.now().subtract(minutes=2)
31+
assert d.diff_for_humans(locale=locale) == "преди 2 минути"
32+
33+
d = pendulum.now().subtract(minutes=5)
34+
assert d.diff_for_humans(locale=locale) == "преди 5 минути"
35+
36+
d = pendulum.now().subtract(hours=1)
37+
assert d.diff_for_humans(locale=locale) == "преди 1 час"
38+
39+
d = pendulum.now().subtract(hours=2)
40+
assert d.diff_for_humans(locale=locale) == "преди 2 часа"
41+
42+
d = pendulum.now().subtract(hours=5)
43+
assert d.diff_for_humans(locale=locale) == "преди 5 часа"
44+
45+
d = pendulum.now().subtract(days=1)
46+
assert d.diff_for_humans(locale=locale) == "преди 1 ден"
47+
48+
d = pendulum.now().subtract(days=2)
49+
assert d.diff_for_humans(locale=locale) == "преди 2 дни"
50+
51+
d = pendulum.now().subtract(days=5)
52+
assert d.diff_for_humans(locale=locale) == "преди 5 дни"
53+
54+
d = pendulum.now().subtract(weeks=1)
55+
assert d.diff_for_humans(locale=locale) == "преди 1 седмица"
56+
57+
d = pendulum.now().subtract(weeks=2)
58+
assert d.diff_for_humans(locale=locale) == "преди 2 седмици"
59+
60+
d = pendulum.now().subtract(months=1)
61+
assert d.diff_for_humans(locale=locale) == "преди 1 месец"
62+
63+
d = pendulum.now().subtract(months=2)
64+
assert d.diff_for_humans(locale=locale) == "преди 2 месеца"
65+
66+
d = pendulum.now().subtract(months=5)
67+
assert d.diff_for_humans(locale=locale) == "преди 5 месеца"
68+
69+
d = pendulum.now().subtract(years=1)
70+
assert d.diff_for_humans(locale=locale) == "преди 1 година"
71+
72+
d = pendulum.now().subtract(years=2)
73+
assert d.diff_for_humans(locale=locale) == "преди 2 години"
74+
75+
d = pendulum.now().subtract(years=5)
76+
assert d.diff_for_humans(locale=locale) == "преди 5 години"
77+
78+
d = pendulum.now().add(seconds=1)
79+
assert d.diff_for_humans(locale=locale) == "след 1 секунда"
80+
81+
d = pendulum.now().add(seconds=1)
82+
d2 = pendulum.now()
83+
assert d.diff_for_humans(d2, locale=locale) == "след 1 секунда"
84+
assert d2.diff_for_humans(d, locale=locale) == "преди 1 секунда"
85+
86+
assert d.diff_for_humans(d2, True, locale=locale) == "1 секунда"
87+
assert d2.diff_for_humans(d.add(seconds=1), True, locale=locale) == "2 секунди"

0 commit comments

Comments
 (0)