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

Add Jordan holidays #1746

Merged
merged 21 commits into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
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
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ Eugenio Panadero Maciá
Fabian Affolter
Felix Lee
Filip Bednárik
Firas Kafri
Gabriel L Martinez
Gabriel Trabanco
Giedrius Mauza
Expand Down
7 changes: 6 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ Available Countries
.. _ISO 639-1 code: https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
.. _ISO 639-2 code: https://en.wikipedia.org/wiki/List_of_ISO_639-2_codes

We currently support 145 country codes. The standard way to refer to a country
We currently support 146 country codes. The standard way to refer to a country
is by using its `ISO 3166-1 alpha-2 code`_, the same used for domain names, and
for a subdivision its `ISO 3166-2 code`_. Some countries have common or foreign
names or abbreviations as aliases for their subdivisions. These are defined in
Expand Down Expand Up @@ -535,6 +535,11 @@ All other default values are highlighted with bold:
-
-
-
* - Jordan
- JO
-
- **ar**, en_US
-
* - Kazakhstan
- KZ
-
Expand Down
1 change: 1 addition & 0 deletions holidays/countries/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
from .jamaica import Jamaica, JM, JAM
from .japan import Japan, JP, JPN
from .jersey import Jersey, JE, JEY
from .jordan import Jordan, JO, JOR
from .kazakhstan import Kazakhstan, KZ, KAZ
from .kenya import Kenya, KE, KEN
from .kuwait import Kuwait, KW, KWT
Expand Down
81 changes: 81 additions & 0 deletions holidays/countries/jordan.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# holidays
# --------
# A fast, efficient Python library for generating country, province and state
# specific sets of holidays on the fly. It aims to make determining whether a
# specific date is a holiday as fast and flexible as possible.
#
# Authors: Vacanza Team and individual contributors (see AUTHORS file)
# dr-prodigy <[email protected]> (c) 2017-2023
# ryanss <[email protected]> (c) 2014-2017
# Website: https://github.com/vacanza/python-holidays
# License: MIT (see LICENSE file)

from gettext import gettext as tr

from holidays.groups import ChristianHolidays, InternationalHolidays, IslamicHolidays
from holidays.holiday_base import HolidayBase


class Jordan(HolidayBase, ChristianHolidays, InternationalHolidays, IslamicHolidays):
"""
References:
- https://en.wikipedia.org/wiki/Public_holidays_in_Jordan
- https://www.mfa.gov.jo/content/public-holidays
"""

country = "JO"
default_language = "ar"
# %s (estimated).
estimated_label = tr("(تقدير) %s")
supported_languages = ("ar", "en_US")

def __init__(self, *args, **kwargs):
ChristianHolidays.__init__(self)
InternationalHolidays.__init__(self)
IslamicHolidays.__init__(self)
super().__init__(*args, **kwargs)

def _populate_public_holidays(self):
# New Year's Day.
self._add_new_years_day(tr("رأس السنة الميلادية"))

# Labor Day.
self._add_labor_day(tr("عيد العمال"))

# Independence Day.
self._add_holiday_may_25(tr("عيد الإستقلال"))

# Christmas Day.
self._add_christmas_day(tr("عيد الميلاد المجيد"))

# Islamic New Year.
self._add_islamic_new_year_day(tr("رأس السنة الهجرية"))

# Prophet's Birthday.
self._add_mawlid_day(tr("عيد المولد النبوي"))

# Isra and Miraj.
self._add_isra_and_miraj_day(tr("ليلة المعراج"))

# Eid al-Fitr.
self._add_eid_al_fitr_day(tr("عيد الفطر"))
# Eid al-Fitr Holiday.
self._add_eid_al_fitr_day_two(tr("عطلة عيد الفطر"))
self._add_eid_al_fitr_day_three(tr("عطلة عيد الفطر"))

# Arafat Day.
self._add_arafah_day(tr("يوم عرفة"))

# Eid al-Adha.
self._add_eid_al_adha_day(tr("عيد الأضحى"))
# Eid al-Adha Holiday.
self._add_eid_al_adha_day_two(tr("عطلة عيد الأضحى"))
self._add_eid_al_adha_day_three(tr("عطلة عيد الأضحى"))


class JO(Jordan):
pass


