Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added pendulum/locales/cs/__init__.py
Empty file.
23 changes: 23 additions & 0 deletions pendulum/locales/cs/custom.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
"""
cs custom locale file.
"""

translations = {
"units": {"few_second": "pár vteřin"},
# Relative time
"ago": "{} zpět",
"from_now": "za {}",
"after": "{0} po",
"before": "{0} zpět",
# Ordinals
"ordinal": {"one": ".", "two": ".", "few": ".", "other": "."},
# Date formats
"date_formats": {
"LTS": "h:mm:ss",
"LT": "h:mm",
"L": "DD. M. YYYY",
"LL": "D. MMMM, YYYY",
"LLL": "D. MMMM, YYYY h:mm",
"LLLL": "dddd, D. MMMM, YYYY h:mm",
},
}
266 changes: 266 additions & 0 deletions pendulum/locales/cs/locale.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,266 @@
from .custom import translations as custom_translations


"""
cs locale file.

It has been generated automatically and must not be modified directly.
"""


locale = {
"plural": lambda n: "few"
if ((n == n and (n >= 2 and n <= 4)) and (0 == 0 and (0 == 0)))
else "many"
if (not (0 == 0 and (0 == 0)))
else "one"
if ((n == n and (n == 1)) and (0 == 0 and (0 == 0)))
else "other",
"ordinal": lambda n: "other",
"translations": {
"days": {
"abbreviated": {
0: "ne",
1: "po",
2: "út",
3: "st",
4: "čt",
5: "pá",
6: "so",
},
"narrow": {
0: "N",
1: "P",
2: "Ú",
3: "S",
4: "Č",
5: "P",
6: "S",
},
"short": {
0: "ne",
1: "po",
2: "út",
3: "st",
4: "čt",
5: "pá",
6: "so",
},
"wide": {
0: "neděle",
1: "pondělí",
2: "úterý",
3: "středa",
4: "čtvrtek",
5: "pátek",
6: "sobota",
},
},
"months": {
"abbreviated": {
1: "led",
2: "úno",
3: "bře",
4: "dub",
5: "kvě",
6: "čvn",
7: "čvc",
8: "srp",
9: "zář",
10: "říj",
11: "lis",
12: "pro",
},
"narrow": {
1: "1",
2: "2",
3: "3",
4: "4",
5: "5",
6: "6",
7: "7",
8: "8",
9: "9",
10: "10",
11: "11",
12: "12",
},
"wide": {
1: "ledna",
2: "února",
3: "března",
4: "dubna",
5: "května",
6: "června",
7: "července",
8: "srpna",
9: "září",
10: "října",
11: "listopadu",
12: "prosince",
},
},
"units": {
"year": {
"one": "{0} rok",
"few": "{0} roky",
"many": "{0} roku",
"other": "{0} let",
},
"month": {
"one": "{0} měsíc",
"few": "{0} měsíce",
"many": "{0} měsíce",
"other": "{0} měsíců",
},
"week": {
"one": "{0} týden",
"few": "{0} týdny",
"many": "{0} týdne",
"other": "{0} týdnů",
},
"day": {
"one": "{0} den",
"few": "{0} dny",
"many": "{0} dne",
"other": "{0} dní",
},
"hour": {
"one": "{0} hodina",
"few": "{0} hodiny",
"many": "{0} hodiny",
"other": "{0} hodin",
},
"minute": {
"one": "{0} minuta",
"few": "{0} minuty",
"many": "{0} minuty",
"other": "{0} minut",
},
"second": {
"one": "{0} sekunda",
"few": "{0} sekundy",
"many": "{0} sekundy",
"other": "{0} sekund",
},
"microsecond": {
"one": "{0} mikrosekunda",
"few": "{0} mikrosekundy",
"many": "{0} mikrosekundy",
"other": "{0} mikrosekund",
},
},
"relative": {
"year": {
"future": {
"other": "za {0} let",
"one": "za {0} rok",
"few": "za {0} roky",
"many": "za {0} roku",
},
"past": {
"other": "před {0} lety",
"one": "před {0} rokem",
"few": "před {0} lety",
"many": "před {0} roku",
},
},
"month": {
"future": {
"other": "za {0} měsíců",
"one": "za {0} měsíc",
"few": "za {0} měsíce",
"many": "za {0} měsíce",
},
"past": {
"other": "před {0} měsíci",
"one": "před {0} měsícem",
"few": "před {0} měsíci",
"many": "před {0} měsíce",
},
},
"week": {
"future": {
"other": "za {0} týdnů",
"one": "za {0} týden",
"few": "za {0} týdny",
"many": "za {0} týdne",
},
"past": {
"other": "před {0} týdny",
"one": "před {0} týdnem",
"few": "před {0} týdny",
"many": "před {0} týdne",
},
},
"day": {
"future": {
"other": "za {0} dní",
"one": "za {0} den",
"few": "za {0} dny",
"many": "za {0} dne",
},
"past": {
"other": "před {0} dny",
"one": "před {0} dnem",
"few": "před {0} dny",
"many": "před {0} dne",
},
},
"hour": {
"future": {
"other": "za {0} hodin",
"one": "za {0} hodinu",
"few": "za {0} hodiny",
"many": "za {0} hodiny",
},
"past": {
"other": "před {0} hodinami",
"one": "před {0} hodinou",
"few": "před {0} hodinami",
"many": "před {0} hodiny",
},
},
"minute": {
"future": {
"other": "za {0} minut",
"one": "za {0} minutu",
"few": "za {0} minuty",
"many": "za {0} minuty",
},
"past": {
"other": "před {0} minutami",
"one": "před {0} minutou",
"few": "před {0} minutami",
"many": "před {0} minuty",
},
},
"second": {
"future": {
"other": "za {0} sekund",
"one": "za {0} sekundu",
"few": "za {0} sekundy",
"many": "za {0} sekundy",
},
"past": {
"other": "před {0} sekundami",
"one": "před {0} sekundou",
"few": "před {0} sekundami",
"many": "před {0} sekundy",
},
},
},
"day_periods": {
"midnight": "půlnoc",
"am": "dop.",
"noon": "poledne",
"pm": "odp.",
"morning1": "ráno",
"morning2": "dopoledne",
"afternoon1": "odpoledne",
"evening1": "večer",
"night1": "v noci",
},
},
"custom": custom_translations,
}
108 changes: 108 additions & 0 deletions tests/localization/test_cs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
import pendulum


