Skip to content

Commit

Permalink
Migrate Argentina holidays to holiday groups (#1051)
Browse files Browse the repository at this point in the history
* Migrate Argentina holidays to holiday groups

* remove unused timedelta import

* Revert makel10n text length change

Co-authored-by: ~Jhellico <[email protected]>

---------

Co-authored-by: ~Jhellico <[email protected]>
  • Loading branch information
PPsyrius and KJhellico authored Mar 24, 2023
1 parent d39a65d commit bfd8a1a
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 90 deletions.
29 changes: 16 additions & 13 deletions holidays/countries/argentina.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,16 @@
# License: MIT (see LICENSE file)

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

from dateutil.easter import easter

from holidays.calendars import _get_nth_weekday_from, _get_nth_weekday_of_month
from holidays.constants import JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP
from holidays.constants import OCT, NOV, DEC, MON
from holidays.holiday_base import HolidayBase
from holidays.holiday_groups import ChristianHolidays, InternationalHolidays


class Argentina(HolidayBase):
class Argentina(HolidayBase, ChristianHolidays, InternationalHolidays):
"""
A subclass of :py:class:`HolidayBase` representing public holidays
in Argentina.
Expand Down Expand Up @@ -144,6 +142,11 @@ class Argentina(HolidayBase):
),
}

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

def _populate(self, year):
def _add_movable(hol_date: date, hol_name: str) -> None:
"""
Expand All @@ -168,12 +171,10 @@ def _add_movable(hol_date: date, hol_name: str) -> None:

# Fixed Holidays

easter_date = easter(year)

# New Year's Day.
# Status: In-Use.

self._add_holiday(tr("Año Nuevo"), JAN, 1)
self._add_new_years_day(tr("Año Nuevo"))

# Carnival days.
# Status: In-Use.
Expand All @@ -182,8 +183,8 @@ def _add_movable(hol_date: date, hol_name: str) -> None:

if 1956 <= year <= 1975 or year >= 2011:
name = tr("Día de Carnaval")
self._add_holiday(name, easter_date + td(days=-48))
self._add_holiday(name, easter_date + td(days=-47))
self._add_carnival_monday(name)
self._add_carnival_tuesday(name)

# Memory's National Day for the Truth and Justice.
# Status: In-Use
Expand Down Expand Up @@ -214,11 +215,11 @@ def _add_movable(hol_date: date, hol_name: str) -> None:
)

# Good Friday.
self._add_holiday(tr("Viernes Santo"), easter_date + td(days=-2))
self._add_good_friday(tr("Viernes Santo"))

# Labor Day.
if year >= 1930:
self._add_holiday(tr("Día del Trabajo"), MAY, 1)
self._add_labour_day(tr("Día del Trabajo"))

# May Revolution Day.
if year >= 1813:
Expand Down Expand Up @@ -259,10 +260,12 @@ def _add_movable(hol_date: date, hol_name: str) -> None:
self._add_holiday(tr("Día de la Independencia"), JUL, 9)

# Immaculate Conception.
self._add_holiday(tr("Inmaculada Concepción de María"), DEC, 8)
self._add_immaculate_conception_day(
tr("Inmaculada Concepción de María")
)

# Christmas.
self._add_holiday(tr("Navidad"), DEC, 25)
self._add_christmas_day(tr("Navidad"))

# Movable Holidays

Expand Down
56 changes: 29 additions & 27 deletions holidays/locale/en_US/LC_MESSAGES/AR.po
Original file line number Diff line number Diff line change
Expand Up @@ -16,111 +16,113 @@ msgstr ""
"Generated-By: pygettext.py 1.5\n"
"X-Generator: Poedit 3.2.2\n"

#: holidays/countries/argentina.py:71
#: ./holidays/countries/argentina.py:69
msgid "Feriado con fines turísticos"
msgstr "Bridge Public Holiday"

#: holidays/countries/argentina.py:75
#: ./holidays/countries/argentina.py:73
msgid "Bicentenario de la creación y primera jura de la bandera nacional"
msgstr "Bicentenary of the creation and first oath of the national flag"

#: holidays/countries/argentina.py:78
#: ./holidays/countries/argentina.py:76
msgid "Bicentenario de la Batalla de Tucumán"
msgstr "Bicentenary of the Battle of Tucumán"

#: holidays/countries/argentina.py:79
#: ./holidays/countries/argentina.py:77
msgid ""
"Bicentenario de la sesión inaugural de la Asamblea Nacional Constituyente "
"del año 1813"
msgstr ""
"Bicentenary of the inaugural session of the National Constituent Assembly of "
"the year 1813"
"Bicentenary of the inaugural session of the National Constituent Assembly of"
" the year 1813"