class JOR(Jordan):
pass
79 changes: 79 additions & 0 deletions holidays/locale/ar/LC_MESSAGES/JO.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# holidays
# --------
# A fast, efficient Python library for generating country, province and state
# specific sets of holidays on the fly. It aims to make determining whether a
# specific date is a holiday as fast and flexible as possible.
#
# Authors: Vacanza Team and individual contributors (see AUTHORS file)
# dr-prodigy <[email protected]> (c) 2017-2023
# ryanss <[email protected]> (c) 2014-2017
# Website: https://github.com/vacanza/python-holidays
# License: MIT (see LICENSE file)
#
# Jordan holidays.
#
msgid ""
msgstr ""
"Project-Id-Version: Python Holidays 0.47\n"
"POT-Creation-Date: 2024-02-28 09:55-0800\n"
"PO-Revision-Date: 2024-02-28 09:55-0800\n"
"Last-Translator: Firas Kafri <[email protected]>\n"
"Language-Team: Python Holidays Localization Team\n"
"Language: ar\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Lingua 4.15.0\n"

#. %s (estimated).
#, c-format
msgid "(تقدير) %s"
msgstr ""

#. New Year's Day.
msgid "رأس السنة الميلادية"
msgstr ""

#. Isra and Miraj.
msgid "ليلة المعراج"
msgstr ""

#. Eid al-Fitr.
msgid "عيد الفطر"
msgstr ""

#. Eid al-Fitr Holiday.
msgid "عطلة عيد الفطر"
msgstr ""

#. Labor Day.
msgid "عيد العمال"
msgstr ""

#. Independence Day.
msgid "عيد الإستقلال"
msgstr ""

#. Arafat Day.
msgid "يوم عرفة"
msgstr ""

#. Eid al-Adha.
msgid "عيد الأضحى"
msgstr ""

#. Eid al-Adha Holiday.
msgid "عطلة عيد الأضحى"
msgstr ""

#. Islamic New Year.
msgid "رأس السنة الهجرية"
msgstr ""

#. Prophet's Birthday.
msgid "عيد المولد النبوي"
msgstr ""

#. Christmas Day.
msgid "عيد الميلاد المجيد"
msgstr ""
79 changes: 79 additions & 0 deletions holidays/locale/en_US/LC_MESSAGES/JO.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# holidays
# --------
# A fast, efficient Python library for generating country, province and state
# specific sets of holidays on the fly. It aims to make determining whether a
# specific date is a holiday as fast and flexible as possible.
#
# Authors: Vacanza Team and individual contributors (see AUTHORS file)
# dr-prodigy <[email protected]> (c) 2017-2023
# ryanss <[email protected]> (c) 2014-2017
# Website: https://github.com/vacanza/python-holidays
# License: MIT (see LICENSE file)
#
# Jordan holidays en_US localization.
#
msgid ""
msgstr ""
"Project-Id-Version: Python Holidays 0.47\n"
"POT-Creation-Date: 2024-02-28 09:55-0800\n"
"PO-Revision-Date: 2024-02-28 09:55-0800\n"
"Last-Translator: Firas Kafri <[email protected]>\n"
"Language-Team: Python Holidays Localization Team\n"
"Language: en_US\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Lingua 4.15.0\n"

#. %s (estimated).
#, c-format
msgid "(تقدير) %s"
msgstr "%s (estimated)"

#. New Year's Day.
msgid "رأس السنة الميلادية"
msgstr "New Year's Day"

#. Isra and Miraj.
msgid "ليلة المعراج"
msgstr "Isra and Miraj"

#. Eid al-Fitr.
msgid "عيد الفطر"
msgstr "Eid al-Fitr"

#. Eid al-Fitr Holiday.
msgid "عطلة عيد الفطر"
msgstr "Eid al-Fitr Holiday"

#. Labor Day.
msgid "عيد العمال"
msgstr "Labor Day"

#. Independence Day.
msgid "عيد الإستقلال"
msgstr "Independence Day"

#. Arafat Day.
msgid "يوم عرفة"
msgstr "Arafat Day"

#. Eid al-Adha.
msgid "عيد الأضحى"
msgstr "Eid al-Adha"

#. Eid al-Adha Holiday.
msgid "عطلة عيد الأضحى"
msgstr "Eid al-Adha Holiday"

#. Islamic New Year.
msgid "رأس السنة الهجرية"
msgstr "Islamic New Year"

#. Prophet's Birthday.
msgid "عيد المولد النبوي"
msgstr "Prophet's Birthday"

