Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/HebrewView #280

Open
wants to merge 71 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
33723a7
add hebrew dates to calendar-nre feature
elor555 Feb 14, 2021
0d296f3
add test to hebrew dates
elor555 Feb 14, 2021
970534d
edit flake8
elor555 Feb 14, 2021
f0bc588
edit flake8
elor555 Feb 14, 2021
7282e00
fix after pull
elor555 Feb 15, 2021
861587a
edit flake8
elor555 Feb 15, 2021
8426167
edit
elor555 Feb 15, 2021
6b28e84
Merge branch 'develop' of https://github.com/PythonFreeCourse/calenda…
elor555 Feb 15, 2021
fbdd7f5
edit
elor555 Feb 15, 2021
442a640
edit
elor555 Feb 15, 2021
e4720c8
check
elor555 Feb 16, 2021
fcefcbe
check
elor555 Feb 16, 2021
9e6742e
edit
elor555 Feb 17, 2021
c63471a
edit
elor555 Feb 17, 2021
97a1d8c
edit after flake8
elor555 Feb 17, 2021
201b1d8
edit after flake8
elor555 Feb 17, 2021
739729e
Merge branch 'develop' of https://github.com/PythonFreeCourse/calenda…
elor555 Feb 17, 2021
d79b1c3
edit after flake8
elor555 Feb 17, 2021
f488161
edit after flake8
elor555 Feb 17, 2021
3d2c150
edit after flake8
elor555 Feb 17, 2021
d873fd6
edit after flake8
elor555 Feb 17, 2021
7593c11
edit after pull
elor555 Feb 19, 2021
3dd122b
edit after pull
elor555 Feb 19, 2021
b06b7be
edit after pull
elor555 Feb 19, 2021
4dd3ac5
edit
elor555 Feb 20, 2021
6c2d65c
edit
elor555 Feb 20, 2021
f6b8607
edit
elor555 Feb 20, 2021
3c70a58
edit
elor555 Feb 20, 2021
6a34a33
edit
elor555 Feb 20, 2021
822ac9d
edit
elor555 Feb 20, 2021
0ae1726
edit
elor555 Feb 20, 2021
9e9ee25
edit
elor555 Feb 20, 2021
0a8b157
Merge branch 'develop' of https://github.com/PythonFreeCourse/calenda…
elor555 Feb 21, 2021
ac73386
edit
elor555 Feb 21, 2021
426da0a
edit
elor555 Feb 21, 2021
63c437a
Merge branch 'develop' of https://github.com/PythonFreeCourse/calenda…
elor555 Feb 21, 2021
4ae0595
edit
elor555 Feb 21, 2021
f2323d6
edit
elor555 Feb 22, 2021
9fd7cbc
Merge branch 'develop' of https://github.com/PythonFreeCourse/calenda…
elor555 Feb 23, 2021
1c52fbd
edit
elor555 Feb 23, 2021
0abd915
edit
elor555 Feb 23, 2021
ad7ea1a
Merge branch 'develop' of https://github.com/PythonFreeCourse/calenda…
elor555 Feb 23, 2021
78278bc
edit
elor555 Feb 23, 2021
e8c1776
Merge branch 'develop' of https://github.com/PythonFreeCourse/calenda…
elor555 Feb 23, 2021
d2573b1
edit
elor555 Feb 23, 2021
d6b58f0
edit
elor555 Feb 23, 2021
7af9582
edit
elor555 Feb 23, 2021
a3b0b95
edit
elor555 Feb 23, 2021
be3ce04
Merge branch 'develop' of https://github.com/PythonFreeCourse/calenda…
elor555 Feb 24, 2021
408de5d
edit
elor555 Feb 24, 2021
848368f
edit
elor555 Feb 24, 2021
3e96b8b
edit
elor555 Feb 24, 2021
34ebe6e
edit
elor555 Feb 24, 2021
4fa9da5
Merge branch 'develop' of https://github.com/PythonFreeCourse/calenda…
elor555 Feb 24, 2021
a64fcd9
Merge branch 'develop' of https://github.com/PythonFreeCourse/calenda…
elor555 Feb 25, 2021
3b1a6be
Details Message
elor555 Feb 25, 2021
ed58474
Details Message
elor555 Feb 25, 2021
22f0bcc
fix: flake8
elor555 Feb 25, 2021
1a1eb3d
fix: flake8
elor555 Feb 25, 2021
7d6ec9b
fix: bug fix
elor555 Feb 25, 2021
18a0195
fix: bug fix
elor555 Feb 25, 2021
c022096
fix: bug fix
elor555 Feb 25, 2021
44f9d61
fix: fix translation files
elor555 Feb 25, 2021
76726e1
Merge remote-tracking branch 'upstream/develop' into feature/hebrewview
elor555 Feb 27, 2021
a2449d2
fix: bugfix
elor555 Mar 1, 2021
c7d3b7d
fix: bugfix
elor555 Mar 1, 2021
11fc0d6
fix: bugfix
elor555 Mar 1, 2021
377e82d
fix: bugfix
elor555 Mar 1, 2021
9b0c629
fix: styling
elor555 Mar 1, 2021
0a9a4fb
fix: bugfix
elor555 Mar 2, 2021
c48a270
fix: bugfix
elor555 Mar 2, 2021
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
75 changes: 75 additions & 0 deletions app/internal/hebrew_date_view.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
from datetime import date

