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/he/__init__.py
Empty file.
23 changes: 23 additions & 0 deletions pendulum/locales/he/custom.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
"""
he custom locale file.
"""

translations = {
"units": {"few_second": "כמה שניות"},
# Relative time
"ago": "לפני {0}",
"from_now": "תוך {0}",
"after": "בעוד {0}",
"before": "{0} קודם",
# Ordinals
"ordinal": {"other": "º"},
# Date formats
"date_formats": {
"LTS": "H:mm:ss",
"LT": "H:mm",
"LLLL": "dddd, D [ב] MMMM [ב] YYYY H:mm",
"LLL": "D [ב] MMMM [ב] YYYY H:mm",
"LL": "D [ב] MMMM [ב] YYYY",
"L": "DD/MM/YYYY",
},
}
269 changes: 269 additions & 0 deletions pendulum/locales/he/locale.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,269 @@
from .custom import translations as custom_translations


"""
he locale file.

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


locale = {
"plural": lambda n: "many"
if (
((0 == 0 and (0 == 0)) and (not (n == n and (n >= 0 and n <= 10))))
and ((n % 10) == (n % 10) and ((n % 10) == 0))
)
else "one"
if ((n == n and (n == 1)) and (0 == 0 and (0 == 0)))
else "two"
if ((n == n and (n == 2)) and (0 == 0 and (0 == 0)))
else "other",
"ordinal": lambda n: "other",
"translations": {
"days": {
"abbreviated": {
0: "יום א׳",
1: "יום ב׳",
2: "יום ג׳",
3: "יום ד׳",
4: "יום ה׳",
5: "יום ו׳",
6: "שבת",
},
"narrow": {
0: "א׳",
1: "ב׳",
2: "ג׳",
3: "ד׳",
4: "ה׳",
5: "ו׳",
6: "ש׳",
},
"short": {
0: "א׳",
1: "ב׳",
2: "ג׳",
3: "ד׳",
4: "ה׳",
5: "ו׳",
6: "ש׳",
},
"wide": {
0: "יום ראשון",
1: "יום שני",
2: "יום שלישי",
3: "יום רביעי",
4: "יום חמישי",
5: "יום שישי",
6: "יום שבת",
},
},
"months": {
"abbreviated": {
1: "ינו׳",
2: "פבר׳",
3: "מרץ",
4: "אפר׳",
5: "מאי",
6: "יוני",
7: "יולי",
8: "אוג׳",
9: "ספט׳",
10: "אוק׳",
11: "נוב׳",
12: "דצמ׳",
},
"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: "ינואר",
2: "פברואר",
3: "מרץ",
4: "אפריל",
5: "מאי",
6: "יוני",
7: "יולי",
8: "אוגוסט",
9: "ספטמבר",
10: "אוקטובר",
11: "נובמבר",
12: "דצמבר",
},
},
"units": {
"year": {
"one": "שנה",
"two": "שנתיים",
"many": "{0} שנים",
"other": "{0} שנים",
},
"month": {
"one": "חודש",
"two": "חודשיים",
"many": "{0} חודשים",
"other": "{0} חודשים",
},
"week": {
"one": "שבוע",
"two": "שבועיים",
"many": "{0} שבועות",
"other": "{0} שבועות",
},
"day": {
"one": "יום {0}",
"two": "יומיים",
"many": "{0} יום",
"other": "{0} ימים",
},
"hour": {
"one": "שעה",
"two": "שעתיים",
"many": "{0} שעות",
"other": "{0} שעות",
},
"minute": {
"one": "דקה",
"two": "שתי דקות",
"many": "{0} דקות",
"other": "{0} דקות",
},
"second": {
"one": "שניה",
"two": "שתי שניות",
"many": "\u200f{0} שניות",
"other": "{0} שניות",
},
"microsecond": {
"one": "{0} מיליונית שנייה",
"two": "{0} מיליוניות שנייה",
"many": "{0} מיליוניות שנייה",
"other": "{0} מיליוניות שנייה",
},
},
"relative": {
"year": {
"future": {
"other": "בעוד {0} שנים",
"one": "בעוד שנה",
"two": "בעוד שנתיים",
"many": "בעוד {0} שנה",
},
"past": {
"other": "לפני {0} שנים",
"one": "לפני שנה",
"two": "לפני שנתיים",
"many": "לפני {0} שנה",
},
},
"month": {
"future": {
"other": "בעוד {0} חודשים",
"one": "בעוד חודש",
"two": "בעוד חודשיים",
"many": "בעוד {0} חודשים",
},
"past": {
"other": "לפני {0} חודשים",
"one": "לפני חודש",
"two": "לפני חודשיים",
"many": "לפני {0} חודשים",
},
},
"week": {
"future": {
"other": "בעוד {0} שבועות",
"one": "בעוד שבוע",
"two": "בעוד שבועיים",
"many": "בעוד {0} שבועות",
},
"past": {
"other": "לפני {0} שבועות",
"one": "לפני שבוע",
"two": "לפני שבועיים",
"many": "לפני {0} שבועות",
},
},
"day": {
"future": {
"other": "בעוד {0} ימים",
"one": "בעוד יום {0}",
"two": "בעוד יומיים",
"many": "בעוד {0} ימים",
},
"past": {
"other": "לפני {0} ימים",
"one": "לפני יום {0}",
"two": "לפני יומיים",
"many": "לפני {0} ימים",
},
},
"hour": {
"future": {
"other": "בעוד {0} שעות",
"one": "בעוד שעה",
"two": "בעוד שעתיים",
"many": "בעוד {0} שעות",
},
"past": {
"other": "לפני {0} שעות",
"one": "לפני שעה",
"two": "לפני שעתיים",
"many": "לפני {0} שעות",
},
},
"minute": {
"future": {
"other": "בעוד {0} דקות",
"one": "בעוד דקה",
"two": "בעוד שתי דקות",
"many": "בעוד {0} דקות",
},
"past": {
"other": "לפני {0} דקות",
"one": "לפני דקה",
"two": "לפני שתי דקות",
"many": "לפני {0} דקות",
},
},
"second": {
"future": {
"other": "בעוד {0} שניות",
"one": "בעוד שנייה",
"two": "בעוד שתי שניות",
"many": "בעוד {0} שניות",
},
"past": {
"other": "לפני {0} שניות",
"one": "לפני שנייה",
"two": "לפני שתי שניות",
"many": "לפני {0} שניות",
},
},
},
"day_periods": {
"midnight": "חצות",
"am": "לפנה״צ",
"pm": "אחה״צ",
"morning1": "בבוקר",
"afternoon1": "בצהריים",
"afternoon2": "אחר הצהריים",
"evening1": "בערב",
"night1": "בלילה",
"night2": "לפנות בוקר",
},
},
"custom": custom_translations,
}
66 changes: 66 additions & 0 deletions tests/localization/test_he.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
from __future__ import annotations

import pendulum


locale = "he"


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) == "לפני כמה שניות"

d = pendulum.now().subtract(seconds=2)
assert d.diff_for_humans(locale=locale) == "לפני כמה שניות"

d = pendulum.now().subtract(minutes=1)
assert d.diff_for_humans(locale=locale) == "לפני דקה"

d = pendulum.now().subtract(minutes=2)
assert d.diff_for_humans(locale=locale) == "לפני שתי דקות"

d = pendulum.now().subtract(hours=1)
assert d.diff_for_humans(locale=locale) == "לפני שעה"

d = pendulum.now().subtract(hours=2)
assert d.diff_for_humans(locale=locale) == "לפני שעתיים"

d = pendulum.now().subtract(days=1)
assert d.diff_for_humans(locale=locale) == "לפני יום 1"

d = pendulum.now().subtract(days=2)
assert d.diff_for_humans(locale=locale) == "לפני יומיים"

d = pendulum.now().subtract(weeks=1)
assert d.diff_for_humans(locale=locale) == "לפני שבוע"

d = pendulum.now().subtract(weeks=2)
assert d.diff_for_humans(locale=locale) == "לפני שבועיים"

d = pendulum.now().subtract(months=1)
assert d.diff_for_humans(locale=locale) == "לפני חודש"

d = pendulum.now().subtract(months=2)
assert d.diff_for_humans(locale=locale) == "לפני חודשיים"

d = pendulum.now().subtract(years=1)
assert d.diff_for_humans(locale=locale) == "לפני שנה"

d = pendulum.now().subtract(years=2)
assert d.diff_for_humans(locale=locale) == "לפני שנתיים"

d = pendulum.now().add(seconds=1)
assert d.diff_for_humans(locale=locale) == "תוך כמה שניות"

d = pendulum.now().add(seconds=1)
d2 = pendulum.now()
assert d.diff_for_humans(d2, locale=locale) == "בעוד כמה שניות"
assert d2.diff_for_humans(d, locale=locale) == "כמה שניות קודם"

assert d.diff_for_humans(d2, True, locale=locale) == "כמה שניות"
assert d2.diff_for_humans(d.add(seconds=1), True, locale=locale) == "כמה שניות"