#. Christmas Day.
msgid "عيد الميلاد المجيد"
msgstr "Christmas Day"
1 change: 1 addition & 0 deletions holidays/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
"dominican_republic": ("DominicanRepublic", "DO", "DOM"),
"ecuador": ("Ecuador", "EC", "ECU"),
"egypt": ("Egypt", "EG", "EGY"),
"jordan": ("Jordan", "JO", "JOR"),
"el_salvador": ("ElSalvador", "SV", "SLV"),
"estonia": ("Estonia", "EE", "EST"),
"eswatini": ("Eswatini", "SZ", "SZW", "Swaziland"),
Expand Down
81 changes: 81 additions & 0 deletions tests/countries/test_jordan.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# holidays
# --------
# A fast, efficient Python library for generating country, province and state
# specific sets of holidays on the fly. It aims to make determining whether a
# specific date is a holiday as fast and flexible as possible.
#
# Authors: Vacanza Team and individual contributors (see AUTHORS file)
# dr-prodigy <[email protected]> (c) 2017-2023
# ryanss <[email protected]> (c) 2014-2017
# Website: https://github.com/vacanza/python-holidays
# License: MIT (see LICENSE file)

from unittest import TestCase

from holidays.countries.jordan import Jordan, JO, JOR
from tests.common import CommonCountryTests


class TestJordan(CommonCountryTests, TestCase):
@classmethod
def setUpClass(cls):
super().setUpClass(Jordan)

def test_country_aliases(self):
self.assertAliases(Jordan, JO, JOR)

def test_2024(self):
self.assertHolidays(
Jordan(years=2024),
("2024-01-01", "رأس السنة الميلادية"),
("2024-02-08", "(تقدير) ليلة المعراج"),
("2024-04-10", "(تقدير) عيد الفطر"),
("2024-04-11", "(تقدير) عطلة عيد الفطر"),
("2024-04-12", "(تقدير) عطلة عيد الفطر"),
("2024-05-01", "عيد العمال"),
("2024-05-25", "عيد الإستقلال"),
("2024-06-15", "(تقدير) يوم عرفة"),
("2024-06-16", "(تقدير) عيد الأضحى"),
("2024-06-17", "(تقدير) عطلة عيد الأضحى"),
("2024-06-18", "(تقدير) عطلة عيد الأضحى"),
("2024-07-07", "(تقدير) رأس السنة الهجرية"),
("2024-09-15", "(تقدير) عيد المولد النبوي"),
("2024-12-25", "عيد الميلاد المجيد"),
)

def test_l10n_default(self):
self.assertLocalizedHolidays(
("2024-01-01", "رأس السنة الميلادية"),
("2024-02-08", "(تقدير) ليلة المعراج"),
("2024-04-10", "(تقدير) عيد الفطر"),
("2024-04-11", "(تقدير) عطلة عيد الفطر"),
("2024-04-12", "(تقدير) عطلة عيد الفطر"),
("2024-05-01", "عيد العمال"),
("2024-05-25", "عيد الإستقلال"),
("2024-06-15", "(تقدير) يوم عرفة"),
("2024-06-16", "(تقدير) عيد الأضحى"),
("2024-06-17", "(تقدير) عطلة عيد الأضحى"),
("2024-06-18", "(تقدير) عطلة عيد الأضحى"),
("2024-07-07", "(تقدير) رأس السنة الهجرية"),
("2024-09-15", "(تقدير) عيد المولد النبوي"),
("2024-12-25", "عيد الميلاد المجيد"),
)

def test_l10n_en_us(self):
self.assertLocalizedHolidays(
"en_US",
("2024-01-01", "New Year's Day"),
("2024-02-08", "Isra and Miraj (estimated)"),
("2024-04-10", "Eid al-Fitr (estimated)"),
("2024-04-11", "Eid al-Fitr Holiday (estimated)"),
("2024-04-12", "Eid al-Fitr Holiday (estimated)"),
("2024-05-01", "Labor Day"),
("2024-05-25", "Independence Day"),
("2024-06-15", "Arafat Day (estimated)"),
("2024-06-16", "Eid al-Adha (estimated)"),
("2024-06-17", "Eid al-Adha Holiday (estimated)"),
("2024-06-18", "Eid al-Adha Holiday (estimated)"),
("2024-07-07", "Islamic New Year (estimated)"),
("2024-09-15", "Prophet's Birthday (estimated)"),
("2024-12-25", "Christmas Day"),
)