Skip to content

Commit

Permalink
Add Afghanistan holidays (#2198)
Browse files Browse the repository at this point in the history
Co-authored-by: PPsyrius <[email protected]>
Co-authored-by: Arkadii Yakovets <[email protected]>
Co-authored-by: Arkadii Yakovets <[email protected]>
  • Loading branch information
4 people authored Jan 5, 2025
1 parent 9c8b43a commit 512ad34
Show file tree
Hide file tree
Showing 10 changed files with 2,000 additions and 1 deletion.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ Pedro Baptista
Peter Zsak
Pieter van der Westhuizen
Piotr Staniów
Prateekshit Jaiswal
Raphael Borg Ellul Vincenti
Raychel Mattheeuw
Reinaldo Ramos
Expand Down
7 changes: 6 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ Available Countries
.. _ISO 639-1 code: https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
.. _ISO 639-2 code: https://en.wikipedia.org/wiki/List_of_ISO_639-2_codes

We currently support 155 country codes. The standard way to refer to a country
We currently support 156 country codes. The standard way to refer to a country
is by using its `ISO 3166-1 alpha-2 code`_, the same used for domain names, and
for a subdivision its `ISO 3166-2 code`_. Some countries have common or foreign
names or abbreviations as aliases for their subdivisions. These are defined in
Expand Down Expand Up @@ -180,6 +180,11 @@ All other default values are highlighted with bold:
- Subdivisions
- Supported Languages
- Supported Categories
* - Afghanistan
- AF
-
- en_US, **fa_AF**, ps_AF
-
* - Albania
- AL
-
Expand Down
1 change: 1 addition & 0 deletions holidays/countries/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

# flake8: noqa: F401

from .afghanistan import Afghanistan, AF, AFG
from .albania import Albania, AL, ALB
from .algeria import Algeria, DZ, DZA
from .american_samoa import AmericanSamoa, AS, ASM, HolidaysAS
Expand Down
104 changes: 104 additions & 0 deletions holidays/countries/afghanistan.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
# 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 <[email protected]> (c) 2017-2023
# ryanss <[email protected]> (c) 2014-2017
# Website: https://github.com/vacanza/holidays
# License: MIT (see LICENSE file)

from gettext import gettext as tr

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


class Afghanistan(HolidayBase, InternationalHolidays, IslamicHolidays):
"""
https://en.wikipedia.org/wiki/Public_holidays_in_Afghanistan
https://www.timeanddate.com/holidays/afghanistan/
"""

country = "AF"
default_language = "fa_AF"
# %s (estimated).
estimated_label = tr("%s (برآورد شده)")
# %s (observed).
observed_label = tr("%s (مشاهده شده)")
# %s (observed, estimated).
observed_estimated_label = tr("%s (مشاهده شده، برآورد شده)")
supported_languages = ("en_US", "fa_AF", "ps_AF")
# Afghanistan's regaining of full independence from British influence.
start_year = 1919

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

def _populate_public_holidays(self):
if self._year >= 1989:
# Liberation Day.
self._add_holiday_feb_15(tr("روز آزادی"))

# Afghanistan Independence Day.
self._add_holiday_aug_19(tr("روز استقلال افغانستان"))

if self._year <= 1996 or 2001 <= self._year <= 2020:
# Nowruz.
self._add_holiday_mar_21(tr("نوروز"))

if self._year >= 1992:
# Mojahedin's Victory Day.
self._add_holiday_apr_28(tr("روز پیروزی مجاهدین"))

if 1974 <= self._year <= 1996 or 2002 <= self._year <= 2021:
# International Workers' Day.
self._add_labor_day(tr("روز جهانی کارگر"))

if 1978 <= self._year <= 1988:
# Soviet Victory Day.
self._add_holiday_may_9(tr("روز پیروزی شوروی"))

if self._year >= 2022:
# American Withdrawal Day.
self._add_holiday_aug_31(tr("روز خروج آمریکایی ها"))

if self._year >= 2012:
# Martyrs' Day.
self._add_holiday_sep_9(tr("روز شهیدان"))

# Eid al-Fitr.
name = tr("عید فطر")
self._add_eid_al_fitr_day(name)
self._add_eid_al_fitr_day_two(name)
self._add_eid_al_fitr_day_three(name)

# Day of Arafah.
self._add_arafah_day(tr("روز عرفه"))

# Eid al-Adha.
name = tr("عید قربانی")
self._add_eid_al_adha_day(name)
self._add_eid_al_adha_day_two(name)
self._add_eid_al_adha_day_three(name)

# Ashura.
self._add_ashura_day(tr("عاشورا"))

# First Day of Ramadan.
self._add_ramadan_beginning_day(tr("اول رمضان"))

# Prophet's Birthday.
self._add_mawlid_day(tr("میلاد پیامبر"))


class AF(Afghanistan):
pass


class AFG(Afghanistan):
pass
98 changes: 98 additions & 0 deletions holidays/locale/en_US/LC_MESSAGES/AF.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# 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 <[email protected]> (c) 2017-2023
# ryanss <[email protected]> (c) 2014-2017
# Website: https://github.com/vacanza/holidays
# License: MIT (see LICENSE file)
#
# Afghanistan holidays en_US localization.
#
msgid ""
msgstr ""
"Project-Id-Version: Holidays 0.64\n"
"POT-Creation-Date: 2024-12-24 13:40+0530\n"
"PO-Revision-Date: 2024-12-31 15:52+0700\n"
"Last-Translator: Prateekshit Jaiswal <[email protected]>\n"
"Language-Team: 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"
"Generated-By: Lingva 5.0.4\n"
"X-Generator: Poedit 3.5\n"

#. Liberation Day.
msgid "روز آزادی"
msgstr "Liberation Day"

#. Nowruz.
msgid "نوروز"
msgstr "Nowruz"

#. International Workers' Day.
msgid "روز جهانی کارگر"
msgstr "International Workers' Day"

#. Martyrs' Day.
msgid "روز شهیدان"
msgstr "Martyrs' Day"

#. Day of Arafah.
msgid "روز عرفه"
msgstr "Day of Arafah"

#. Ashura.
msgid "عاشورا"
msgstr "Ashura"

#. Prophet's Birthday.
msgid "میلاد پیامبر"
msgstr "Prophet's Birthday"

#. First Day of Ramadan.
msgid "اول رمضان"
msgstr "First Day of Ramadan"

#. %s (estimated).
#, c-format
msgid "%s (برآورد شده)"
msgstr "%s (estimated)"

#. %s (observed).
#, c-format
msgid "%s (مشاهده شده)"
msgstr "%s (observed)"

#. %s (observed, estimated).
#, c-format
msgid "%s (مشاهده شده، برآورد شده)"
msgstr "%s (observed, estimated)"

#. Soviet Victory Day.
msgid "روز پیروزی شوروی"
msgstr "Soviet Victory Day"

#. Mojahedin's Victory Day.
msgid "روز پیروزی مجاهدین"
msgstr "Mojahedin's Victory Day"

#. Afghanistan Independence Day.
msgid "روز استقلال افغانستان"
msgstr "Afghanistan Independence Day"

#. Eid al-Fitr.
msgid "عید فطر"
msgstr "Eid al-Fitr"

#. Eid al-Adha.
msgid "عید قربانی"
msgstr "Eid al-Adha"

#. American Withdrawal Day.
msgid "روز خروج آمریکایی ها"
msgstr "American Withdrawal Day"
98 changes: 98 additions & 0 deletions holidays/locale/fa_AF/LC_MESSAGES/AF.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# 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 <[email protected]> (c) 2017-2023
# ryanss <[email protected]> (c) 2014-2017
# Website: https://github.com/vacanza/holidays
# License: MIT (see LICENSE file)
#
# Afghanistan holidays.
#
msgid ""
msgstr ""
"Project-Id-Version: Holidays 0.64\n"
"POT-Creation-Date: 2024-12-24 13:40+0530\n"
"PO-Revision-Date: 2024-12-31 15:53+0700\n"
"Last-Translator: Prateekshit Jaiswal <[email protected]>\n"
"Language-Team: Holidays Localization Team\n"
"Language: fa\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Lingva 5.0.4\n"
"X-Generator: Poedit 3.5\n"

#. Liberation Day.
msgid "روز آزادی"
msgstr ""

#. Nowruz.
msgid "نوروز"
msgstr ""

#. International Workers' Day.
msgid "روز جهانی کارگر"
msgstr ""

#. Martyrs' Day.
msgid "روز شهیدان"
msgstr ""

#. Day of Arafah.
msgid "روز عرفه"
msgstr ""

#. Ashura.
msgid "عاشورا"
msgstr ""

#. Prophet's Birthday.
msgid "میلاد پیامبر"
msgstr ""

#. First Day of Ramadan.
msgid "اول رمضان"
msgstr ""

#. %s (estimated).
#, c-format
msgid "%s (برآورد شده)"
msgstr ""

#. %s (observed).
#, c-format
msgid "%s (مشاهده شده)"
msgstr ""

#. %s (observed, estimated).
#, c-format
msgid "%s (مشاهده شده، برآورد شده)"
msgstr ""

#. Soviet Victory Day.
msgid "روز پیروزی شوروی"
msgstr ""

#. Mojahedin's Victory Day.
msgid "روز پیروزی مجاهدین"
msgstr ""

#. Afghanistan Independence Day.
msgid "روز استقلال افغانستان"
msgstr ""

#. Eid al-Fitr.
msgid "عید فطر"
msgstr ""

#. Eid al-Adha.
msgid "عید قربانی"
msgstr ""

#. American Withdrawal Day.
msgid "روز خروج آمریکایی ها"
msgstr ""
Loading

0 comments on commit 512ad34

Please sign in to comment.