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

Migrate Curaçao to holiday groups #1309

Merged
merged 9 commits into from
Jun 16, 2023
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ The list of supported countries, their subdivisions and supported languages
* - Curacao
- CW
-
-
- en_US, nl, **pap**, uk
* - Cyprus
- CY
-
Expand Down
146 changes: 100 additions & 46 deletions holidays/countries/curacao.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,81 +11,135 @@

from datetime import date
from datetime import timedelta as td
from gettext import gettext as tr

from dateutil.easter import easter

from holidays.constants import JAN, APR, MAY, JUL, AUG, OCT, DEC
from holidays.constants import APR, MAY, JUL, OCT
from holidays.holiday_base import HolidayBase
from holidays.holiday_groups import ChristianHolidays, InternationalHolidays


class Curacao(HolidayBase):
class Curacao(HolidayBase, ChristianHolidays, InternationalHolidays):
"""
https://loketdigital.gobiernu.cw/Loket/product/571960bbe1e5fe8712b10a1323630e70
https://loketdigital.gobiernu.cw/Loket/product/571960bbe1e5fe8712b10a1323630e70 # noqa: E501
https://en.wikipedia.org/wiki/Public_holidays_in_Cura%C3%A7ao

New Year's Eve (Vispu di Aña Nobo) is a half-day public holiday, though
this isn't supported by Python Holidays so it won't be implemented.
"""

country = "CW"
default_language = "pap"
supported_languages = ("en_US", "nl", "pap", "uk")

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

def _populate(self, year):
# 1954: Creation of the Netherlands Antilles.
if year <= 1953:
return None

super()._populate(year)

# Aña Nobo.
# Status: In-Use.

# New Year's Day
self[date(year, JAN, 1)] = "Nieuwjaarsdag [New Year's Day]"
self._add_new_years_day(tr("Aña Nobo"))

# Dialuna despues di Carnaval Grandi.
# Status: In-Use.
# Started in 1947.

# Carnival Monday
self._add_ash_monday(tr("Dialuna despues di Carnaval Grandi"))

easter_date = easter(year)
# Carnaval Monday
self[
easter_date + td(days=-48)
] = "Maandag na de Grote Karnaval [Carnaval Monday]"
# Bièrnèsantu.
# Status: In-Use.

# Good Friday
self[easter_date + td(days=-2)] = "Goede Vrijdag [Good Friday]"
self._add_good_friday(tr("Bièrnèsantu"))

# Easter Monday
self[
easter_date + td(days=+1)
] = "Di Dos Dia di Pasku di Resureccion [Easter Monday]"
# Pasku di Resurekshon.
# Status: In-Use

# King's Day
if year >= 2014:
kings_day = date(year, APR, 27)
if self._is_sunday(kings_day):
kings_day += td(days=-1)
# Easter Sunday
self._add_easter_sunday(tr("Pasku di Resurekshon"))

self[kings_day] = "Koningsdag [King's Day]"
# Di dos dia di Pasku di Resurekshon.
# Status: In-Use.

# Queen's Day
if 1891 <= year <= 2013:
queens_day = date(year, APR, 30)
if year <= 1948:
queens_day = date(year, AUG, 31)
# Easter Monday
self._add_easter_monday(tr("Di dos dia di Pasku di Resurekshon"))

# Dia di la Reina/Dia di Rey.
# Status: In-Use.
# Started under Queen Wilhelmina in 1891.
# Queen Beatrix kept Queen Juliana's Birthday after her coronation.
# Switched to Aña di Rey in 2014 for King Willem-Alexander.
# Have its name changed again to Dia di Rey from 2021 onwards.

# King's / Queen's Day
name = (
# King's Day.
tr("Dia di Rey")
if year >= 2014
# Queen's Day.
else tr("Dia di la Reina")
)
if year >= 2014:
dt = date(year, APR, 27)
else:
dt = date(year, APR, 30)
if self._is_sunday(dt):
dt += td(days=-1) if year >= 1980 else td(days=+1)
self._add_holiday(name, dt)

# Dia di Obrero.
# Status: In-Use.
# If fall on Sunday, then this will be move to next working day.

dt = date(year, MAY, 1)
if self._is_sunday(dt) or (self._is_monday(dt) and year <= 1979):
dt += td(days=+1)
# Labor Day
self._add_holiday(tr("Dia di Obrero"), dt)

# Dia di Asenshon.
# Status: In-Use.

if self._is_sunday(queens_day):
queens_day += td(days=1) if year < 1980 else td(days=-1)
# Ascension Day
self._add_ascension_thursday(tr("Dia di Asenshon"))

self[queens_day] = "Anja di La Reina [Queen's Day]"
# Dia di Himno i Bandera.
# Status: In-Use.
# Starts in 1984.

# Labour Day
labour_day = date(year, MAY, 1)
if self._is_sunday(labour_day):
labour_day += td(days=+1)
self[labour_day] = "Dia di Obrero [Labour Day]"
if year >= 1984:
# National Anthem and Flag Day
self._add_holiday(tr("Dia di Himno i Bandera"), JUL, 2)

# Ascension Day
self[easter_date + td(days=+39)] = "Hemelvaartsdag [Ascension Day]"
# Dia di Pais Kòrsou / Dia di autonomia.
# Status: In-Use.
# Starts in 2010.

# Dia di Himno y Bandera
self[
date(year, JUL, 2)
] = "Dia di Himno y Bandera [National Anthem & Flag Day]"
if year >= 2010:
# Curaçao Day
self._add_holiday(tr("Dia di Pais Kòrsou"), OCT, 10)

# Dia di Pais Kòrsou
self[date(year, OCT, 10)] = "Dia di Pais Kòrsou [Curaçao Day]"
# Pasku di Nasementu.
# Status: In-Use.

