Skip to content

Commit

Permalink
Update Costa Rica holidays (#1657)
Browse files Browse the repository at this point in the history
  • Loading branch information
KJhellico committed Jan 23, 2024
1 parent 9a7179a commit 06486e7
Show file tree
Hide file tree
Showing 5 changed files with 227 additions and 175 deletions.
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ All other default values are highlighted with bold:
- CR
-
- en_US, **es**, uk
-
- OPTIONAL
* - Croatia
- HR
-
Expand Down
36 changes: 20 additions & 16 deletions holidays/countries/costa_rica.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

from gettext import gettext as tr

from holidays.constants import OPTIONAL, PUBLIC
from holidays.groups import ChristianHolidays, InternationalHolidays
from holidays.observed_holiday_base import (
ObservedHolidayBase,
Expand All @@ -24,6 +25,7 @@ class CostaRica(ObservedHolidayBase, ChristianHolidays, InternationalHolidays):
"""
References:
- https://en.wikipedia.org/wiki/Public_holidays_in_Costa_Rica
- http://www.pgrweb.go.cr/scij/avanzada_pgr.aspx
- Law #8442 from 19.04.2005
- Law #8604 from 17.09.2007
- Law #8753 from 25.07.2009
Expand All @@ -36,6 +38,7 @@ class CostaRica(ObservedHolidayBase, ChristianHolidays, InternationalHolidays):
default_language = "es"
# %s (observed).
observed_label = tr("%s (observado)")
supported_categories = (OPTIONAL, PUBLIC)
supported_languages = ("en_US", "es", "uk")

def __init__(self, *args, **kwargs):
Expand Down Expand Up @@ -73,28 +76,16 @@ def _populate_public_holidays(self):
elif 2020 <= self._year <= 2024:
self._move_holiday(jul_25)

# Feast of Our Lady of the Angels.
self._add_holiday_aug_2(tr("Fiesta de Nuestra Señora de los Ángeles"))

# Mother's Day.
dt = self._add_assumption_of_mary_day(tr("Día de la Madre"))
if 2005 <= self._year <= 2007:
self._move_holiday(dt, rule=WORKDAY_TO_NEXT_MON)
elif self._year in {2020, 2023, 2024}:
self._move_holiday(dt)

if self._year >= 2022:
aug_31 = self._add_holiday_aug_31(
# Day of the Black Person and Afro-Costa Rican Culture.
self.tr("Día de la Persona Negra y la Cultura Afrocostarricense")
)
if self._year in {2022, 2023}:
# Move to next Sunday.
self._move_holiday(aug_31, rule=ALL_TO_NEXT_SUN)

# Independence Day.
sep_15 = self._add_holiday_sep_15(tr("Día de la Independencia"))
if self._year in {2020, 2021, 2022, 2024}:
if self._year in {2020, 2021, 2022}:
self._move_holiday(sep_15)

if self._year <= 2019:
Expand All @@ -104,15 +95,28 @@ def _populate_public_holidays(self):
rule=WORKDAY_TO_NEXT_MON,
)

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

def _populate_optional_holidays(self):
# Feast of Our Lady of the Angels.
self._add_holiday_aug_2(tr("Fiesta de Nuestra Señora de los Ángeles"))

if self._year >= 2021:
aug_31 = self._add_holiday_aug_31(
# Day of the Black Person and Afro-Costa Rican Culture.
self.tr("Día de la Persona Negra y la Cultura Afrocostarricense")
)
if self._year in {2021, 2022, 2023}:
# Move to next Sunday.
self._move_holiday(aug_31, rule=ALL_TO_NEXT_SUN)

if self._year >= 2020:
# Army Abolition Day.
dec_1 = self._add_holiday_dec_1(tr("Día de la Abolición del Ejército"))
if self._year in {2020, 2021, 2022}:
self._move_holiday(dec_1)

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


class CR(CostaRica):
pass
Expand Down
10 changes: 5 additions & 5 deletions holidays/locale/en_US/LC_MESSAGES/CR.po
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
#
msgid ""
msgstr ""
"Project-Id-Version: Python Holidays 0.41\n"
"Project-Id-Version: Python Holidays 0.42\n"
"POT-Creation-Date: 2023-03-22 22:55+0200\n"
"PO-Revision-Date: 2023-05-03 18:39-0700\n"
"Last-Translator: Arkadii Yakovets <ark@cho.red>\n"
"PO-Revision-Date: 2024-01-23 17:38+0200\n"
"Last-Translator: ~Jhellico <jhellico@gmail.com>\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"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"Generated-By: pygettext.py 1.5\n"
"X-Generator: Poedit 3.3\n"
"X-Generator: Poedit 3.4\n"

#. %s (observed).
#, c-format
Expand All @@ -39,7 +39,7 @@ msgstr "Juan Santamaría Day"

#. International Labor Day.
msgid "Día Internacional del Trabajo"
msgstr "International Workers' Day"
msgstr "International Labor Day"

#. Annexation of the Party of Nicoya to Costa Rica.
msgid "Anexión del Partido de Nicoya a Costa Rica"
Expand Down

0 comments on commit 06486e7

Please sign in to comment.