from hebrew_numbers import int_to_gematria
from pyluach import dates, hebrewcal
from pyluach.dates import HebrewDate

HEBREW_LANGUAGE_ID = 2
_HEB_MONTH_NAMES = {
'Tishrei': _("Tishrei"),
'Cheshvan': _("Cheshvan"),
'Kislev': _("Kislev"),
'Teves': _("Teves"),
'Shvat': _("Shvat"),
'Adar': _("Adar"),
'Adar Rishon': _("Adar Rishon"),
'Adar Sheni': _("Adar Sheni"),
'Nissan': _("Nissan"),
'Iyar': _("Iyar"),
'Sivan': _("Sivan"),
'Tamuz': _("Tamuz"),
'Av': _("Av"),
'Elul': _("Elul"),
}


def get_hebrew_date_in_words(calendar_date: date, language_id: int) -> str:
"""Returns the Hebrew date for the specific day.

Args:
calendar_date: The requested date.
language_id: The user's language.

Returns:
A Hebrew date string.
"""
hebrew_date_object = from_gregorian_to_hebrew_date(calendar_date)
day = hebrew_date_object.day
month = get_month_name_by_num(hebrew_date_object)
year = hebrew_date_object.year
if language_id == HEBREW_LANGUAGE_ID:
day = int_to_gematria(day)
year = int_to_gematria(year % 1000)
return ' '.join((str(day), str(month), str(year)))


def get_month_name_by_num(calendar_date: HebrewDate) -> str:
"""Returns the Hebrew name date for the specific day.

Args:
calendar_date: The requested date.

Returns:
A Hebrew name date.
Using "_" sign for function for using gettext translate .
"""
for month in hebrewcal.Year(calendar_date.year).itermonths():
if calendar_date.month == month.month:
return _(month.name)


def from_gregorian_to_hebrew_date(calendar_date: date) -> HebrewDate:
"""Returns the Hebrew date for the specific gregorian date.

Args:
calendar_date: The requested date.

Returns:
A HebrewDate object.
"""
gregorian_date = dates.GregorianDate(
calendar_date.year,
calendar_date.month,
calendar_date.day,
)
return gregorian_date.to_heb()
Binary file modified app/locales/en/LC_MESSAGES/base.mo
Binary file not shown.
163 changes: 131 additions & 32 deletions app/locales/en/LC_MESSAGES/base.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2021-02-07 21:31+0000\n"
"POT-Creation-Date: 2021-03-01 02:13+0200\n"
"PO-Revision-Date: 2021-01-26 21:31+0200\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language: en\n"
Expand All @@ -18,81 +18,161 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.9.0\n"

#: app/routers/profile.py:20
#: app/internal/astronomy.py:11
msgid "No response from server."
msgstr ""

#: app/internal/hebrew_date_view.py:10
msgid "Tishrei"
msgstr ""

#: app/internal/hebrew_date_view.py:11
msgid "Cheshvan"
msgstr ""

#: app/internal/hebrew_date_view.py:12
msgid "Kislev"
msgstr ""

#: app/internal/hebrew_date_view.py:13
msgid "Teves"
msgstr ""

#: app/internal/hebrew_date_view.py:14
msgid "Shvat"
msgstr ""

#: app/internal/hebrew_date_view.py:15
msgid "Adar"
msgstr ""

#: app/internal/hebrew_date_view.py:16
msgid "Adar Rishon"
msgstr ""

#: app/internal/hebrew_date_view.py:17
msgid "Adar Sheni"
msgstr ""

#: app/internal/hebrew_date_view.py:18
msgid "Nissan"
msgstr ""

#: app/internal/hebrew_date_view.py:19
msgid "Iyar"
msgstr ""

#: app/internal/hebrew_date_view.py:20
msgid "Sivan"
msgstr ""

#: app/internal/hebrew_date_view.py:21
msgid "Tamuz"
msgstr ""

#: app/internal/hebrew_date_view.py:22
msgid "Av"
msgstr ""