#: holidays/countries/argentina.py:83
#: ./holidays/countries/argentina.py:81
msgid "Bicentenario de la Batalla de Salta"
msgstr "Bicentenary of the Battle of Salta"

#: holidays/countries/argentina.py:84
#: ./holidays/countries/argentina.py:82
msgid "Censo nacional 2022"
msgstr "National Census Day 2022"

#: holidays/countries/argentina.py:162 holidays/countries/argentina.py:165
#: ./holidays/countries/argentina.py:165 ./holidays/countries/argentina.py:168
#, c-format
msgid "%s (Observado)"
msgstr "%s (Observed)"

#: holidays/countries/argentina.py:177
#: ./holidays/countries/argentina.py:178
msgid "Año Nuevo"
msgstr "New Year's Day"

#: holidays/countries/argentina.py:185
#: ./holidays/countries/argentina.py:186
msgid "Día de Carnaval"
msgstr "Carnival"

#: holidays/countries/argentina.py:194
#: ./holidays/countries/argentina.py:196
msgid "Día Nacional de la Memoria por la Verdad y la Justicia"
msgstr "Memory's National Day for the Truth and Justice"

#: holidays/countries/argentina.py:209
#: ./holidays/countries/argentina.py:210
msgid "Día del Veterano de Guerra"
msgstr "War Veterans Day"

#: holidays/countries/argentina.py:211
#: ./holidays/countries/argentina.py:212
msgid "Día del Veterano y de los Caidos en la Guerra de Malvinas"
msgstr "Veterans Day and the Fallen in the Malvinas War"

#: holidays/countries/argentina.py:219
#. Good Friday.
#: ./holidays/countries/argentina.py:219
msgid "Viernes Santo"
msgstr "Good Friday"

#: holidays/countries/argentina.py:226
#: ./holidays/countries/argentina.py:223
msgid "Día del Trabajo"
msgstr "Labor Day"

#: holidays/countries/argentina.py:233
#: ./holidays/countries/argentina.py:227
msgid "Día de la Revolución de Mayo"
msgstr "May Revolution Day"

#: holidays/countries/argentina.py:244
#: ./holidays/countries/argentina.py:237
msgid ""
"Día de los Derechos Argentinos sobre las Islas Malvinas, Sandwich y del "
"Atlántico Sur"
msgstr ""
"Day of Argentine Sovereignty over the Malvinas, Sandwich and South Atlantic "
"Islands"

#: holidays/countries/argentina.py:261
#: ./holidays/countries/argentina.py:253
msgid "Paso a la Inmortalidad del General Don Manuel Belgrano"
msgstr "Pass to the Immortality of General Don Manuel Belgrano"

#: holidays/countries/argentina.py:270
#: ./holidays/countries/argentina.py:261
msgid "Día de la Independencia"
msgstr "Independence Day"

#: holidays/countries/argentina.py:275
#: ./holidays/countries/argentina.py:265
msgid "Inmaculada Concepción de María"
msgstr "Immaculate Conception"

#: holidays/countries/argentina.py:280
#. Christmas.
#: ./holidays/countries/argentina.py:269
msgid "Navidad"
msgstr "Christmas"

#: holidays/countries/argentina.py:290
#: ./holidays/countries/argentina.py:279
msgid "Paso a la Inmortalidad del General Don Martín Miguel de Güemes"
msgstr "Pass to the Immortality of General Don Martín Miguel de Güemes"

#: holidays/countries/argentina.py:307
#: ./holidays/countries/argentina.py:296
msgid "Paso a la Inmortalidad del General Don José de San Martin"
msgstr "Pass to the Immortality of General Don José de San Martin"

#: holidays/countries/argentina.py:327
#: ./holidays/countries/argentina.py:316
msgid "Día del Respeto a la Diversidad Cultural"
msgstr "Respect for Cultural Diversity Day"

#: holidays/countries/argentina.py:329
#: ./holidays/countries/argentina.py:318
msgid "Día de la Raza"
msgstr "Columbus day"

#: holidays/countries/argentina.py:340
#: ./holidays/countries/argentina.py:329
msgid "Día de la Soberanía Nacional"
msgstr "National Sovereignty Day"
52 changes: 27 additions & 25 deletions holidays/locale/es/LC_MESSAGES/AR.po
Original file line number Diff line number Diff line change
Expand Up @@ -16,107 +16,109 @@ msgstr ""
"Generated-By: Lingua 4.15.0\n"
"X-Generator: Poedit 3.2.2\n"

