vacanza / holidays

Generate and work with holidays in Python
https://pypi.org/project/holidays
MIT License
1.45k stars 460 forks source link

I want to contribute Kuwait information, but I don't know how. #1705

Closed jamjam0109 closed 7 months ago

jamjam0109 commented 7 months ago

I've written the code below and I would like to receive feedback and have it applied, but I don't know how to use Git well. I wonder if there's someone who could contribute on my behalf.

from gettext import gettext as tr

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

class Kuwait(HolidayBase, InternationalHolidays, IslamicHolidays):
    """
    References:
    - https://www.officeholidays.com/countries/kuwait
    - https://en.wikipedia.org/wiki/2024_in_Kuwait
    - https://www.timeanddate.com/holidays/kuwait/2024
    """

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

    def __init__(self, *args, **kwargs):
        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("رأس السنة الميلادية"))

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

        # National Day.
        self._add_holiday_feb_25(tr("اليوم الوطني"))

        # Liberation Day.
        self._add_holiday_feb_26(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("عطلة عيد الأضحى"))

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

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

class KW(Kuwait):
    pass

class KWT(Kuwait):
    pass
arkid15r commented 7 months ago

@jamjam0109, thanks for doing what you can, that's a great effort! The code looks fine (didn't run it yet). It still needs some tests and l10n work. I'll look into adding those and specifying you as a co-author later this week.

arkid15r commented 7 months ago

Closing this out as https://github.com/vacanza/python-holidays/pull/1707 has been merged.