#: app/internal/hebrew_date_view.py:23
msgid "Elul"
msgstr ""

#: app/routers/export.py:18
msgid "Not found"
msgstr ""

#: app/templates/agenda.html:11
#: app/routers/search.py:53
msgid "Invalid request."
msgstr ""

#: app/routers/search.py:58
msgid "No matching results for '{keywords}'."
msgstr ""

#: app/templates/agenda.html:14
#: app/templates/partials/user_profile/sidebar_left/features_card/export_calendar.html:9
msgid "From"
msgstr ""

#: app/templates/agenda.html:13
msgid "to"
#: app/templates/agenda.html:18
#: app/templates/partials/user_profile/sidebar_left/features_card/export_calendar.html:11
msgid "To"
msgstr ""

#: app/templates/agenda.html:15
#: app/templates/agenda.html:22
msgid "Get Agenda"
msgstr ""

#: app/templates/agenda.html:20
#: app/templates/agenda.html:39
msgid "Today"
msgstr ""

#: app/templates/agenda.html:23
msgid "Next week"
#: app/templates/agenda.html:42
msgid "Next 7 days"
msgstr ""

#: app/templates/agenda.html:26
msgid "Next month"
#: app/templates/agenda.html:45
msgid "Next 30 days"
msgstr ""

#: app/templates/agenda.html:33
#: app/templates/agenda.html:49
msgid "Week graph"
msgstr ""

#: app/templates/agenda.html:61
msgid "Start date is greater than end date"
msgstr ""

#: app/templates/agenda.html:35
#: app/templates/agenda.html:63
msgid "No events found..."
msgstr ""

#: app/templates/profile.html:50
msgid "Update name"
#: app/templates/base.html:41
msgid "Sign Out"
msgstr ""

#: app/templates/profile.html:57 app/templates/profile.html:77
#: app/templates/profile.html:97 app/templates/profile.html:120
#: app/templates/profile.html:140
msgid "Save changes"
#: app/templates/base.html:68 app/templates/partials/index/navigation.html:36
msgid "About Us"
msgstr ""

#: app/templates/profile.html:70
msgid "Update email"
#: app/templates/partials/calendar/event/view_event_details_tab.html:61
msgid "Choose user"
msgstr ""

#: app/templates/partials/user_profile/sidebar_left/features_card/export_calendar.html:13
msgid "Export"
msgstr ""

#: app/templates/profile.html:90
#: app/templates/partials/user_profile/sidebar_left/profile_card/modals/description_modal.html:6
msgid "Update description"
msgstr ""

#: app/templates/profile.html:111
msgid "Update photo"
#: app/templates/partials/user_profile/sidebar_left/profile_card/modals/description_modal.html:14
#: app/templates/partials/user_profile/sidebar_left/profile_card/modals/email_modal.html:14
#: app/templates/partials/user_profile/sidebar_left/profile_card/modals/name_modal.html:14
#: app/templates/partials/user_profile/sidebar_left/profile_card/modals/telegram_modal.html:15
#: app/templates/partials/user_profile/sidebar_left/profile_card/modals/upload_photo_modal.html:15
msgid "Save changes"
msgstr ""

#: app/templates/profile.html:220
msgid "Upcoming event on (date)"
#: app/templates/partials/user_profile/sidebar_left/profile_card/modals/email_modal.html:6
msgid "Update email"
msgstr ""

#: app/templates/profile.html:246
msgid "The Event (event)"
#: app/templates/partials/user_profile/sidebar_left/profile_card/modals/name_modal.html:6
msgid "Update name"
msgstr ""

#: app/templates/profile.html:249
msgid "Last updated (time) ago"
#: app/templates/partials/user_profile/sidebar_left/profile_card/modals/upload_photo_modal.html:6
msgid "Update photo"
msgstr ""

#: app/templates/profile.html:285
#: app/templates/partials/user_profile/sidebar_right/meetups.html:4
msgid "Explore MeetUps near you"
msgstr ""

#: app/templates/profile.html:293
#: app/templates/partials/user_profile/sidebar_right/new_card.html:4
msgid "Your Card"
msgstr ""

Expand Down Expand Up @@ -130,3 +210,22 @@ msgstr ""

#~ msgid "Agenda"
#~ msgstr ""

#~ msgid "to"
#~ msgstr ""

#~ msgid "Next week"
#~ msgstr ""

#~ msgid "Next month"
#~ msgstr ""

#~ msgid "Upcoming event on (date)"
#~ msgstr ""

#~ msgid "The Event (event)"
#~ msgstr ""

#~ msgid "Last updated (time) ago"
#~ msgstr ""

Binary file modified app/locales/he/LC_MESSAGES/base.mo
Binary file not shown.
Loading