# Christmas Day
self[date(year, DEC, 25)] = "Kerstdag [Christmas]"
self._add_christmas_day(tr("Pasku di Nasementu"))

# Di dos dia di Pasku di Nasementu.
# Status: In-Use.

# Second Christmas
self[date(year, DEC, 26)] = "2de Kerstdag [Second Christmas]"
# Second Day of Christmas
self._add_christmas_day_two(tr("Di dos dia di Pasku di Nasementu"))


class CW(Curacao):
Expand Down
82 changes: 82 additions & 0 deletions holidays/locale/en_US/LC_MESSAGES/CW.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Curacao holidays en_US localization.
# Authors: PPsyrius <ppsyrius@ppsyrius.dev>, (c) 2023.
#
msgid ""
msgstr ""
"Project-Id-Version: Python Holidays 0.27\n"
"POT-Creation-Date: 2023-06-13 16:35+0700\n"
"PO-Revision-Date: \n"
"Last-Translator: PPsyrius <ppsyrius@ppsyrius.dev>\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.1\n"

#. New Year's Day
#: ./holidays/countries/curacao.py:50
msgid "Aña Nobo"
msgstr "New Year's Day"

#. Carnival Monday
#: ./holidays/countries/curacao.py:57
msgid "Dialuna despues di Carnaval Grandi"
msgstr "Carnival Monday"

#. Good Friday
#: ./holidays/countries/curacao.py:63
msgid "Bièrnèsantu"
msgstr "Good Friday"

#. Easter Sunday
#: ./holidays/countries/curacao.py:69
msgid "Pasku di Resurekshon"
msgstr "Easter Sunday"

#. Easter Monday
#: ./holidays/countries/curacao.py:75
msgid "Di dos dia di Pasku di Resurekshon"
msgstr "Easter Monday"

#. King's Day.
#: ./holidays/countries/curacao.py:87
msgid "Dia di Rey"
msgstr "King's Day"

#. Queen's Day.
#: ./holidays/countries/curacao.py:90
msgid "Dia di la Reina"
msgstr "Queen's Day"

#. Labor Day
#: ./holidays/countries/curacao.py:108
msgid "Dia di Obrero"
msgstr "Labor Day"

#. Ascension Day
#: ./holidays/countries/curacao.py:114
msgid "Dia di Asenshon"
msgstr "Ascension Day"

#. National Anthem and Flag Day
#: ./holidays/countries/curacao.py:122
msgid "Dia di Himno i Bandera"
msgstr "National Anthem and Flag Day"

#. Curaçao Day
#: ./holidays/countries/curacao.py:130
msgid "Dia di Pais Kòrsou"
msgstr "Curaçao Day"

#. Christmas Day
#: ./holidays/countries/curacao.py:136
msgid "Pasku di Nasementu"
msgstr "Christmas Day"

#. Second Day of Christmas
#: ./holidays/countries/curacao.py:142
msgid "Di dos dia di Pasku di Nasementu"
msgstr "Second Day of Christmas"
82 changes: 82 additions & 0 deletions holidays/locale/nl/LC_MESSAGES/CW.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Curacao holidays nl localization.
# Authors: PPsyrius <ppsyrius@ppsyrius.dev>, (c) 2023.
#
msgid ""
msgstr ""
"Project-Id-Version: Python Holidays 0.27\n"
"POT-Creation-Date: 2023-06-13 16:35+0700\n"
"PO-Revision-Date: \n"
"Last-Translator: PPsyrius <ppsyrius@ppsyrius.dev>\n"
"Language-Team: Python Holidays localization team\n"
"Language: nl\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.1\n"

#. New Year's Day
#: ./holidays/countries/curacao.py:50
msgid "Aña Nobo"
msgstr "Nieuwjaarsdag"

#. Carnival Monday
#: ./holidays/countries/curacao.py:57
msgid "Dialuna despues di Carnaval Grandi"
msgstr "De maandag na de Grote Karnaval"

#. Good Friday
#: ./holidays/countries/curacao.py:63
msgid "Bièrnèsantu"
msgstr "Goede Vrijdag"

#. Easter Sunday
#: ./holidays/countries/curacao.py:69
msgid "Pasku di Resurekshon"
msgstr "Paasdag"

#. Easter Monday
#: ./holidays/countries/curacao.py:75
msgid "Di dos dia di Pasku di Resurekshon"
msgstr "Tweede paasdag"

#. King's Day.
#: ./holidays/countries/curacao.py:87
msgid "Dia di Rey"
msgstr "Koningsdag"

#. Queen's Day.
#: ./holidays/countries/curacao.py:90
msgid "Dia di la Reina"
msgstr "Koninginnedag"

#. Labor Day
#: ./holidays/countries/curacao.py:108
msgid "Dia di Obrero"
msgstr "Dag van de Arbeid"

#. Ascension Day
#: ./holidays/countries/curacao.py:114
msgid "Dia di Asenshon"
msgstr "Hemelvaartsdag"

#. National Anthem and Flag Day
#: ./holidays/countries/curacao.py:122
msgid "Dia di Himno i Bandera"
msgstr "Nationale vlag en volkslied"

#. Curaçao Day
#: ./holidays/countries/curacao.py:130
msgid "Dia di Pais Kòrsou"
msgstr "Dag van Land Curaçao"

#. Christmas Day
#: ./holidays/countries/curacao.py:136
msgid "Pasku di Nasementu"
msgstr "Kerst"

#. Second Day of Christmas
#: ./holidays/countries/curacao.py:142
msgid "Di dos dia di Pasku di Nasementu"
msgstr "Tweede kerstdag"
Loading