locale = "cs"


def test_diff_for_humans():
with pendulum.test(pendulum.datetime(2016, 8, 29)):
diff_for_humans()


def diff_for_humans():
d = pendulum.now().subtract(seconds=1)
assert d.diff_for_humans(locale=locale) == "pár vteřin zpět"

d = pendulum.now().subtract(seconds=2)
assert d.diff_for_humans(locale=locale) == "pár vteřin zpět"

d = pendulum.now().subtract(seconds=20)
assert d.diff_for_humans(locale=locale) == "před 20 sekundami"

d = pendulum.now().subtract(minutes=1)
assert d.diff_for_humans(locale=locale) == "před 1 minutou"

d = pendulum.now().subtract(minutes=2)
assert d.diff_for_humans(locale=locale) == "před 2 minutami"

d = pendulum.now().subtract(minutes=5)
assert d.diff_for_humans(locale=locale) == "před 5 minutami"

d = pendulum.now().subtract(hours=1)
assert d.diff_for_humans(locale=locale) == "před 1 hodinou"

d = pendulum.now().subtract(hours=2)
assert d.diff_for_humans(locale=locale) == "před 2 hodinami"

d = pendulum.now().subtract(hours=5)
assert d.diff_for_humans(locale=locale) == "před 5 hodinami"

d = pendulum.now().subtract(days=1)
assert d.diff_for_humans(locale=locale) == "před 1 dnem"

d = pendulum.now().subtract(days=2)
assert d.diff_for_humans(locale=locale) == "před 2 dny"

d = pendulum.now().subtract(weeks=1)
assert d.diff_for_humans(locale=locale) == "před 1 týdnem"

d = pendulum.now().subtract(weeks=2)
assert d.diff_for_humans(locale=locale) == "před 2 týdny"

d = pendulum.now().subtract(months=1)
assert d.diff_for_humans(locale=locale) == "před 1 měsícem"

d = pendulum.now().subtract(months=2)
assert d.diff_for_humans(locale=locale) == "před 2 měsíci"

d = pendulum.now().subtract(months=5)
assert d.diff_for_humans(locale=locale) == "před 5 měsíci"

d = pendulum.now().subtract(years=1)
assert d.diff_for_humans(locale=locale) == "před 1 rokem"

d = pendulum.now().subtract(years=2)
assert d.diff_for_humans(locale=locale) == "před 2 lety"

d = pendulum.now().subtract(years=5)
assert d.diff_for_humans(locale=locale) == "před 5 lety"

d = pendulum.now().add(seconds=1)
assert d.diff_for_humans(locale=locale) == "za pár vteřin"

d = pendulum.now().add(seconds=1)
d2 = pendulum.now()
assert d.diff_for_humans(d2, locale=locale) == "pár vteřin po"
assert d2.diff_for_humans(d, locale=locale) == "pár vteřin zpět"

assert d.diff_for_humans(d2, True, locale=locale) == "pár vteřin"
assert d2.diff_for_humans(d.add(seconds=1), True, locale=locale) == "pár vteřin"

d = pendulum.now().add(seconds=20)
d2 = pendulum.now()
assert d.diff_for_humans(d2, locale=locale) == "20 sekund po"
assert d2.diff_for_humans(d, locale=locale) == "20 sekund zpět"

d = pendulum.now().add(seconds=10)
d2 = pendulum.now()
assert d.diff_for_humans(d2, True, locale=locale) == "pár vteřin"
assert d2.diff_for_humans(d.add(seconds=1), True, locale=locale) == "11 sekund"


def test_format():
d = pendulum.datetime(2016, 8, 29, 7, 3, 6, 123456)
assert d.format("dddd", locale=locale) == "pondělí"
assert d.format("ddd", locale=locale) == "po"
assert d.format("MMMM", locale=locale) == "srpna"
assert d.format("MMM", locale=locale) == "srp"
assert d.format("A", locale=locale) == "dop."
assert d.format("Qo", locale=locale) == "3."
assert d.format("Mo", locale=locale) == "8."
assert d.format("Do", locale=locale) == "29."

assert d.format("LT", locale=locale) == "7:03"
assert d.format("LTS", locale=locale) == "7:03:06"
assert d.format("L", locale=locale) == "29. 8. 2016"
assert d.format("LL", locale=locale) == "29. srpna, 2016"
assert d.format("LLL", locale=locale) == "29. srpna, 2016 7:03"
assert d.format("LLLL", locale=locale) == "pondělí, 29. srpna, 2016 7:03"