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

Update the Philippines holidays: add en_PH, en_US, fil, th localization #2093

Merged
merged 9 commits into from
Nov 2, 2024
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -748,8 +748,8 @@ All other default values are highlighted with bold:
* - Philippines
- PH
-
-
-
- **en_PH**, en_US, fil, th
- WORKDAY
* - Poland
- PL
-
Expand Down
119 changes: 79 additions & 40 deletions holidays/countries/philippines.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@
# Website: https://github.com/vacanza/holidays
# License: MIT (see LICENSE file)

from gettext import gettext as tr

from holidays.calendars import _CustomChineseHolidays, _CustomIslamicHolidays
from holidays.calendars.gregorian import JAN, FEB, APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV, DEC
from holidays.constants import PUBLIC, WORKDAY
from holidays.groups import (
ChineseCalendarHolidays,
ChristianHolidays,
Expand All @@ -37,13 +40,24 @@ class Philippines(
- https://en.wikipedia.org/wiki/Public_holidays_in_the_Philippines
- `Revised Administrative Code of 1987 <https://www.officialgazette.gov.ph/1987/07/25/executive-order-no-292-book-ichapter-7-regular-holidays-and-nationwide-special-days/>`_
- `Republic Act No. 9177 <https://www.officialgazette.gov.ph/2002/11/13/republic-act-no-9177/>`_
- `Republic Act No. 9256 <https://www.officialgazette.gov.ph/2004/02/25/republic-act-no-9256/>`_
- `Republic Act No. 9492 <https://www.officialgazette.gov.ph/2007/07/24/republic-act-no-9492/>`_
- `Republic Act No. 9645 <https://www.officialgazette.gov.ph/2009/06/12/republic-act-no-9645/>`_
- `Republic Act No. 9849 <https://www.officialgazette.gov.ph/2009/12/11/republic-act-no-9849/>`_
- `Republic Act No. 10966 <https://www.officialgazette.gov.ph/2017/12/28/republic-act-no-10966/>`_
- `Nationwide holidays 2018-2024 <https://www.officialgazette.gov.ph/nationwide-holidays/2018/>`_
- `Proclamation No. 944/2020` <https://www.officialgazette.gov.ph/2020/05/19/proclamation-no-944-s-2020/>`_
- `Proclamation No. 985/2020` <https://www.officialgazette.gov.ph/2020/07/29/proclamation-no-985-s-2020/>`_
- `Proclamation No. 665/2024` <https://www.officialgazette.gov.ph/2024/08/15/proclamation-no-665-s-2024/>`_
- `Proclamation No. 729/2024` <https://www.officialgazette.gov.ph/2024/10/30/proclamation-no-729-s-2024/>`_
- `Nationwide holidays 2018-2025 <https://www.officialgazette.gov.ph/nationwide-holidays/2018/>`_
"""

country = "PH"
supported_categories = (PUBLIC, WORKDAY)
default_language = "en_PH"
# %s (estimated).
estimated_label = tr("%s (estimated)")
supported_languages = ("en_PH", "en_US", "fil", "th")

def __init__(self, *args, **kwargs):
ChineseCalendarHolidays.__init__(self, cls=PhilippinesChineseHolidays)
Expand All @@ -58,98 +72,114 @@ def _populate_public_holidays(self):
return None

# New Year's Day.
self._add_new_years_day("New Year's Day")
self._add_new_years_day(tr("New Year's Day"))

# Chinese New Year.
if self._year >= 2012 and self._year != 2023:
self._add_chinese_new_years_day("Chinese New Year")
# Chinese New Year.
self._add_chinese_new_years_day(tr("Chinese New Year"))

# EDSA People Power Revolution Anniversary.
if self._year >= 2016 and self._year not in {2017, 2024}:
if 2016 <= self._year <= 2023 and self._year != 2017:
dates_obs = {
2023: (FEB, 24),
}
self._add_holiday(
"EDSA People Power Revolution Anniversary", dates_obs.get(self._year, (FEB, 25))
# EDSA People Power Revolution Anniversary.
tr("EDSA People Power Revolution Anniversary"),
dates_obs.get(self._year, (FEB, 25)),
)

# Maundy Thursday.
self._add_holy_thursday("Maundy Thursday")
self._add_holy_thursday(tr("Maundy Thursday"))

# Good Friday.
self._add_good_friday("Good Friday")
self._add_good_friday(tr("Good Friday"))

# Black Saturday.
if self._year >= 2013:
self._add_holy_saturday("Black Saturday")
# Black Saturday.
self._add_holy_saturday(tr("Black Saturday"))

# Day of Valor.
dates_obs = {
2008: (APR, 7),
2009: (APR, 6),
2023: (APR, 10),
}
PPsyrius marked this conversation as resolved.
Show resolved Hide resolved
self._add_holiday("Araw ng Kagitingan (Day of Valor)", dates_obs.get(self._year, (APR, 9)))
# Day of Valor.
self._add_holiday(tr("Araw ng Kagitingan"), dates_obs.get(self._year, (APR, 9)))

# Labor Day.
self._add_labor_day("Labor Day")
self._add_labor_day(tr("Labor Day"))

# Independence Day.
dates_obs = {
2007: (JUN, 11),
2008: (JUN, 9),
2010: (JUN, 14),
}
self._add_holiday("Independence Day", dates_obs.get(self._year, (JUN, 12)))
# Independence Day.
self._add_holiday(tr("Independence Day"), dates_obs.get(self._year, (JUN, 12)))

# Ninoy Aquino Day.
dates_obs = {
2007: (AUG, 20),
2008: (AUG, 18),
2010: (AUG, 23),
}
self._add_holiday("Ninoy Aquino Day", dates_obs.get(self._year, (AUG, 21)))
if self._year >= 2004:
dates_obs = {
2007: (AUG, 20),
2008: (AUG, 18),
2010: (AUG, 23),
2024: (AUG, 23),
}
# Ninoy Aquino Day.
self._add_holiday(tr("Ninoy Aquino Day"), dates_obs.get(self._year, (AUG, 21)))

# National Heroes Day.
name = "National Heroes Day"
name = tr("National Heroes Day")
if self._year >= 2007:
self._add_holiday_last_mon_of_aug(name)
else:
self._add_holiday_last_sun_of_aug(name)

# All Saints' Day.
self._add_all_saints_day("All Saints' Day")
self._add_all_saints_day(tr("All Saints' Day"))

# Bonifacio Day.
dates_obs = {
2008: (DEC, 1),
2010: (NOV, 29),
}
self._add_holiday("Bonifacio Day", dates_obs.get(self._year, (NOV, 30)))
# Bonifacio Day.
self._add_holiday(tr("Bonifacio Day"), dates_obs.get(self._year, (NOV, 30)))

# Immaculate Conception.
if self._year >= 2019:
self._add_immaculate_conception_day("Feast of the Immaculate Conception of Mary")
# Immaculate Conception.
self._add_immaculate_conception_day(tr("Feast of the Immaculate Conception of Mary"))

# Christmas Day.
self._add_christmas_day("Christmas Day")
self._add_christmas_day(tr("Christmas Day"))

# Rizal Day.
dates_obs = {
2010: (DEC, 27),
}
self._add_holiday("Rizal Day", dates_obs.get(self._year, (DEC, 30)))
# Rizal Day.
self._add_holiday(tr("Rizal Day"), dates_obs.get(self._year, (DEC, 30)))

# Last Day of the Year.
if self._year not in {2021, 2022}:
self._add_new_years_eve("Last Day of the Year")
# New Year's Eve.
self._add_new_years_eve(tr("Last Day of the Year"))

# Eid al-Fitr.
if self._year >= 2002:
self._add_eid_al_fitr_day("Eid'l Fitr (Feast of Ramadhan)")
# Eid al-Fitr.
self._add_eid_al_fitr_day(tr("Eid'l Fitr"))

# Eid al-Adha.
if self._year >= 2010:
self._add_eid_al_adha_day("Eid'l Adha (Feast of Sacrifice)")
# Eid al-Adha.
self._add_eid_al_adha_day(tr("Eid'l Adha"))

def _populate_workday_holidays(self):
# Added in 2009, get special non-working day status in 2025:
if self._year >= 2009 and self._year != 2025:
# Founding Anniversary of Iglesia ni Cristo.
self._add_holiday_jul_27(tr("Founding Anniversary of Iglesia ni Cristo"))

# Added from 2025 onwards as first decreed in
# https://www.officialgazette.gov.ph/downloads/2024/10oct/20241030-PROC-727-FRM.pdf
if self._year >= 2025:
# EDSA People Power Revolution Anniversary.
self._add_holiday_feb_25(tr("EDSA People Power Revolution Anniversary"))


class PH(Philippines):
Expand Down Expand Up @@ -225,8 +255,10 @@ class PhilippinesIslamicHolidays(_CustomIslamicHolidays):


class PhilippinesStaticHolidays:
additional_special = "Additional special (non-working) day"
election_special = "Elections special (non-working) day"
# Additional special (non-working) day.
additional_special = tr("Additional special (non-working) day")
# Elections special (non-working) day.
election_special = tr("Elections special (non-working) day")

special_public_holidays = {
2008: (
Expand Down Expand Up @@ -289,4 +321,11 @@ class PhilippinesStaticHolidays:
(NOV, 2, additional_special),
(DEC, 24, additional_special),
),
2025: (
(JUL, 27, additional_special),
# All Saints' Day Eve.
(OCT, 31, tr("All Saints' Day Eve")),
# Christmas Eve.
(DEC, 24, tr("Christmas Eve")),
),
}
128 changes: 128 additions & 0 deletions holidays/locale/en_PH/LC_MESSAGES/PH.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
# 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 <dr.prodigy.github@gmail.com> (c) 2017-2023
# ryanss <ryanssdev@icloud.com> (c) 2014-2017
# Website: https://github.com/vacanza/holidays
# License: MIT (see LICENSE file)
#
# The Philippines holidays.
#
msgid ""
msgstr ""
"Project-Id-Version: Holidays 0.60\n"
"POT-Creation-Date: 2024-10-30 02:45+0700\n"
"PO-Revision-Date: 2024-11-02 01:47+0700\n"
"Last-Translator: PPsyrius <ppsyrius@ppsyrius.dev>\n"
"Language-Team: Holidays Localization Team\n"
"Language: en_PH\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Lingva 5.0.3\n"
"X-Generator: Poedit 3.5\n"

#. New Year's Day.
msgid "New Year's Day"
msgstr ""

#. Chinese New Year.
msgid "Chinese New Year"
msgstr ""

#. EDSA People Power Revolution Anniversary.
msgid "EDSA People Power Revolution Anniversary"
msgstr ""

#. Maundy Thursday.
msgid "Maundy Thursday"
msgstr ""

#. Good Friday.
msgid "Good Friday"
msgstr ""

#. Black Saturday.
msgid "Black Saturday"
msgstr ""

#. Day of Valor.
msgid "Araw ng Kagitingan"
msgstr ""

#. Labor Day.
msgid "Labor Day"
msgstr ""

#. Independence Day.
msgid "Independence Day"
msgstr ""

#. Founding Anniversary of Iglesia ni Cristo.
msgid "Founding Anniversary of Iglesia ni Cristo"
msgstr ""

#. Ninoy Aquino Day.
msgid "Ninoy Aquino Day"
msgstr ""

#. National Heroes Day.
msgid "National Heroes Day"
msgstr ""

#. All Saints' Day Eve.
msgid "All Saints' Day Eve"
msgstr ""

#. All Saints' Day.
msgid "All Saints' Day"
msgstr ""

#. Bonifacio Day.
msgid "Bonifacio Day"
msgstr ""

#. Immaculate Conception.
msgid "Feast of the Immaculate Conception of Mary"
msgstr ""

#. Christmas Eve.
msgid "Christmas Eve"
msgstr ""

#. Christmas Day.
msgid "Christmas Day"
msgstr ""

#. Rizal Day.
msgid "Rizal Day"
msgstr ""

#. New Year's Eve.
msgid "Last Day of the Year"
msgstr ""

#. Eid al-Fitr.
msgid "Eid'l Fitr"
msgstr ""

#. Eid al-Adha.
msgid "Eid'l Adha"
msgstr ""

#. Additional special (non-working) day.
msgid "Additional special (non-working) day"
msgstr ""

#. Elections special (non-working) day.
msgid "Elections special (non-working) day"
msgstr ""

#. %s (estimated).
#, c-format
msgid "%s (estimated)"
msgstr ""
Loading