#: holidays/countries/argentina.py:71
#: ./holidays/countries/argentina.py:69
msgid "Feriado con fines turísticos"
msgstr ""

#: holidays/countries/argentina.py:75
#: ./holidays/countries/argentina.py:73
msgid "Bicentenario de la creación y primera jura de la bandera nacional"
msgstr ""

#: holidays/countries/argentina.py:78
#: ./holidays/countries/argentina.py:76
msgid "Bicentenario de la Batalla de Tucumán"
msgstr ""

#: holidays/countries/argentina.py:79
#: ./holidays/countries/argentina.py:77
msgid ""
"Bicentenario de la sesión inaugural de la Asamblea Nacional Constituyente "
"del año 1813"
msgstr ""

#: holidays/countries/argentina.py:83
#: ./holidays/countries/argentina.py:81
msgid "Bicentenario de la Batalla de Salta"
msgstr ""

#: holidays/countries/argentina.py:84
#: ./holidays/countries/argentina.py:82
msgid "Censo nacional 2022"
msgstr ""

#: holidays/countries/argentina.py:162 holidays/countries/argentina.py:165
#: ./holidays/countries/argentina.py:165 ./holidays/countries/argentina.py:168
#, c-format
msgid "%s (Observado)"
msgstr ""

#: holidays/countries/argentina.py:177
#: ./holidays/countries/argentina.py:178
msgid "Año Nuevo"
msgstr ""

#: holidays/countries/argentina.py:185
#: ./holidays/countries/argentina.py:186
msgid "Día de Carnaval"
msgstr ""

#: holidays/countries/argentina.py:194
#: ./holidays/countries/argentina.py:196
msgid "Día Nacional de la Memoria por la Verdad y la Justicia"
msgstr ""

#: holidays/countries/argentina.py:209
#: ./holidays/countries/argentina.py:210
msgid "Día del Veterano de Guerra"
msgstr ""

#: holidays/countries/argentina.py:211
#: ./holidays/countries/argentina.py:212
msgid "Día del Veterano y de los Caidos en la Guerra de Malvinas"
msgstr ""

#: holidays/countries/argentina.py:219
#. Good Friday.
#: ./holidays/countries/argentina.py:219
msgid "Viernes Santo"
msgstr ""

#: holidays/countries/argentina.py:226
#: ./holidays/countries/argentina.py:223
msgid "Día del Trabajo"
msgstr ""

#: holidays/countries/argentina.py:233
#: ./holidays/countries/argentina.py:227
msgid "Día de la Revolución de Mayo"
msgstr ""

#: holidays/countries/argentina.py:244
#: ./holidays/countries/argentina.py:237
msgid ""
"Día de los Derechos Argentinos sobre las Islas Malvinas, Sandwich y del "
"Atlántico Sur"
msgstr ""

#: holidays/countries/argentina.py:261
#: ./holidays/countries/argentina.py:253
msgid "Paso a la Inmortalidad del General Don Manuel Belgrano"
msgstr ""

#: holidays/countries/argentina.py:270
#: ./holidays/countries/argentina.py:261
msgid "Día de la Independencia"
msgstr ""

#: holidays/countries/argentina.py:275
#: ./holidays/countries/argentina.py:265
msgid "Inmaculada Concepción de María"
msgstr ""

#: holidays/countries/argentina.py:280
#. Christmas.
#: ./holidays/countries/argentina.py:269
msgid "Navidad"
msgstr ""

#: holidays/countries/argentina.py:290
#: ./holidays/countries/argentina.py:279
msgid "Paso a la Inmortalidad del General Don Martín Miguel de Güemes"
msgstr ""

#: holidays/countries/argentina.py:307
#: ./holidays/countries/argentina.py:296
msgid "Paso a la Inmortalidad del General Don José de San Martin"
msgstr ""

#: holidays/countries/argentina.py:327
#: ./holidays/countries/argentina.py:316
msgid "Día del Respeto a la Diversidad Cultural"
msgstr ""

#: holidays/countries/argentina.py:329
#: ./holidays/countries/argentina.py:318
msgid "Día de la Raza"
msgstr ""

#: holidays/countries/argentina.py:340
#: ./holidays/countries/argentina.py:329
msgid "Día de la Soberanía Nacional"
msgstr ""
Loading

0 comments on commit bfd8a1a

Please sign in to comment.