From fd3e54b2936d3547c1b8dc3cb82fc2709d20f266 Mon Sep 17 00:00:00 2001 From: PPsyrius <19505219+PPsyrius@users.noreply.github.com> Date: Wed, 7 Jun 2023 13:51:00 +0700 Subject: [PATCH 01/20] [KH] extend `ThaiLunisolar` for `KHMER_CALENDAR` --- holidays/calendars/__init__.py | 2 + holidays/calendars/thai.py | 246 +++++++++++++++++++++++++++++---- tests/test_calendars.py | 124 ++++++++++++++++- 3 files changed, 344 insertions(+), 28 deletions(-) diff --git a/holidays/calendars/__init__.py b/holidays/calendars/__init__.py index f67f16d76..a783db160 100644 --- a/holidays/calendars/__init__.py +++ b/holidays/calendars/__init__.py @@ -24,6 +24,8 @@ GREGORIAN_CALENDAR = "GREGORIAN_CALENDAR" JULIAN_CALENDAR = "JULIAN_CALENDAR" +KHMER_CALENDAR = "KHMER_CALENDAR" +THAI_CALENDAR = "THAI_CALENDAR" def _get_nth_weekday_from(n: int, weekday: int, from_dt: date) -> date: diff --git a/holidays/calendars/thai.py b/holidays/calendars/thai.py index d1abbf014..d1e45d5cd 100644 --- a/holidays/calendars/thai.py +++ b/holidays/calendars/thai.py @@ -14,6 +14,10 @@ from functools import lru_cache from typing import Optional +# Manual Assign to avoid circular import +KHMER_CALENDAR = "KHMER_CALENDAR" +THAI_CALENDAR = "THAI_CALENDAR" + class _ThaiLunisolar: """ @@ -25,7 +29,7 @@ class _ThaiLunisolar: 3-year types for calendar intercalation: - Pakatimat (Normal Year): consist of 12 months, has 354 days. - - Athikawan (Extra-Day Year): a + - Athikawan (Extra-Day Year): add a day to the 7th month of the year, has 355 days for the synodic month correction. - Athikamat (Extra-Month Year): @@ -41,27 +45,40 @@ class _ThaiLunisolar: the usual calendar by 1 month. List of public holidays dependent on the Thai Lunar Calendar: - - Magha Puja/Makha Bucha: + - Magha Puja/Makha Bucha/Meak Bochea: 15th Waxing Day (Full Moon) of Month 3 (On Month 4 for Athikamat Years). - - Royal Ploughing Ceremony: + KHMER_CALENDAR always fall on Month 3. + - Vesak/Visakha Bucha/Visaka Bochea: + 15th Waxing Day (Full Moon) of Month 6 + (On Month 7 for Athikamat Years). + KHMER_CALENDAR always fall on Month 6. + - Thai Royal Ploughing Ceremony/Raeknakhwan: Based on this, though Court Astrologer picks the auspicious dates, which sadly don't fall into a predictable pattern; see its specific section below. - - Vesak/Visakha Bucha: - 15th Waxing Day (Full Moon) of Month 6 + - Cambodian Royal Ploughing Ceremony/Preah Neangkol: + 4th Waning Day of Month 6 (On Month 7 for Athikamat Years). + This defaults to KHMER_CALENDAR (its sole user). - Asalha Puja/Asarnha Bucha: 15th Waxing Day (Full Moon) of Month 8 (On Month 8/8 for Athikamat Years). + KHMER_CALENDAR always fall on Month 8. - Buddhist Lent Day/Wan Khao Phansa: 1st Waning Day of Month 8 (On Month 8/8 for Athikamat Years). + KHMER_CALENDAR always fall on Month 8. + - Pchum Ben/Prachum Bandar: + 15th Waning Day (New Moon) of Month 10. + - Loy Krathong/Boun That Louang/Bon Om Touk: + 15th Waxing Day (Full Moon) of Month 12. Other Buddhist date on Thai Lunar Calendar: - Buddha's Cremation Day/Atthami Bucha 8th Waning Day of Month 6 (On Month 7 for Athikamat Years). + KHMER_CALENDAR always fall on Month 6 - End of Buddhist Lent Day/Ok Phansa: 15th Waxing Day (Full Moon) of Month 11 @@ -167,6 +184,29 @@ class _ThaiLunisolar: START_YEAR = 1941 END_YEAR = 2057 + def __init__(self, calendar=THAI_CALENDAR) -> None: + self.__verify_calendar(calendar) + self.__calendar = calendar + + @staticmethod + def __is_khmer_calendar(calendar): + """ + Return True if `calendar` is Khmer calendar. + Return False otherwise. + """ + return calendar == KHMER_CALENDAR + + @staticmethod + def __verify_calendar(calendar): + """ + Verify calendar type. + """ + if calendar not in {KHMER_CALENDAR, THAI_CALENDAR}: + raise ValueError( + f"Unknown calendar name: {calendar}. " + "Use `KHMER_CALENDAR` or `THAI_CALENDAR`." + ) + @lru_cache() def _get_start_date(self, year: int) -> Optional[date]: """ @@ -198,14 +238,16 @@ def _get_start_date(self, year: int) -> Optional[date]: iter_start_year += 1 return iter_start_date - def makha_bucha_date(self, year: int) -> Optional[date]: + def makha_bucha_date(self, year: int, calendar=None) -> Optional[date]: """ Calculate the estimated Gregorian date of Makha Bucha. - If the Gregorian year input is invalud, this will outputs None instead. + If the Gregorian year input is invalid, this will outputs None instead. - Also known as "Magha Puja". This concides with - the 15th Waxing Day of Month 3 in Thai Lunar Calendar, - or Month 4 in Athikamat years. + Also known as "Magha Puja", "Makha Buxha" and "Meak Bochea". + This concides with the 15th Waxing Day of Month 3 + in Thai Lunar Calendar, or Month 4 in Athikamat years. + + KHMER_CALENDAR will always use Month 3 regardless of year type. To calculate, we use use the following time delta: - Athikamat: 15th Waxing Day of Month 4 @@ -218,30 +260,41 @@ def makha_bucha_date(self, year: int) -> Optional[date]: :param year: The Gregorian year. + :param calendar: + Calendar type, this defaults to THAI_CALENDAR. + :return: Estimated Gregorian date of Makha Bucha. """ + calendar = calendar or self.__calendar + self.__verify_calendar(calendar) + start_date = self._get_start_date(year) if not start_date: return None return start_date + td( days=+102 - if year in _ThaiLunisolar.ATHIKAMAT_YEARS_GREGORIAN + if ( + year in _ThaiLunisolar.ATHIKAMAT_YEARS_GREGORIAN + and not self.__is_khmer_calendar(calendar) + ) else +73 ) - def visakha_bucha_date(self, year: int) -> Optional[date]: + def visakha_bucha_date(self, year: int, calendar=None) -> Optional[date]: """ Calculate the estimated Gregorian date of Visakha Bucha. - If the Gregorian year input is invalud, this will outputs None instead. + If the Gregorian year input is invalid, this will outputs None instead. Also known as "Vesak" and "Buddha Day". This concides with the 15th Waxing Day of Month 6 in Thai Lunar Calendar, or Month 7 in Athikamat years. + KHMER_CALENDAR will always use Month 6 regardless of year type. + To calculate, we use use the following time delta: - - Athikamat: 15th Waxing Day of Month 6 + - Athikamat: 15th Waxing Day of Month 7 or 177[1-6] + 15[7] -1 = 191 - Athikawan: 15th Waxing Day of Month 6 or 147[1-5] + 15[6] -1 = 161 @@ -251,28 +304,68 @@ def visakha_bucha_date(self, year: int) -> Optional[date]: :param year: The Gregorian year. + :param calendar: + Calendar type, this defaults to THAI_CALENDAR. + :return: Estimated Gregorian date of Visakha Bucha. """ + calendar = calendar or self.__calendar + self.__verify_calendar(calendar) + start_date = self._get_start_date(year) if not start_date: return None return start_date + td( days=+191 - if year in _ThaiLunisolar.ATHIKAMAT_YEARS_GREGORIAN + if ( + year in _ThaiLunisolar.ATHIKAMAT_YEARS_GREGORIAN + and not self.__is_khmer_calendar(calendar) + ) else +161 ) - def atthami_bucha_date(self, year: int) -> Optional[date]: + def preah_neangkoal_date(self, year: int) -> Optional[date]: + """ + Calculate the estimated Gregorian date of Preah Neangkoal. + If the Gregorian year input is invalid, this will outputs None instead. + + Also known as "Cambodian Royal Ploughing Ceremony". This always + concides with the 4th Waning Day of Month 6 in Khmer Lunar Calendar. + + To calculate, we use use the following time delta: + - Athikamat: 15th Waxing Day of Month 6 + or 177[1-6] + 19[7] -1 = 165 + - Athikawan: 15th Waxing Day of Month 6 + or 147[1-5] + 19[6] -1 = 165 + - Pakatimat: 15th Waxing Day of Month 6 + or 147[1-5] + 19[6] -1 = 165 + Or as in simpler terms: "Visakha Bucha" +4 + + :param year: + The Gregorian year. + + :return: + Estimated Gregorian date of Preah Neangkoal. + """ + start_date = self._get_start_date(year) + if not start_date: + return None + + return start_date + td(days=+165) + + def atthami_bucha_date(self, year: int, calendar=None) -> Optional[date]: """ Calculate the estimated Gregorian date of Atthami Bucha. - If the Gregorian year input is invalud, this will outputs None instead. + If the Gregorian year input is invalid, this will outputs None instead. Also known as "Buddha's Cremation Day". This concides with the 8th Waning Day of Month 6 in Thai Lunar Calendar, or Month 7 in Athikamat years. + KHMER_CALENDAR will always use Month 6 regardless of year type. + To calculate, we use use the following time delta: - Athikamat: 8th Waning Day of Month 7 or 177[1-6] + 23[7] -1 = 199 @@ -285,28 +378,39 @@ def atthami_bucha_date(self, year: int) -> Optional[date]: :param year: The Gregorian year. + :param calendar: + Calendar type, this defaults to THAI_CALENDAR. + :return: Estimated Gregorian date of Atthami Bucha. """ + calendar = calendar or self.__calendar + self.__verify_calendar(calendar) + start_date = self._get_start_date(year) if not start_date: return None return start_date + td( days=+199 - if year in _ThaiLunisolar.ATHIKAMAT_YEARS_GREGORIAN + if ( + year in _ThaiLunisolar.ATHIKAMAT_YEARS_GREGORIAN + and not self.__is_khmer_calendar(calendar) + ) else +169 ) - def asarnha_bucha_date(self, year: int) -> Optional[date]: + def asarnha_bucha_date(self, year: int, calendar=None) -> Optional[date]: """ Calculate the estimated Gregorian date of Asarnha Bucha. - If the Gregorian year input is invalud, this will outputs None instead. + If the Gregorian year input is invalid, this will outputs None instead. Also known as "Asalha Puja". This concides with the 15th Waxing Day of Month 8 in Thai Lunar Calendar, or Month 8.8 in Athikamat years. + KHMER_CALENDAR will always use Month 8 regardless of year type. + To calculate, we use use the following time delta: - Athikamat: 15th Waxing Day of Month 8/8 or 177[1-6] + 29[7] + 30[8] + 15[8.8] -1 = 250 @@ -318,14 +422,23 @@ def asarnha_bucha_date(self, year: int) -> Optional[date]: :param year: The Gregorian year. + :param calendar: + Calendar type, this defaults to THAI_CALENDAR. + :return: Estimated Gregorian date of Asarnha Bucha. """ + calendar = calendar or self.__calendar + self.__verify_calendar(calendar) + start_date = self._get_start_date(year) if not start_date: return None - if year in _ThaiLunisolar.ATHIKAMAT_YEARS_GREGORIAN: + if ( + year in _ThaiLunisolar.ATHIKAMAT_YEARS_GREGORIAN + and not self.__is_khmer_calendar(calendar) + ): delta_days = 250 elif year in _ThaiLunisolar.ATHIKAWAN_YEARS_GREGORIAN: delta_days = 221 @@ -333,15 +446,17 @@ def asarnha_bucha_date(self, year: int) -> Optional[date]: delta_days = 220 return start_date + td(days=delta_days) - def khao_phansa_date(self, year: int) -> Optional[date]: + def khao_phansa_date(self, year: int, calendar=None) -> Optional[date]: """ Calculate the estimated Gregorian date of Khao Phansa. - If the Gregorian year input is invalud, this will outputs None instead. + If the Gregorian year input is invalid, this will outputs None instead. Also known as "(Start of) Buddhist Lent" and "Start of Vassa". This concides with the 1st Waning Day of Month 8 in Thai Lunar Calendar, or Month 8.8 in Athikamat years. + KHMER_CALENDAR will always use Month 8 regardless of year type. + To calculate, we use use the following time delta: - Athikamat: 1st Waning Day of Month 8.8 or 177[1-6] + 29[7] + 30[8] + 16[8.8] -1 = 251 @@ -354,14 +469,23 @@ def khao_phansa_date(self, year: int) -> Optional[date]: :param year: The Gregorian year. + :param calendar: + Calendar type, this defaults to THAI_CALENDAR. + :return: Estimated Gregorian date of Khao Phansa. """ + calendar = calendar or self.__calendar + self.__verify_calendar(calendar) + start_date = self._get_start_date(year) if not start_date: return None - if year in _ThaiLunisolar.ATHIKAMAT_YEARS_GREGORIAN: + if ( + year in _ThaiLunisolar.ATHIKAMAT_YEARS_GREGORIAN + and not self.__is_khmer_calendar(calendar) + ): delta_days = 251 elif year in _ThaiLunisolar.ATHIKAWAN_YEARS_GREGORIAN: delta_days = 222 @@ -369,10 +493,45 @@ def khao_phansa_date(self, year: int) -> Optional[date]: delta_days = 221 return start_date + td(days=delta_days) + def pchum_ben_date(self, year: int) -> Optional[date]: + """ + Calculate the estimated Gregorian date of Pchum Ben. + If the Gregorian year input is invalid, this will outputs None instead. + + Also known as "Prachum Bandar". + This concides with the 15th Waning Day of Month 10 in + Thai Lunar Calendar. + + To calculate, we use use the following time delta: + - Athikamat: 15th Waning Day of Month 10 + or 265[1-9] + 30[8.8] + 30[10] -1 = 324 + - Athikawan: 15th Waning Day of Month 10 + or 265[1-9] + 1[7] + 30[10] -1 = 295 + - Pakatimat: 15th Waning Day of Month 10 + or 265[1-9] + 30[10] -1 = 294 + + :param year: + The Gregorian year. + + :return: + Estimated Gregorian date of Pchum Ben. + """ + start_date = self._get_start_date(year) + if not start_date: + return None + + if year in _ThaiLunisolar.ATHIKAMAT_YEARS_GREGORIAN: + delta_days = 324 + elif year in _ThaiLunisolar.ATHIKAWAN_YEARS_GREGORIAN: + delta_days = 295 + else: + delta_days = 294 + return start_date + td(days=delta_days) + def ok_phansa_date(self, year: int) -> Optional[date]: """ - Calculate the estimated Gregorian date of Ok Phansa - If the Gregorian year input is invalud, this will outputs None instead. + Calculate the estimated Gregorian date of Ok Phansa. + If the Gregorian year input is invalid, this will outputs None instead. Also known as "End of Buddhist Lent" and "End of Vassa". This concides with the 15th Waxing Day of Month 11 @@ -403,3 +562,38 @@ def ok_phansa_date(self, year: int) -> Optional[date]: else: delta_days = 309 return start_date + td(days=delta_days) + + def loy_krathong_date(self, year: int) -> Optional[date]: + """ + Calculate the estimated Gregorian date of Loy Krathong. + If the Gregorian year input is invalid, this will outputs None instead. + + Also known as "Boun That Louang" and "Bon Om Touk". + This concides with the 15th Waxing Day of Month 12 + in Thai Lunar Calendar. + + To calculate, we use use the following time delta: + - Athikamat: 15th Waxing Day of Month 12 + or 324[1-11] + 30[8.8] + 15[11] -1 = 368 + - Athikawan: 15th Waxing Day of Month 12 + or 324[1-11] + 1[7] + 15[11] -1 = 339 + - Pakatimat: 15th Waxing Day of Month 12 + or 324[1-11] + 15[11] -1 = 338 + + :param year: + The Gregorian year. + + :return: + Estimated Gregorian date of Loy Krathong. + """ + start_date = self._get_start_date(year) + if not start_date: + return None + + if year in _ThaiLunisolar.ATHIKAMAT_YEARS_GREGORIAN: + delta_days = 368 + elif year in _ThaiLunisolar.ATHIKAWAN_YEARS_GREGORIAN: + delta_days = 339 + else: + delta_days = 338 + return start_date + td(days=delta_days) diff --git a/tests/test_calendars.py b/tests/test_calendars.py index 9a8e02fba..655a49ab2 100644 --- a/tests/test_calendars.py +++ b/tests/test_calendars.py @@ -13,8 +13,8 @@ from datetime import date from holidays import calendars -from holidays.calendars import _get_nth_weekday_of_month -from holidays.constants import FEB, MAR, MAY, JUN, JUL, AUG, OCT +from holidays.calendars import _get_nth_weekday_of_month, KHMER_CALENDAR +from holidays.constants import FEB, MAR, MAY, JUN, JUL, AUG, SEP, OCT, NOV class TestThaiLunisolarCalendar(unittest.TestCase): @@ -23,6 +23,7 @@ def setUp(self) -> None: self.calendar = calendars._ThaiLunisolar() def test_asarnha_bucha_date(self): + # THAI_CALENDAR asarnha_bucha_year_date = { self.calendar.START_YEAR - 1: None, self.calendar.END_YEAR + 1: None, @@ -36,8 +37,23 @@ def test_asarnha_bucha_date(self): asarnha_bucha_year_date[year], self.calendar.asarnha_bucha_date(year), ) + # KHMER_CALENDAR + asanha_bochea_year_date = { + self.calendar.START_YEAR - 1: None, + self.calendar.END_YEAR + 1: None, + 2022: date(2022, JUL, 13), + 2023: date(2023, JUL, 2), + 2024: date(2024, JUL, 20), + 2025: date(2025, JUL, 10), + } + for year in asanha_bochea_year_date: + self.assertEqual( + asanha_bochea_year_date[year], + self.calendar.asarnha_bucha_date(year, KHMER_CALENDAR), + ) def test_atthami_bucha_date(self): + # THAI_CALENDAR atthami_bucha_year_date = { self.calendar.START_YEAR - 1: None, self.calendar.END_YEAR + 1: None, @@ -51,8 +67,23 @@ def test_atthami_bucha_date(self): atthami_bucha_year_date[year], self.calendar.atthami_bucha_date(year), ) + # KHMER_CALENDAR + athami_bochea_year_date = { + self.calendar.START_YEAR - 1: None, + self.calendar.END_YEAR + 1: None, + 2022: date(2022, MAY, 23), + 2023: date(2023, MAY, 12), + 2024: date(2024, MAY, 30), + 2025: date(2025, MAY, 19), + } + for year in athami_bochea_year_date: + self.assertEqual( + athami_bochea_year_date[year], + self.calendar.atthami_bucha_date(year, KHMER_CALENDAR), + ) def test_khao_phansa_date(self): + # THAI_CALENDAR khao_phansa_year_date = { self.calendar.START_YEAR - 1: None, self.calendar.END_YEAR + 1: None, @@ -66,8 +97,38 @@ def test_khao_phansa_date(self): khao_phansa_year_date[year], self.calendar.khao_phansa_date(year), ) + # KHMER_CALENDAR + bony_kanben_year_date = { + self.calendar.START_YEAR - 1: None, + self.calendar.END_YEAR + 1: None, + 2022: date(2022, JUL, 14), + 2023: date(2023, JUL, 3), + 2024: date(2024, JUL, 21), + 2025: date(2025, JUL, 11), + } + for year in bony_kanben_year_date: + self.assertEqual( + bony_kanben_year_date[year], + self.calendar.khao_phansa_date(year, KHMER_CALENDAR), + ) + + def test_loy_krathong_date(self): + loy_krathong_year_date = { + self.calendar.START_YEAR - 1: None, + self.calendar.END_YEAR + 1: None, + 2022: date(2022, NOV, 8), + 2023: date(2023, NOV, 27), + 2024: date(2024, NOV, 15), + 2025: date(2025, NOV, 5), + } + for year in loy_krathong_year_date: + self.assertEqual( + loy_krathong_year_date[year], + self.calendar.loy_krathong_date(year), + ) def test_makha_bucha_date(self): + # THAI_CALENDAR makha_bucha_year_date = { self.calendar.START_YEAR - 1: None, self.calendar.END_YEAR + 1: None, @@ -81,6 +142,20 @@ def test_makha_bucha_date(self): makha_bucha_year_date[year], self.calendar.makha_bucha_date(year), ) + # KHMER_CALENDAR + meak_bochea_year_date = { + self.calendar.START_YEAR - 1: None, + self.calendar.END_YEAR + 1: None, + 2022: date(2022, FEB, 16), + 2023: date(2023, FEB, 5), + 2024: date(2024, FEB, 24), + 2025: date(2025, FEB, 12), + } + for year in meak_bochea_year_date: + self.assertEqual( + meak_bochea_year_date[year], + self.calendar.makha_bucha_date(year, KHMER_CALENDAR), + ) def test_ok_phansa_date(self): ok_phansa_year_date = { @@ -97,7 +172,38 @@ def test_ok_phansa_date(self): self.calendar.ok_phansa_date(year), ) + def test_pchum_ben_date(self): + pchum_ben_year_date = { + self.calendar.START_YEAR - 1: None, + self.calendar.END_YEAR + 1: None, + 2022: date(2022, SEP, 25), + 2023: date(2023, OCT, 14), + 2024: date(2024, OCT, 2), + 2025: date(2025, SEP, 22), + } + for year in pchum_ben_year_date: + self.assertEqual( + pchum_ben_year_date[year], + self.calendar.pchum_ben_date(year), + ) + + def test_preah_neangkoal_date(self): + preah_neangkoal_year_date = { + self.calendar.START_YEAR - 1: None, + self.calendar.END_YEAR + 1: None, + 2022: date(2022, MAY, 19), + 2023: date(2023, MAY, 8), + 2024: date(2024, MAY, 26), + 2025: date(2025, MAY, 15), + } + for year in preah_neangkoal_year_date: + self.assertEqual( + preah_neangkoal_year_date[year], + self.calendar.preah_neangkoal_date(year), + ) + def test_visakha_bucha_date(self): + # THAI_CALENDAR visakha_bucha_year_date = { self.calendar.START_YEAR - 1: None, self.calendar.END_YEAR + 1: None, @@ -111,6 +217,20 @@ def test_visakha_bucha_date(self): visakha_bucha_year_date[year], self.calendar.visakha_bucha_date(year), ) + # KHMER_CALENDAR + visaka_bochea_year_date = { + self.calendar.START_YEAR - 1: None, + self.calendar.END_YEAR + 1: None, + 2022: date(2022, MAY, 15), + 2023: date(2023, MAY, 4), + 2024: date(2024, MAY, 22), + 2025: date(2025, MAY, 11), + } + for year in visaka_bochea_year_date: + self.assertEqual( + visaka_bochea_year_date[year], + self.calendar.visakha_bucha_date(year, KHMER_CALENDAR), + ) class TestRelativeWeekdays(unittest.TestCase): From 2dd57d2026432f2c1ba487d65d7668a5add6b3f3 Mon Sep 17 00:00:00 2001 From: PPsyrius <19505219+PPsyrius@users.noreply.github.com> Date: Wed, 7 Jun 2023 13:51:21 +0700 Subject: [PATCH 02/20] [KH] initial holidays implementation --- README.rst | 6 +- holidays/countries/__init__.py | 1 + holidays/countries/cambodia.py | 331 +++++++++++++++++++++++++++++++ holidays/registry.py | 1 + tests/countries/test_cambodia.py | 162 +++++++++++++++ 5 files changed, 500 insertions(+), 1 deletion(-) create mode 100644 holidays/countries/cambodia.py create mode 100644 tests/countries/test_cambodia.py diff --git a/README.rst b/README.rst index 118119460..d705bc82e 100644 --- a/README.rst +++ b/README.rst @@ -108,7 +108,7 @@ Available Countries .. _ISO 3166-2 code: https://en.wikipedia.org/wiki/ISO_3166-2 .. _ISO 639-1 code: https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes -We currently support 126 country codes. The standard way to refer to a country +We currently support 127 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 of the countries support more than one language for holiday names output. @@ -219,6 +219,10 @@ The list of supported countries, their subdivisions and supported languages - BI - - + * - Cambodia + - KH + - + - en_US, **km**, th * - Cameroon - CM - diff --git a/holidays/countries/__init__.py b/holidays/countries/__init__.py index bb843c921..0038c9ef9 100644 --- a/holidays/countries/__init__.py +++ b/holidays/countries/__init__.py @@ -31,6 +31,7 @@ from .brazil import Brazil, BR, BRA from .bulgaria import Bulgaria, BG, BLG from .burundi import Burundi, BI, BDI +from .cambodia import Cambodia, KH, KHM from .cameroon import Cameroon, CM, CMR from .canada import Canada, CA, CAN from .chile import Chile, CL, CHL diff --git a/holidays/countries/cambodia.py b/holidays/countries/cambodia.py new file mode 100644 index 000000000..f1771a44d --- /dev/null +++ b/holidays/countries/cambodia.py @@ -0,0 +1,331 @@ +# python-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: dr-prodigy (c) 2017-2023 +# ryanss (c) 2014-2017 +# Website: https://github.com/dr-prodigy/python-holidays +# License: MIT (see LICENSE file) + +from datetime import timedelta as td +from gettext import gettext as tr + +from holidays.calendars import _ThaiLunisolar, KHMER_CALENDAR +from holidays.constants import JAN, APR, MAY, JUN, AUG, SEP, OCT, NOV, DEC +from holidays.holiday_base import HolidayBase +from holidays.holiday_groups import InternationalHolidays + + +class Cambodia(HolidayBase, InternationalHolidays): + """ + A subclass of :py:class:`HolidayBase` representing public holidays + in Cambodia. + + + References: + + - Based on: https://www.nbc.gov.kh/english/news_and_events/official_holiday.php + https://www.nbc.gov.kh/news_and_events/official_holiday.php + https://en.wikipedia.org/wiki/Public_holidays_in_Cambodia + + - Checked with: https://asean.org/wp-content/uploads/2021/12/ASEAN-National-Holidays-2022.pdf # noqa: E501 + https://asean.org/wp-content/uploads/2022/12/ASEAN-Public-Holidays-2023.pdf # noqa: E501 + https://www.timeanddate.com/holidays/cambodia/ + + Limitations: + + - Cambodian holidays only works from 1993 onwards. + + - Exact Public Holidays as per Cambodia's Official Gazette are only + available from 2015 onwards. + + - Cambodian Lunar Calendar Holidays only work from 1941 (B.E. 2485) onwards + until 2057 (B.E. 2601) as we only have Thai year-type data for + cross-checking until then for Cambodian Buddhist Holidays. + + + Country created by: `PPsyrius `__ + + Country maintained by: `PPsyrius `__ + """ + + country = "KH" + default_language = "km" + + # Special Cases. + + sangkranta_in_lieu_covid = tr( + # Khmer New Year's Replacement Holiday + "ថ្ងៃឈប់សម្រាកសងជំនួសឲ្យពិធីបុណ្យចូលឆ្នាំថ្មីប្រពៃណីជាតិ" + ) + + special_holidays = { + 2020: ( + (AUG, 17, sangkranta_in_lieu_covid), + (AUG, 18, sangkranta_in_lieu_covid), + (AUG, 19, sangkranta_in_lieu_covid), + (AUG, 20, sangkranta_in_lieu_covid), + (AUG, 21, sangkranta_in_lieu_covid), + ), + } + # supported_languages = ("en_US", "km", "th") + + def __init__(self, *args, **kwargs): + InternationalHolidays.__init__(self) + self.thls = _ThaiLunisolar() + super().__init__(*args, **kwargs) + + def _populate(self, year): + # Available post-Independence from 1993 afterwards + if year <= 1992: + return None + + super()._populate(year) + + # Fixed Holidays + + # ទិវាចូលឆ្នាំសាកល + # Status: In-Use. + + # International New Year Day. + self._add_new_years_day(tr("ទិវាចូលឆ្នាំសាកល")) + + # ទិវាជ័យជម្នះលើរបបប្រល័យពូជសាសន៍ + # Status: In-Use. + # Commemorates the end of the Khmer Rouge regime in 1979 + + # Day of Victory over the Genocidal Regime. + self._add_holiday(tr("ទិវាជ័យជម្នះលើរបបប្រល័យពូជសាសន៍"), JAN, 7) + + # ទិវាអន្តរជាតិនារី + # Status: In-Use. + + # International Women's Rights Day + self._add_womens_day(tr("ទិវាអន្តរជាតិនារី")) + + # ពិធីបុណ្យចូលឆ្នាំថ្មីប្រពៃណីជាតិ + # Status: In-Use. + # Usually falls on April 13th except for 2017-2018 and 2021-2023 + # for years 2001-2050. + + if year != 2020: + # Khmer New Year's Day + sangkranta = tr("ពិធីបុណ្យចូលឆ្នាំថ្មីប្រពៃណីជាតិ") + sangkranta_years_apr14 = (2017, 2018, 2021, 2022, 2023) + dt = self._add_holiday( + sangkranta, APR, 14 if year in sangkranta_years_apr14 else 13 + ) + self._add_holiday(sangkranta, dt + td(days=+1)) + self._add_holiday(sangkranta, dt + td(days=+2)) + + # ទិវាពលកម្មអន្តរជាតិ + # Status: In-Use. + + # International Labor Day + self._add_labor_day(tr("ទិវាពលកម្មអន្តរជាតិ")) + + # ព្រះរាជពិធីបុណ្យចម្រើនព្រះជន្ម ព្រះករុណា ព្រះបាទសម្តេចព្រះបរមនាថ + # នរោត្តម សីហមុនី + # Status: In-Use. + # Assumed to start in 2005. Was celebrated for 3 days until 2020. + + if year >= 2005: + king_sihamoni_bday = tr( + # Birthday of His Majesty Preah Bat Samdech Preah Boromneath + # NORODOM SIHAMONI, King of Cambodia + "ព្រះរាជពិធីបុណ្យចម្រើនព្រះជន្ម ព្រះករុណា " + "ព្រះបាទសម្តេចព្រះបរមនាថ នរោត្តម សីហមុនី" + ) + dt = self._add_holiday(king_sihamoni_bday, MAY, 14) + if year <= 2019: + self._add_holiday(king_sihamoni_bday, MAY, 13) + self._add_holiday(king_sihamoni_bday, MAY, 15) + + # ទិវាជាតិនៃការចងចាំ + # Status: Defunct. + # Active between 2018-2019 as Public Holiday. + # Was ទិវាចងកំហឹង (National Day of Anger) between 1983-2000. + # Its celebration was put onhold by UN administration with + # its name changed to present one in 2001. + + if 2018 <= year <= 2019: + # National Day of Remembrance + self._add_holiday(tr("ទិវាជាតិនៃការចងចាំ"), MAY, 20) + + # ទិវាកុមារអន្តរជាតិ + # Status: Defunct. + # Assumed to start in 1993, defunct from 2020 onwards. + + if year <= 2019: + # International Children Day + self._add_holiday(tr("ទិវាកុមារអន្តរជាតិ"), JUN, 1) + + # ព្រះរាជពិធីបុណ្យចម្រើនព្រះជន្ម សម្តេចព្រះមហាក្សត្រី ព្រះវររាជមាតា + # នរោត្តម មុនិនាថ​ សីហនុ + # Status: In-Use. + # Assumed to start in 1994. A public holiday since 2015 at least. + + if year >= 1994: + self._add_holiday( + # Birthday of Her Majesty the Queen-Mother NORODOM MONINEATH + # SIHANOUK of Cambodia + tr( + "ព្រះរាជពិធីបុណ្យចម្រើនព្រះជន្ម សម្តេចព្រះមហាក្សត្រី " + "ព្រះវររាជមាតា នរោត្តម មុនិនាថ​ សីហនុ" + ), + JUN, + 18, + ) + + # ទិវាប្រកាសរដ្ឋធម្មនុញ្ញ + # Status: In-Use. + # Starts in 1993 + + # Constitution Day + self._add_holiday(tr("ទិវាប្រកាសរដ្ឋធម្មនុញ្ញ"), SEP, 24) + + # ទិវាប្រារព្ឋពិធីគោរពព្រះវិញ្ញាណក្ខន្ឋ ព្រះករុណា ព្រះបាទសម្តេចព្រះ + # នរោត្តម សីហនុ ព្រះមហាវីរក្សត្រ ព្រះវររាជបិតាឯករាជ្យ បូរណភាពទឹកដី + # និងឯកភាពជាតិខ្មែរ ព្រះបរមរតនកោដ្ឋ + # Status: In-Use. + # Starts in 2012. + + if year >= 2012: + self._add_holiday( + # Mourning Day of the Late King-Father + # NORODOM SIHANOUK of Cambodia + tr( + "ទិវាប្រារព្ឋពិធីគោរពព្រះវិញ្ញាណក្ខន្ឋ ព្រះករុណា " + "ព្រះបាទសម្តេចព្រះ នរោត្តម សីហនុ ព្រះមហាវីរក្សត្រ " + "ព្រះវររាជបិតាឯករាជ្យ បូរណភាពទឹកដី និងឯកភាពជាតិខ្មែរ " + "ព្រះបរមរតនកោដ្ឋ" + ), + OCT, + 15, + ) + + # ទិវារំលឹកសន្ធិសញ្ញាសន្តិភាពទីក្រុងប៉ារីស + # Status: Defunct. + # Assumed to start in 1993, defunct from 2020 onwards. + + if year <= 2019: + self._add_holiday( + # Paris Peace Agreement's Day + tr("ទិវារំលឹកសន្ធិសញ្ញាសន្តិភាពទីក្រុងប៉ារីស"), + OCT, + 23, + ) + + # ព្រះរាជពិធីគ្រងព្រះបរមរាជសម្បត្តិ របស់ ព្រះករុណា + # ព្រះបាទសម្តេចព្រះបរមនាថ នរោត្តម សីហមុនី + # ព្រះមហាក្សត្រនៃព្រះរាជាណាចក្រកម្ពុជា + # Status: In-Use. + # Starts in 2004. + + if year >= 2004: + self._add_holiday( + # Coronation Day of His Majesty Preah Bat Samdech Preah + # Boromneath NORODOM SIHAMONI, King of Cambodia + tr( + "ព្រះរាជពិធីគ្រងព្រះបរមរាជសម្បត្តិ របស់ ព្រះករុណា " + "ព្រះបាទសម្តេចព្រះបរមនាថ នរោត្តម សីហមុនី " + "ព្រះមហាក្សត្រនៃព្រះរាជាណាចក្រកម្ពុជា" + ), + OCT, + 29, + ) + + # ពិធីបុណ្យឯករាជ្យជាតិ + # Status: In-Use. + # Starts in 1953 + + # National Independence Day + self._add_holiday(tr("ពិធីបុណ្យឯករាជ្យជាតិ"), NOV, 9) + + # ទិវាសិទ្ធិមនុស្សអន្តរជាតិ + # Status: Defunct. + # Assumed to start in 1993, defunct from 2020 onwards. + + if year <= 2019: + # International Human Rights Day + self._add_holiday(tr("ទិវាសិទ្ធិមនុស្សអន្តរជាតិ"), DEC, 10) + + # Cambodian Lunar Calendar Holidays + + """ + See `_ThaiLunisolar` in holidays/utils.py for more details. + + Cambodian Lunar Calendar Holidays only work from 1941 (B.E. 2485) + onwards until 2057 (B.E. 2601). + """ + + # ពិធីបុណ្យមាឃបូជា + # Status: Defunct. + # 15th Waxing Day of Month 3. + # Defunct from 2020 onwards. + + if year <= 2019: + meak_bochea_date = self.thls.makha_bucha_date(year, KHMER_CALENDAR) + if meak_bochea_date: + # Meak Bochea Day + self._add_holiday(tr("ពិធីបុណ្យមាឃបូជា"), meak_bochea_date) + + # ពិធីបុណ្យវិសាខបូជា + # Status: In-Use. + # 15th Waxing Day of Month 6. + # This utilizes Thai calendar as a base, though are calculated to + # always happen in the Traditional Visakhamas month (May). + + visaka_bochea_date = self.thls.visakha_bucha_date(year, KHMER_CALENDAR) + if visaka_bochea_date: + # Visaka Bochea Day + self._add_holiday(tr("ពិធីបុណ្យវិសាខបូជា"), visaka_bochea_date) + + # ព្រះរាជពិធីច្រត់ព្រះនង្គ័ល + # Status: In-Use. + # 4th Waning Day of Month 6. + # Unlike Thai ones, Cambodian Royal Ploughing Ceremony is always fixed. + + preah_neangkoal_date = self.thls.preah_neangkoal_date(year) + if preah_neangkoal_date: + self._add_holiday( + # Royal Ploughing Ceremony + tr("ព្រះរាជពិធីច្រត់ព្រះនង្គ័ល"), + preah_neangkoal_date, + ) + + # ពិធីបុណ្យភ្ផុំបិណ្ឌ + # Status: In-Use. + # 14th Waning Day of Month 10 - 1st Waxing Day of Month 11. + + # Pchum Ben Day + pchum_ben = tr("ពិធីបុណ្យភ្ផុំបិណ្ឌ") + pchum_ben_date = self.thls.pchum_ben_date(year) + if pchum_ben_date: + self._add_holiday(pchum_ben, pchum_ben_date + td(days=-1)) + self._add_holiday(pchum_ben, pchum_ben_date) + self._add_holiday(pchum_ben, pchum_ben_date + td(days=+1)) + + # ព្រះរាជពិធីបុណ្យអុំទូក បណ្តែតប្រទីប និងសំពះព្រះខែអកអំបុក + # Status: In-Use. + # 14th Waxing Day of Month 12 - 1st Waning Day of Month 12. + + bon_om_touk = tr( + # Water Festival + "ព្រះរាជពិធីបុណ្យអុំទូក បណ្តែតប្រទីប និងសំពះព្រះខែអកអំបុក" + ) + bon_om_touk_date = self.thls.loy_krathong_date(year) + if bon_om_touk_date: + self._add_holiday(bon_om_touk, bon_om_touk_date + td(days=-1)) + self._add_holiday(bon_om_touk, bon_om_touk_date) + self._add_holiday(bon_om_touk, bon_om_touk_date + td(days=+1)) + + +class KH(Cambodia): + pass + + +class KHM(Cambodia): + pass diff --git a/holidays/registry.py b/holidays/registry.py index ef5308ed2..3302b7626 100644 --- a/holidays/registry.py +++ b/holidays/registry.py @@ -39,6 +39,7 @@ "brazil": ("Brazil", "BR", "BRA"), "bulgaria": ("Bulgaria", "BG", "BLG"), "burundi": ("Burundi", "BI", "BDI"), + "cambodia": ("Cambodia", "KH", "KHM"), "cameroon": ("Cameroon", "CM", "CMR"), "canada": ("Canada", "CA", "CAN"), "chile": ("Chile", "CL", "CHL"), diff --git a/tests/countries/test_cambodia.py b/tests/countries/test_cambodia.py new file mode 100644 index 000000000..b90f0d3d5 --- /dev/null +++ b/tests/countries/test_cambodia.py @@ -0,0 +1,162 @@ +# python-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: dr-prodigy (c) 2017-2023 +# ryanss (c) 2014-2017 +# Website: https://github.com/dr-prodigy/python-holidays +# License: MIT (see LICENSE file) + +from holidays.countries.cambodia import Cambodia, KH, KHM +from tests.common import TestCase + + +class TestCambodia(TestCase): + @classmethod + def setUpClass(cls): + super().setUpClass( + Cambodia, + years=range(1993, 2077), + years_non_observed=range(1993, 2077), + ) + + def test_country_aliases(self): + self.assertCountryAliases(Cambodia, KH, KHM) + + def test_no_holidays(self): + self.assertNoHolidays(Cambodia(years=1992)) + + def test_special_holidays(self): + self.assertHoliday( + "2020-08-17", + "2020-08-18", + "2020-08-19", + "2020-08-20", + "2020-08-21", + ) + + def test_2022(self): + self.assertHolidays( + Cambodia(years=2022), + ("2022-01-01", "ទិវាចូលឆ្នាំសាកល"), + ("2022-01-07", "ទិវាជ័យជម្នះលើរបបប្រល័យពូជសាសន៍"), + ("2022-03-08", "ទិវាអន្តរជាតិនារី"), + ("2022-04-14", "ពិធីបុណ្យចូលឆ្នាំថ្មីប្រពៃណីជាតិ"), + ("2022-04-15", "ពិធីបុណ្យចូលឆ្នាំថ្មីប្រពៃណីជាតិ"), + ("2022-04-16", "ពិធីបុណ្យចូលឆ្នាំថ្មីប្រពៃណីជាតិ"), + ("2022-05-01", "ទិវាពលកម្មអន្តរជាតិ"), + ( + "2022-05-14", + ( + "ព្រះរាជពិធីបុណ្យចម្រើនព្រះជន្ម ព្រះករុណា " + "ព្រះបាទសម្តេចព្រះបរមនាថ នរោត្តម សីហមុនី" + ), + ), + ("2022-05-15", "ពិធីបុណ្យវិសាខបូជា"), + ("2022-05-19", "ព្រះរាជពិធីច្រត់ព្រះនង្គ័ល"), + ( + "2022-06-18", + ( + "ព្រះរាជពិធីបុណ្យចម្រើនព្រះជន្ម សម្តេចព្រះមហាក្សត្រី " + "ព្រះវររាជមាតា នរោត្តម មុនិនាថ​ សីហនុ" + ), + ), + ("2022-09-24", "ទិវាប្រកាសរដ្ឋធម្មនុញ្ញ; ពិធីបុណ្យភ្ផុំបិណ្ឌ"), + ("2022-09-25", "ពិធីបុណ្យភ្ផុំបិណ្ឌ"), + ("2022-09-26", "ពិធីបុណ្យភ្ផុំបិណ្ឌ"), + ( + "2022-10-15", + ( + "ទិវាប្រារព្ឋពិធីគោរពព្រះវិញ្ញាណក្ខន្ឋ ព្រះករុណា " + "ព្រះបាទសម្តេចព្រះ នរោត្តម សីហនុ ព្រះមហាវីរក្សត្រ " + "ព្រះវររាជបិតាឯករាជ្យ បូរណភាពទឹកដី និងឯកភាពជាតិខ្មែរ " + "ព្រះបរមរតនកោដ្ឋ" + ), + ), + ( + "2022-10-29", + ( + "ព្រះរាជពិធីគ្រងព្រះបរមរាជសម្បត្តិ របស់ ព្រះករុណា " + "ព្រះបាទសម្តេចព្រះបរមនាថ នរោត្តម សីហមុនី " + "ព្រះមហាក្សត្រនៃព្រះរាជាណាចក្រកម្ពុជា" + ), + ), + ( + "2022-11-07", + "ព្រះរាជពិធីបុណ្យអុំទូក បណ្តែតប្រទីប និងសំពះព្រះខែអកអំបុក", + ), + ( + "2022-11-08", + "ព្រះរាជពិធីបុណ្យអុំទូក បណ្តែតប្រទីប និងសំពះព្រះខែអកអំបុក", + ), + ( + "2022-11-09", + ( + "ពិធីបុណ្យឯករាជ្យជាតិ; ព្រះរាជពិធីបុណ្យអុំទូក " + "បណ្តែតប្រទីប និងសំពះព្រះខែអកអំបុក" + ), + ), + ) + + def test_2023(self): + self.assertHolidays( + Cambodia(years=2023), + ("2023-01-01", "ទិវាចូលឆ្នាំសាកល"), + ("2023-01-07", "ទិវាជ័យជម្នះលើរបបប្រល័យពូជសាសន៍"), + ("2023-03-08", "ទិវាអន្តរជាតិនារី"), + ("2023-04-14", "ពិធីបុណ្យចូលឆ្នាំថ្មីប្រពៃណីជាតិ"), + ("2023-04-15", "ពិធីបុណ្យចូលឆ្នាំថ្មីប្រពៃណីជាតិ"), + ("2023-04-16", "ពិធីបុណ្យចូលឆ្នាំថ្មីប្រពៃណីជាតិ"), + ("2023-05-01", "ទិវាពលកម្មអន្តរជាតិ"), + ("2023-05-04", "ពិធីបុណ្យវិសាខបូជា"), + ("2023-05-08", "ព្រះរាជពិធីច្រត់ព្រះនង្គ័ល"), + ( + "2023-05-14", + ( + "ព្រះរាជពិធីបុណ្យចម្រើនព្រះជន្ម ព្រះករុណា " + "ព្រះបាទសម្តេចព្រះបរមនាថ នរោត្តម សីហមុនី" + ), + ), + ( + "2023-06-18", + ( + "ព្រះរាជពិធីបុណ្យចម្រើនព្រះជន្ម សម្តេចព្រះមហាក្សត្រី " + "ព្រះវររាជមាតា នរោត្តម មុនិនាថ​ សីហនុ" + ), + ), + ("2023-09-24", "ទិវាប្រកាសរដ្ឋធម្មនុញ្ញ"), + ("2023-10-13", "ពិធីបុណ្យភ្ផុំបិណ្ឌ"), + ("2023-10-14", "ពិធីបុណ្យភ្ផុំបិណ្ឌ"), + ( + "2023-10-15", + ( + "ទិវាប្រារព្ឋពិធីគោរពព្រះវិញ្ញាណក្ខន្ឋ ព្រះករុណា " + "ព្រះបាទសម្តេចព្រះ នរោត្តម សីហនុ ព្រះមហាវីរក្សត្រ " + "ព្រះវររាជបិតាឯករាជ្យ បូរណភាពទឹកដី និងឯកភាពជាតិខ្មែរ " + "ព្រះបរមរតនកោដ្ឋ; ពិធីបុណ្យភ្ផុំបិណ្ឌ" + ), + ), + ( + "2023-10-29", + ( + "ព្រះរាជពិធីគ្រងព្រះបរមរាជសម្បត្តិ របស់ ព្រះករុណា " + "ព្រះបាទសម្តេចព្រះបរមនាថ នរោត្តម សីហមុនី " + "ព្រះមហាក្សត្រនៃព្រះរាជាណាចក្រកម្ពុជា" + ), + ), + ("2023-11-09", "ពិធីបុណ្យឯករាជ្យជាតិ"), + ( + "2023-11-26", + "ព្រះរាជពិធីបុណ្យអុំទូក បណ្តែតប្រទីប និងសំពះព្រះខែអកអំបុក", + ), + ( + "2023-11-27", + "ព្រះរាជពិធីបុណ្យអុំទូក បណ្តែតប្រទីប និងសំពះព្រះខែអកអំបុក", + ), + ( + "2023-11-28", + "ព្រះរាជពិធីបុណ្យអុំទូក បណ្តែតប្រទីប និងសំពះព្រះខែអកអំបុក", + ), + ) From ac5a4cc757e2e88bfae84f3954c3ffffdb983944 Mon Sep 17 00:00:00 2001 From: PPsyrius <19505219+PPsyrius@users.noreply.github.com> Date: Wed, 7 Jun 2023 17:47:42 +0700 Subject: [PATCH 03/20] [KH] add in individual holiday test cases --- holidays/countries/cambodia.py | 4 +- tests/countries/test_cambodia.py | 225 +++++++++++++++++++++++++++++++ 2 files changed, 228 insertions(+), 1 deletion(-) diff --git a/holidays/countries/cambodia.py b/holidays/countries/cambodia.py index f1771a44d..32b5b7dd0 100644 --- a/holidays/countries/cambodia.py +++ b/holidays/countries/cambodia.py @@ -299,6 +299,7 @@ def _populate(self, year): # ពិធីបុណ្យភ្ផុំបិណ្ឌ # Status: In-Use. # 14th Waning Day of Month 10 - 1st Waxing Day of Month 11. + # The 3rd day is added as a public holiday from 2017 onwards. # Pchum Ben Day pchum_ben = tr("ពិធីបុណ្យភ្ផុំបិណ្ឌ") @@ -306,7 +307,8 @@ def _populate(self, year): if pchum_ben_date: self._add_holiday(pchum_ben, pchum_ben_date + td(days=-1)) self._add_holiday(pchum_ben, pchum_ben_date) - self._add_holiday(pchum_ben, pchum_ben_date + td(days=+1)) + if year >= 2017: + self._add_holiday(pchum_ben, pchum_ben_date + td(days=+1)) # ព្រះរាជពិធីបុណ្យអុំទូក បណ្តែតប្រទីប និងសំពះព្រះខែអកអំបុក # Status: In-Use. diff --git a/tests/countries/test_cambodia.py b/tests/countries/test_cambodia.py index b90f0d3d5..025b34edc 100644 --- a/tests/countries/test_cambodia.py +++ b/tests/countries/test_cambodia.py @@ -160,3 +160,228 @@ def test_2023(self): "ព្រះរាជពិធីបុណ្យអុំទូក បណ្តែតប្រទីប និងសំពះព្រះខែអកអំបុក", ), ) + + def test_day_of_victory_over_genocidal_regime(self): + self.assertHolidaysName( + "ទិវាជ័យជម្នះលើរបបប្រល័យពូជសាសន៍", + (f"{year}-01-07" for year in range(1993, 2058)), + ) + + def test_sangkranta(self): + sangkranta_years_apr14 = (2017, 2018, 2021, 2022, 2023) + for year in range(1993, 2058): + if year != 2020: + if year in sangkranta_years_apr14: + self.assertHoliday( + f"{year}-04-14", f"{year}-04-15", f"{year}-04-16" + ) + else: + self.assertHoliday( + f"{year}-04-13", f"{year}-04-14", f"{year}-04-15" + ) + + def test_king_sihamoni_birthday(self): + name = ( + "ព្រះរាជពិធីបុណ្យចម្រើនព្រះជន្ម ព្រះករុណា " + "ព្រះបាទសម្តេចព្រះបរមនាថ នរោត្តម សីហមុនី" + ) + self.assertNoHolidayName(name, 2004) + self.assertHolidaysName( + name, (f"{year}-05-13" for year in range(2005, 2020)) + ) + self.assertHolidaysName( + name, (f"{year}-05-14" for year in range(2005, 2058)) + ) + self.assertHolidaysName( + name, (f"{year}-05-15" for year in range(2005, 2020)) + ) + + def test_national_day_of_remembrance(self): + name = "ទិវាជាតិនៃការចងចាំ" + self.assertNoHolidayName(name, 2017) + self.assertHolidaysName( + name, (f"{year}-05-20" for year in range(2018, 2020)) + ) + self.assertNoHolidayName(name, 2020) + + def test_international_children_day(self): + name = "ទិវាកុមារអន្តរជាតិ" + self.assertHolidaysName( + name, + (f"{year}-06-01" for year in range(1993, 2020)), + ) + self.assertNoHolidayName(name, 2020) + + def test_queen_mother_monineath_birthday(self): + name = ( + "ព្រះរាជពិធីបុណ្យចម្រើនព្រះជន្ម សម្តេចព្រះមហាក្សត្រី " + "ព្រះវររាជមាតា នរោត្តម មុនិនាថ​ សីហនុ" + ) + self.assertNoHolidayName(name, 1993) + self.assertHolidaysName( + name, (f"{year}-06-18" for year in range(1994, 2058)) + ) + + def test_constitution_day(self): + self.assertHolidaysName( + "ទិវាប្រកាសរដ្ឋធម្មនុញ្ញ", + (f"{year}-09-24" for year in range(1993, 2058)), + ) + + def test_king_sihanouk_memorial_day(self): + name = ( + "ទិវាប្រារព្ឋពិធីគោរពព្រះវិញ្ញាណក្ខន្ឋ ព្រះករុណា ព្រះបាទសម្តេចព្រះ" + " នរោត្តម សីហនុ ព្រះមហាវីរក្សត្រ ព្រះវររាជបិតាឯករាជ្យ បូរណភាពទឹកដី" + " និងឯកភាពជាតិខ្មែរ ព្រះបរមរតនកោដ្ឋ" + ) + self.assertNoHolidayName(name, 2011) + self.assertHolidaysName( + name, + (f"{year}-10-15" for year in range(2012, 2058)), + ) + + def test_paris_peace_agreement_day(self): + name = "ទិវារំលឹកសន្ធិសញ្ញាសន្តិភាពទីក្រុងប៉ារីស" + self.assertHolidaysName( + name, + (f"{year}-10-23" for year in range(1993, 2020)), + ) + self.assertNoHolidayName(name, 2020) + + def test_king_sihamoni_coronation_day(self): + name = ( + "ព្រះរាជពិធីគ្រងព្រះបរមរាជសម្បត្តិ របស់ ព្រះករុណា " + "ព្រះបាទសម្តេចព្រះបរមនាថ នរោត្តម សីហមុនី " + "ព្រះមហាក្សត្រនៃព្រះរាជាណាចក្រកម្ពុជា" + ) + self.assertNoHolidayName(name, 2003) + self.assertHolidaysName( + name, (f"{year}-10-29" for year in range(2004, 2058)) + ) + + def test_national_independence_day(self): + self.assertHolidaysName( + "ពិធីបុណ្យឯករាជ្យជាតិ", + (f"{year}-11-09" for year in range(1993, 2058)), + ) + + def test_international_human_rights_day(self): + name = "ទិវាសិទ្ធិមនុស្សអន្តរជាតិ" + self.assertHolidaysName( + name, + (f"{year}-12-10" for year in range(1993, 2020)), + ) + self.assertNoHolidayName(name, 2020) + + def test_meak_bochea(self): + name = "ពិធីបុណ្យមាឃបូជា" + dt = ( + "2015-02-03", + "2016-02-22", + "2017-02-11", + "2018-01-31", + "2019-02-19", + ) + self.assertHolidaysName(name, dt) + self.assertNoHolidayName(name, Cambodia(years=2058)) + + def test_visaka_bochea(self): + name = "ពិធីបុណ្យវិសាខបូជា" + dt = ( + "2015-05-02", + "2016-05-20", + "2017-05-10", + "2018-04-29", + "2019-05-18", + "2020-05-06", + "2021-04-26", + "2022-05-15", + "2023-05-04", + ) + self.assertHolidaysName(name, dt) + self.assertNoHolidayName(name, Cambodia(years=2058)) + + def test_preah_neangkoal(self): + name = "ព្រះរាជពិធីច្រត់ព្រះនង្គ័ល" + dt = ( + "2015-05-06", + "2016-05-24", + "2017-05-14", + "2018-05-03", + "2019-05-22", + "2020-05-10", + "2021-04-30", + "2022-05-19", + "2023-05-08", + ) + self.assertHolidaysName(name, dt) + self.assertNoHolidayName(name, Cambodia(years=2058)) + + def test_pchum_ben(self): + name = "ពិធីបុណ្យភ្ផុំបិណ្ឌ" + dt = ( + # 2 Days Celebration + "2015-10-11", + "2015-10-12", + "2016-09-30", + "2016-10-01", + # 3 Days Celebration + "2017-09-19", + "2017-09-20", + "2017-09-21", + "2018-10-08", + "2018-10-09", + "2018-10-10", + "2019-09-27", + "2019-09-28", + "2019-09-29", + "2020-09-16", + "2020-09-17", + "2020-09-18", + "2021-10-05", + "2021-10-06", + "2021-10-07", + "2022-09-24", + "2022-09-25", + "2022-09-26", + "2023-10-13", + "2023-10-14", + "2023-10-15", + ) + self.assertHolidaysName(name, dt) + self.assertNoHolidayName(name, Cambodia(years=2058)) + + def test_bon_om_touk(self): + name = "ព្រះរាជពិធីបុណ្យអុំទូក បណ្តែតប្រទីប និងសំពះព្រះខែអកអំបុក" + dt = ( + # 3 Days Celebration + "2015-11-24", + "2015-11-25", + "2015-11-26", + "2016-11-13", + "2016-11-14", + "2016-11-15", + "2017-11-02", + "2017-11-03", + "2017-11-04", + "2018-11-21", + "2018-11-22", + "2018-11-23", + "2019-11-10", + "2019-11-11", + "2019-11-12", + "2020-10-30", + "2020-10-31", + "2020-11-01", + "2021-11-18", + "2021-11-19", + "2021-11-20", + "2022-11-07", + "2022-11-08", + "2022-11-09", + "2023-11-26", + "2023-11-27", + "2023-11-28", + ) + self.assertHolidaysName(name, dt) + self.assertNoHolidayName(name, Cambodia(years=2058)) From 8e8376bd4611b390a8a20007b89d1e03d44fc251 Mon Sep 17 00:00:00 2001 From: PPsyrius <19505219+PPsyrius@users.noreply.github.com> Date: Wed, 7 Jun 2023 20:04:43 +0700 Subject: [PATCH 04/20] [KH] add in special in lieus for 2015-2023 --- holidays/countries/cambodia.py | 9 +++++++++ tests/countries/test_cambodia.py | 5 +++++ 2 files changed, 14 insertions(+) diff --git a/holidays/countries/cambodia.py b/holidays/countries/cambodia.py index 32b5b7dd0..01d68d0f2 100644 --- a/holidays/countries/cambodia.py +++ b/holidays/countries/cambodia.py @@ -60,9 +60,18 @@ class Cambodia(HolidayBase, InternationalHolidays): # Khmer New Year's Replacement Holiday "ថ្ងៃឈប់សម្រាកសងជំនួសឲ្យពិធីបុណ្យចូលឆ្នាំថ្មីប្រពៃណីជាតិ" ) + # Special Public Holiday + special_in_lieu_holidays = tr("ថ្ងៃឈប់សម្រាកសងជំនួស") special_holidays = { + 2016: ( + (MAY, 2, special_in_lieu_holidays), + (MAY, 16, special_in_lieu_holidays), + ), + 2018: ((MAY, 21, special_in_lieu_holidays),), + 2019: ((SEP, 30, special_in_lieu_holidays),), 2020: ( + (MAY, 11, special_in_lieu_holidays), (AUG, 17, sangkranta_in_lieu_covid), (AUG, 18, sangkranta_in_lieu_covid), (AUG, 19, sangkranta_in_lieu_covid), diff --git a/tests/countries/test_cambodia.py b/tests/countries/test_cambodia.py index 025b34edc..2d7299fcb 100644 --- a/tests/countries/test_cambodia.py +++ b/tests/countries/test_cambodia.py @@ -30,6 +30,11 @@ def test_no_holidays(self): def test_special_holidays(self): self.assertHoliday( + "2016-05-02", + "2016-05-16", + "2018-05-21", + "2019-09-30", + "2020-05-11", "2020-08-17", "2020-08-18", "2020-08-19", From 56ab3dc1965012f398685cfcda72c616825388a0 Mon Sep 17 00:00:00 2001 From: PPsyrius <19505219+PPsyrius@users.noreply.github.com> Date: Wed, 7 Jun 2023 21:56:00 +0700 Subject: [PATCH 05/20] [KH] `en_US`. `km`, `th` l10n files --- holidays/countries/cambodia.py | 2 +- holidays/locale/en_US/LC_MESSAGES/KH.po | 139 +++++++++++++++++++ holidays/locale/km/LC_MESSAGES/KH.po | 139 +++++++++++++++++++ holidays/locale/th/LC_MESSAGES/KH.po | 145 ++++++++++++++++++++ tests/countries/test_cambodia.py | 171 ++++++++++++++++++++++++ 5 files changed, 595 insertions(+), 1 deletion(-) create mode 100644 holidays/locale/en_US/LC_MESSAGES/KH.po create mode 100644 holidays/locale/km/LC_MESSAGES/KH.po create mode 100644 holidays/locale/th/LC_MESSAGES/KH.po diff --git a/holidays/countries/cambodia.py b/holidays/countries/cambodia.py index 01d68d0f2..3b82c98c2 100644 --- a/holidays/countries/cambodia.py +++ b/holidays/countries/cambodia.py @@ -79,7 +79,7 @@ class Cambodia(HolidayBase, InternationalHolidays): (AUG, 21, sangkranta_in_lieu_covid), ), } - # supported_languages = ("en_US", "km", "th") + supported_languages = ("en_US", "km", "th") def __init__(self, *args, **kwargs): InternationalHolidays.__init__(self) diff --git a/holidays/locale/en_US/LC_MESSAGES/KH.po b/holidays/locale/en_US/LC_MESSAGES/KH.po new file mode 100644 index 000000000..a404c49fd --- /dev/null +++ b/holidays/locale/en_US/LC_MESSAGES/KH.po @@ -0,0 +1,139 @@ +# Cambodia holidays en_US localization. +# Authors: PPsyrius , (c) 2023. +# +msgid "" +msgstr "" +"Project-Id-Version: Python Holidays 0.27\n" +"POT-Creation-Date: 2023-06-07 20:10+0700\n" +"PO-Revision-Date: \n" +"Last-Translator: PPsyrius \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" +"X-Generator: Poedit 3.3.1\n" + +#. Khmer New Year's Replacement Holiday +#: ./holidays/countries/cambodia.py:59 +msgid "ថ្ងៃឈប់សម្រាកសងជំនួសឲ្យពិធីបុណ្យចូលឆ្នាំថ្មីប្រពៃណីជាតិ" +msgstr "Khmer New Year's Replacement Holiday" + +#. Special Public Holiday +#: ./holidays/countries/cambodia.py:64 +msgid "ថ្ងៃឈប់សម្រាកសងជំនួស" +msgstr "Special Public Holiday" + +#. International New Year Day. +#: ./holidays/countries/cambodia.py:102 +msgid "ទិវាចូលឆ្នាំសាកល" +msgstr "International New Year Day" + +#. Day of Victory over the Genocidal Regime. +#: ./holidays/countries/cambodia.py:109 +msgid "ទិវាជ័យជម្នះលើរបបប្រល័យពូជសាសន៍" +msgstr "Day of Victory over the Genocidal Regime" + +#. International Women's Rights Day +#: ./holidays/countries/cambodia.py:115 +msgid "ទិវាអន្តរជាតិនារី" +msgstr "International Women's Rights Day" + +#. Khmer New Year's Day +#: ./holidays/countries/cambodia.py:124 +msgid "ពិធីបុណ្យចូលឆ្នាំថ្មីប្រពៃណីជាតិ" +msgstr "Khmer New Year's Day" + +#. International Labor Day +#: ./holidays/countries/cambodia.py:136 +msgid "ទិវាពលកម្មអន្តរជាតិ" +msgstr "International Labor Day" + +#. Birthday of His Majesty Preah Bat Samdech Preah Boromneath NORODOM +#. SIHAMONI, +#. King of Cambodia +#: ./holidays/countries/cambodia.py:144 +msgid "" +"ព្រះរាជពិធីបុណ្យចម្រើនព្រះជន្ម ព្រះករុណា ព្រះបាទសម្តេចព្រះបរមនាថ នរោត្តម " +"សីហមុនី" +msgstr "HM King Norodom Sihamoni's Birthday" + +#. National Day of Remembrance +#: ./holidays/countries/cambodia.py:164 +msgid "ទិវាជាតិនៃការចងចាំ" +msgstr "National Day of Remembrance" + +#. International Children Day +#: ./holidays/countries/cambodia.py:172 +msgid "ទិវាកុមារអន្តរជាតិ" +msgstr "International Children Day" + +#. Birthday of Her Majesty the Queen-Mother NORODOM MONINEATH SIHANOUK of +#. Cambodia +#: ./holidays/countries/cambodia.py:183 +msgid "" +"ព្រះរាជពិធីបុណ្យចម្រើនព្រះជន្ម សម្តេចព្រះមហាក្សត្រី ព្រះវររាជមាតា នរោត្តម " +"មុនិនាថ​ សីហនុ" +msgstr "HM Queen Norodom Monineath Sihanouk the Queen-Mother's Birthday" + +#. Constitution Day +#: ./holidays/countries/cambodia.py:196 +msgid "ទិវាប្រកាសរដ្ឋធម្មនុញ្ញ" +msgstr "Constitution Day" + +#. Mourning Day of the Late King-Father NORODOM SIHANOUK of Cambodia +#: ./holidays/countries/cambodia.py:208 +msgid "" +"ទិវាប្រារព្ឋពិធីគោរពព្រះវិញ្ញាណក្ខន្ឋ ព្រះករុណា ព្រះបាទសម្តេចព្រះ នរោត្តម " +"សីហនុ ព្រះមហាវីរក្សត្រ ព្រះវររាជបិតាឯករាជ្យ បូរណភាពទឹកដី និងឯកភាពជាតិខ្មែរ " +"ព្រះបរមរតនកោដ្ឋ" +msgstr "HM King Norodom Sihanouk Mourning Day" + +#. Paris Peace Agreement's Day +#: ./holidays/countries/cambodia.py:225 +msgid "ទិវារំលឹកសន្ធិសញ្ញាសន្តិភាពទីក្រុងប៉ារីស" +msgstr "Paris Peace Agreement's Day" + +#. Coronation Day of His Majesty Preah Bat Samdech Preah Boromneath NORODOM +#. SIHAMONI, King of Cambodia +#: ./holidays/countries/cambodia.py:240 +msgid "" +"ព្រះរាជពិធីគ្រងព្រះបរមរាជសម្បត្តិ របស់ ព្រះករុណា ព្រះបាទសម្តេចព្រះបរមនាថ " +"នរោត្តម សីហមុនី ព្រះមហាក្សត្រនៃព្រះរាជាណាចក្រកម្ពុជា" +msgstr "HM King Norodom Sihamoni's Coronation Day" + +#. National Independence Day +#: ./holidays/countries/cambodia.py:254 +msgid "ពិធីបុណ្យឯករាជ្យជាតិ" +msgstr "National Independence Day" + +#. International Human Rights Day +#: ./holidays/countries/cambodia.py:262 +msgid "ទិវាសិទ្ធិមនុស្សអន្តរជាតិ" +msgstr "International Human Rights Day" + +#. Meak Bochea Day +#: ./holidays/countries/cambodia.py:282 +msgid "ពិធីបុណ្យមាឃបូជា" +msgstr "Meak Bochea Day" + +#. Visaka Bochea Day +#: ./holidays/countries/cambodia.py:293 +msgid "ពិធីបុណ្យវិសាខបូជា" +msgstr "Visaka Bochea Day" + +#. Royal Ploughing Ceremony +#: ./holidays/countries/cambodia.py:304 +msgid "ព្រះរាជពិធីច្រត់ព្រះនង្គ័ល" +msgstr "Royal Ploughing Ceremony" + +#. Pchum Ben Day +#: ./holidays/countries/cambodia.py:314 +msgid "ពិធីបុណ្យភ្ផុំបិណ្ឌ" +msgstr "Pchum Ben Day" + +#. Water Festival +#: ./holidays/countries/cambodia.py:326 +msgid "ព្រះរាជពិធីបុណ្យអុំទូក បណ្តែតប្រទីប និងសំពះព្រះខែអកអំបុក" +msgstr "Water Festival" diff --git a/holidays/locale/km/LC_MESSAGES/KH.po b/holidays/locale/km/LC_MESSAGES/KH.po new file mode 100644 index 000000000..0d493eab2 --- /dev/null +++ b/holidays/locale/km/LC_MESSAGES/KH.po @@ -0,0 +1,139 @@ +# Cambodia holidays. +# Authors: PPsyrius , (c) 2023. +# +msgid "" +msgstr "" +"Project-Id-Version: Python Holidays 0.27\n" +"POT-Creation-Date: 2023-06-07 20:10+0700\n" +"PO-Revision-Date: \n" +"Last-Translator: PPsyrius \n" +"Language-Team: Python Holidays localization team\n" +"Language: km\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: Poedit 3.3.1\n" + +#. Khmer New Year's Replacement Holiday +#: ./holidays/countries/cambodia.py:59 +msgid "ថ្ងៃឈប់សម្រាកសងជំនួសឲ្យពិធីបុណ្យចូលឆ្នាំថ្មីប្រពៃណីជាតិ" +msgstr "" + +#. Special Public Holiday +#: ./holidays/countries/cambodia.py:64 +msgid "ថ្ងៃឈប់សម្រាកសងជំនួស" +msgstr "" + +#. International New Year Day. +#: ./holidays/countries/cambodia.py:102 +msgid "ទិវាចូលឆ្នាំសាកល" +msgstr "" + +#. Day of Victory over the Genocidal Regime. +#: ./holidays/countries/cambodia.py:109 +msgid "ទិវាជ័យជម្នះលើរបបប្រល័យពូជសាសន៍" +msgstr "" + +#. International Women's Rights Day +#: ./holidays/countries/cambodia.py:115 +msgid "ទិវាអន្តរជាតិនារី" +msgstr "" + +#. Khmer New Year's Day +#: ./holidays/countries/cambodia.py:124 +msgid "ពិធីបុណ្យចូលឆ្នាំថ្មីប្រពៃណីជាតិ" +msgstr "" + +#. International Labor Day +#: ./holidays/countries/cambodia.py:136 +msgid "ទិវាពលកម្មអន្តរជាតិ" +msgstr "" + +#. Birthday of His Majesty Preah Bat Samdech Preah Boromneath NORODOM +#. SIHAMONI, +#. King of Cambodia +#: ./holidays/countries/cambodia.py:144 +msgid "" +"ព្រះរាជពិធីបុណ្យចម្រើនព្រះជន្ម ព្រះករុណា ព្រះបាទសម្តេចព្រះបរមនាថ នរោត្តម " +"សីហមុនី" +msgstr "" + +#. National Day of Remembrance +#: ./holidays/countries/cambodia.py:164 +msgid "ទិវាជាតិនៃការចងចាំ" +msgstr "" + +#. International Children Day +#: ./holidays/countries/cambodia.py:172 +msgid "ទិវាកុមារអន្តរជាតិ" +msgstr "" + +#. Birthday of Her Majesty the Queen-Mother NORODOM MONINEATH SIHANOUK of +#. Cambodia +#: ./holidays/countries/cambodia.py:183 +msgid "" +"ព្រះរាជពិធីបុណ្យចម្រើនព្រះជន្ម សម្តេចព្រះមហាក្សត្រី ព្រះវររាជមាតា នរោត្តម " +"មុនិនាថ​ សីហនុ" +msgstr "" + +#. Constitution Day +#: ./holidays/countries/cambodia.py:196 +msgid "ទិវាប្រកាសរដ្ឋធម្មនុញ្ញ" +msgstr "" + +#. Mourning Day of the Late King-Father NORODOM SIHANOUK of Cambodia +#: ./holidays/countries/cambodia.py:208 +msgid "" +"ទិវាប្រារព្ឋពិធីគោរពព្រះវិញ្ញាណក្ខន្ឋ ព្រះករុណា ព្រះបាទសម្តេចព្រះ នរោត្តម " +"សីហនុ ព្រះមហាវីរក្សត្រ ព្រះវររាជបិតាឯករាជ្យ បូរណភាពទឹកដី និងឯកភាពជាតិខ្មែរ " +"ព្រះបរមរតនកោដ្ឋ" +msgstr "" + +#. Paris Peace Agreement's Day +#: ./holidays/countries/cambodia.py:225 +msgid "ទិវារំលឹកសន្ធិសញ្ញាសន្តិភាពទីក្រុងប៉ារីស" +msgstr "" + +#. Coronation Day of His Majesty Preah Bat Samdech Preah Boromneath NORODOM +#. SIHAMONI, King of Cambodia +#: ./holidays/countries/cambodia.py:240 +msgid "" +"ព្រះរាជពិធីគ្រងព្រះបរមរាជសម្បត្តិ របស់ ព្រះករុណា ព្រះបាទសម្តេចព្រះបរមនាថ " +"នរោត្តម សីហមុនី ព្រះមហាក្សត្រនៃព្រះរាជាណាចក្រកម្ពុជា" +msgstr "" + +#. National Independence Day +#: ./holidays/countries/cambodia.py:254 +msgid "ពិធីបុណ្យឯករាជ្យជាតិ" +msgstr "" + +#. International Human Rights Day +#: ./holidays/countries/cambodia.py:262 +msgid "ទិវាសិទ្ធិមនុស្សអន្តរជាតិ" +msgstr "" + +#. Meak Bochea Day +#: ./holidays/countries/cambodia.py:282 +msgid "ពិធីបុណ្យមាឃបូជា" +msgstr "" + +#. Visaka Bochea Day +#: ./holidays/countries/cambodia.py:293 +msgid "ពិធីបុណ្យវិសាខបូជា" +msgstr "" + +#. Royal Ploughing Ceremony +#: ./holidays/countries/cambodia.py:304 +msgid "ព្រះរាជពិធីច្រត់ព្រះនង្គ័ល" +msgstr "" + +#. Pchum Ben Day +#: ./holidays/countries/cambodia.py:314 +msgid "ពិធីបុណ្យភ្ផុំបិណ្ឌ" +msgstr "" + +#. Water Festival +#: ./holidays/countries/cambodia.py:326 +msgid "ព្រះរាជពិធីបុណ្យអុំទូក បណ្តែតប្រទីប និងសំពះព្រះខែអកអំបុក" +msgstr "" diff --git a/holidays/locale/th/LC_MESSAGES/KH.po b/holidays/locale/th/LC_MESSAGES/KH.po new file mode 100644 index 000000000..336baafe1 --- /dev/null +++ b/holidays/locale/th/LC_MESSAGES/KH.po @@ -0,0 +1,145 @@ +# Cambodia holidays th localization. +# Authors: PPsyrius , (c) 2023. +# +msgid "" +msgstr "" +"Project-Id-Version: Python Holidays 0.27\n" +"POT-Creation-Date: 2023-06-07 20:10+0700\n" +"PO-Revision-Date: \n" +"Last-Translator: PPsyrius \n" +"Language-Team: Python Holidays localization team\n" +"Language: th\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: Poedit 3.3.1\n" + +#. Khmer New Year's Replacement Holiday +#: ./holidays/countries/cambodia.py:59 +msgid "ថ្ងៃឈប់សម្រាកសងជំនួសឲ្យពិធីបុណ្យចូលឆ្នាំថ្មីប្រពៃណីជាតិ" +msgstr "วันหยุดชดเชยเทศกาลขึ้นปีใหม่ประเพณี" + +#. Special Public Holiday +#: ./holidays/countries/cambodia.py:64 +msgid "ថ្ងៃឈប់សម្រាកសងជំនួស" +msgstr "วันหยุดชดเชย" + +#. International New Year Day. +#: ./holidays/countries/cambodia.py:102 +msgid "ទិវាចូលឆ្នាំសាកល" +msgstr "วันปีใหม่สากล" + +#. Day of Victory over the Genocidal Regime. +#: ./holidays/countries/cambodia.py:109 +msgid "ទិវាជ័យជម្នះលើរបបប្រល័យពូជសាសន៍" +msgstr "วันชัยชนะเหนือระบอบฆ่าล้างเผ่าพันธุ์เขมรแดง" + +#. International Women's Rights Day +#: ./holidays/countries/cambodia.py:115 +msgid "ទិវាអន្តរជាតិនារី" +msgstr "วันสตรีสากล" + +#. Khmer New Year's Day +#: ./holidays/countries/cambodia.py:124 +msgid "ពិធីបុណ្យចូលឆ្នាំថ្មីប្រពៃណីជាតិ" +msgstr "เทศกาลขึ้นปีใหม่ประเพณี" + +#. International Labor Day +#: ./holidays/countries/cambodia.py:136 +msgid "ទិវាពលកម្មអន្តរជាតិ" +msgstr "วันแรงงานสากล" + +#. Birthday of His Majesty Preah Bat Samdech Preah Boromneath NORODOM +#. SIHAMONI, +#. King of Cambodia +#: ./holidays/countries/cambodia.py:144 +msgid "" +"ព្រះរាជពិធីបុណ្យចម្រើនព្រះជន្ម ព្រះករុណា ព្រះបាទសម្តេចព្រះបរមនាថ នរោត្តម " +"សីហមុនី" +msgstr "" +"พระราชพิธีเฉลิมพระชนมพรรษา พระบาทสมเด็จพระบรมนาถ นโรดมสีหมุนี " +"พระมหากษัตริย์แห่งราชอาณาจักรกัมพูชา" + +#. National Day of Remembrance +#: ./holidays/countries/cambodia.py:164 +msgid "ទិវាជាតិនៃការចងចាំ" +msgstr "วันแห่งความทรงจำ" + +#. International Children Day +#: ./holidays/countries/cambodia.py:172 +msgid "ទិវាកុមារអន្តរជាតិ" +msgstr "วันเด็กสากล" + +#. Birthday of Her Majesty the Queen-Mother NORODOM MONINEATH SIHANOUK of +#. Cambodia +#: ./holidays/countries/cambodia.py:183 +msgid "" +"ព្រះរាជពិធីបុណ្យចម្រើនព្រះជន្ម សម្តេចព្រះមហាក្សត្រី ព្រះវររាជមាតា នរោត្តម " +"មុនិនាថ​ សីហនុ" +msgstr "พระราชพิธีเฉลิมพระชนมพรรษา สมเด็จพระบรมราชินี นโรดม มนีนาถ สีหนุ" + +#. Constitution Day +#: ./holidays/countries/cambodia.py:196 +msgid "ទិវាប្រកាសរដ្ឋធម្មនុញ្ញ" +msgstr "วันรัฐธรรมนูญ" + +#. Mourning Day of the Late King-Father NORODOM SIHANOUK of Cambodia +#: ./holidays/countries/cambodia.py:208 +msgid "" +"ទិវាប្រារព្ឋពិធីគោរពព្រះវិញ្ញាណក្ខន្ឋ ព្រះករុណា ព្រះបាទសម្តេចព្រះ នរោត្តម " +"សីហនុ ព្រះមហាវីរក្សត្រ ព្រះវររាជបិតាឯករាជ្យ បូរណភាពទឹកដី និងឯកភាពជាតិខ្មែរ " +"ព្រះបរមរតនកោដ្ឋ" +msgstr "" +"วันสดุดีพระบาทสมเด็จพระบรมนาถนโรดม สีหนุ พระบิดาแห่งเอกราช บูรณภาพแห่งดินแดน" +" และเอกภาพของชาติกัมพูชา" + +#. Paris Peace Agreement's Day +#: ./holidays/countries/cambodia.py:225 +msgid "ទិវារំលឹកសន្ធិសញ្ញាសន្តិភាពទីក្រុងប៉ារីស" +msgstr "วันรำลึกข้อตกลงสันติภาพกรุงปารีส" + +#. Coronation Day of His Majesty Preah Bat Samdech Preah Boromneath NORODOM +#. SIHAMONI, King of Cambodia +#: ./holidays/countries/cambodia.py:240 +msgid "" +"ព្រះរាជពិធីគ្រងព្រះបរមរាជសម្បត្តិ របស់ ព្រះករុណា ព្រះបាទសម្តេចព្រះបរមនាថ " +"នរោត្តម សីហមុនី ព្រះមហាក្សត្រនៃព្រះរាជាណាចក្រកម្ពុជា" +msgstr "" +"พระราชพิธีเฉลิมฉลองการขึ้นครองราชสมบัติ พระบาทสมเด็จพระบรมนาถ นโรดมสีหมุนี " +"พระมหากษัตริย์แห่งราชอาณาจักรกัมพูชา" + +#. National Independence Day +#: ./holidays/countries/cambodia.py:254 +msgid "ពិធីបុណ្យឯករាជ្យជាតិ" +msgstr "วันประกาศเอกราชจากฝรั่งเศส" + +#. International Human Rights Day +#: ./holidays/countries/cambodia.py:262 +msgid "ទិវាសិទ្ធិមនុស្សអន្តរជាតិ" +msgstr "วันสิทธิมนุษยชนโลก" + +#. Meak Bochea Day +#: ./holidays/countries/cambodia.py:282 +msgid "ពិធីបុណ្យមាឃបូជា" +msgstr "วันมาฆบูชา" + +#. Visaka Bochea Day +#: ./holidays/countries/cambodia.py:293 +msgid "ពិធីបុណ្យវិសាខបូជា" +msgstr "วันวิสาขบูชา" + +#. Royal Ploughing Ceremony +#: ./holidays/countries/cambodia.py:304 +msgid "ព្រះរាជពិធីច្រត់ព្រះនង្គ័ល" +msgstr "พระราชพิธีบุญจรดพระนังคัลแรกนาขวัญ" + +#. Pchum Ben Day +#: ./holidays/countries/cambodia.py:314 +msgid "ពិធីបុណ្យភ្ផុំបិណ្ឌ" +msgstr "เทศกาลงานวันสาร์ทภจุมบิณฑ์เขมร" + +#. Water Festival +#: ./holidays/countries/cambodia.py:326 +msgid "ព្រះរាជពិធីបុណ្យអុំទូក បណ្តែតប្រទីប និងសំពះព្រះខែអកអំបុក" +msgstr "พระราชพิธีบุญแข่งเรือลอยกระทงไฟไหว้พระจันทร์และกินข้าวเม่า" diff --git a/tests/countries/test_cambodia.py b/tests/countries/test_cambodia.py index 2d7299fcb..d84298c8e 100644 --- a/tests/countries/test_cambodia.py +++ b/tests/countries/test_cambodia.py @@ -390,3 +390,174 @@ def test_bon_om_touk(self): ) self.assertHolidaysName(name, dt) self.assertNoHolidayName(name, Cambodia(years=2058)) + + def test_l10n_default(self): + self.assertLocalizedHolidays( + ( + ("2023-01-01", "ទិវាចូលឆ្នាំសាកល"), + ("2023-01-07", "ទិវាជ័យជម្នះលើរបបប្រល័យពូជសាសន៍"), + ("2023-03-08", "ទិវាអន្តរជាតិនារី"), + ("2023-04-14", "ពិធីបុណ្យចូលឆ្នាំថ្មីប្រពៃណីជាតិ"), + ("2023-04-15", "ពិធីបុណ្យចូលឆ្នាំថ្មីប្រពៃណីជាតិ"), + ("2023-04-16", "ពិធីបុណ្យចូលឆ្នាំថ្មីប្រពៃណីជាតិ"), + ("2023-05-01", "ទិវាពលកម្មអន្តរជាតិ"), + ("2023-05-04", "ពិធីបុណ្យវិសាខបូជា"), + ("2023-05-08", "ព្រះរាជពិធីច្រត់ព្រះនង្គ័ល"), + ( + "2023-05-14", + ( + "ព្រះរាជពិធីបុណ្យចម្រើនព្រះជន្ម ព្រះករុណា " + "ព្រះបាទសម្តេចព្រះបរមនាថ នរោត្តម សីហមុនី" + ), + ), + ( + "2023-06-18", + ( + "ព្រះរាជពិធីបុណ្យចម្រើនព្រះជន្ម សម្តេចព្រះមហាក្សត្រី " + "ព្រះវររាជមាតា នរោត្តម មុនិនាថ​ សីហនុ" + ), + ), + ("2023-09-24", "ទិវាប្រកាសរដ្ឋធម្មនុញ្ញ"), + ("2023-10-13", "ពិធីបុណ្យភ្ផុំបិណ្ឌ"), + ("2023-10-14", "ពិធីបុណ្យភ្ផុំបិណ្ឌ"), + ( + "2023-10-15", + ( + "ទិវាប្រារព្ឋពិធីគោរពព្រះវិញ្ញាណក្ខន្ឋ ព្រះករុណា " + "ព្រះបាទសម្តេចព្រះ នរោត្តម សីហនុ ព្រះមហាវីរក្សត្រ " + "ព្រះវររាជបិតាឯករាជ្យ បូរណភាពទឹកដី និងឯកភាពជាតិខ្មែរ " + "ព្រះបរមរតនកោដ្ឋ; ពិធីបុណ្យភ្ផុំបិណ្ឌ" + ), + ), + ( + "2023-10-29", + ( + "ព្រះរាជពិធីគ្រងព្រះបរមរាជសម្បត្តិ របស់ ព្រះករុណា " + "ព្រះបាទសម្តេចព្រះបរមនាថ នរោត្តម សីហមុនី " + "ព្រះមហាក្សត្រនៃព្រះរាជាណាចក្រកម្ពុជា" + ), + ), + ("2023-11-09", "ពិធីបុណ្យឯករាជ្យជាតិ"), + ( + "2023-11-26", + "ព្រះរាជពិធីបុណ្យអុំទូក បណ្តែតប្រទីប និងសំពះព្រះខែអកអំបុក", + ), + ( + "2023-11-27", + "ព្រះរាជពិធីបុណ្យអុំទូក បណ្តែតប្រទីប និងសំពះព្រះខែអកអំបុក", + ), + ( + "2023-11-28", + "ព្រះរាជពិធីបុណ្យអុំទូក បណ្តែតប្រទីប និងសំពះព្រះខែអកអំបុក", + ), + ), + "km", + ) + + def test_l10n_en_us(self): + self.assertLocalizedHolidays( + ( + ("2023-01-01", "International New Year Day"), + ("2023-01-07", "Day of Victory over the Genocidal Regime"), + ("2023-03-08", "International Women's Rights Day"), + ("2023-04-14", "Khmer New Year's Day"), + ("2023-04-15", "Khmer New Year's Day"), + ("2023-04-16", "Khmer New Year's Day"), + ("2023-05-01", "International Labor Day"), + ("2023-05-04", "Visaka Bochea Day"), + ("2023-05-08", "Royal Ploughing Ceremony"), + ("2023-05-14", "HM King Norodom Sihamoni's Birthday"), + ( + "2023-06-18", + ( + "HM Queen Norodom Monineath Sihanouk " + "the Queen-Mother's Birthday" + ), + ), + ("2023-09-24", "Constitution Day"), + ("2023-10-13", "Pchum Ben Day"), + ("2023-10-14", "Pchum Ben Day"), + ( + "2023-10-15", + "HM King Norodom Sihanouk Mourning Day; Pchum Ben Day", + ), + ("2023-10-29", "HM King Norodom Sihamoni's Coronation Day"), + ("2023-11-09", "National Independence Day"), + ("2023-11-26", "Water Festival"), + ("2023-11-27", "Water Festival"), + ("2023-11-28", "Water Festival"), + ), + "en_US", + ) + + def test_l10n_th(self): + self.assertLocalizedHolidays( + ( + ("2023-01-01", "วันปีใหม่สากล"), + ("2023-01-07", "วันชัยชนะเหนือระบอบฆ่าล้างเผ่าพันธุ์เขมรแดง"), + ("2023-03-08", "วันสตรีสากล"), + ("2023-04-14", "เทศกาลขึ้นปีใหม่ประเพณี"), + ("2023-04-15", "เทศกาลขึ้นปีใหม่ประเพณี"), + ("2023-04-16", "เทศกาลขึ้นปีใหม่ประเพณี"), + ("2023-05-01", "วันแรงงานสากล"), + ("2023-05-04", "วันวิสาขบูชา"), + ("2023-05-08", "พระราชพิธีบุญจรดพระนังคัลแรกนาขวัญ"), + ( + "2023-05-14", + ( + "พระราชพิธีเฉลิมพระชนมพรรษา พระบาทสมเด็จพระบรมนาถ " + "นโรดมสีหมุนี พระมหากษัตริย์แห่งราชอาณาจักรกัมพูชา" + ), + ), + ( + "2023-06-18", + ( + "พระราชพิธีเฉลิมพระชนมพรรษา สมเด็จพระบรมราชินี " + "นโรดม มนีนาถ สีหนุ" + ), + ), + ("2023-09-24", "วันรัฐธรรมนูญ"), + ("2023-10-13", "เทศกาลงานวันสาร์ทภจุมบิณฑ์เขมร"), + ("2023-10-14", "เทศกาลงานวันสาร์ทภจุมบิณฑ์เขมร"), + ( + "2023-10-15", + ( + "วันสดุดีพระบาทสมเด็จพระบรมนาถนโรดม สีหนุ " + "พระบิดาแห่งเอกราช บูรณภาพแห่งดินแดน " + "และเอกภาพของชาติกัมพูชา; " + "เทศกาลงานวันสาร์ทภจุมบิณฑ์เขมร" + ), + ), + ( + "2023-10-29", + ( + "พระราชพิธีเฉลิมฉลองการขึ้นครองราชสมบัติ " + "พระบาทสมเด็จพระบรมนาถ นโรดมสีหมุนี " + "พระมหากษัตริย์แห่งราชอาณาจักรกัมพูชา" + ), + ), + ("2023-11-09", "วันประกาศเอกราชจากฝรั่งเศส"), + ( + "2023-11-26", + ( + "พระราชพิธีบุญแข่งเรือลอยกระทงไฟไหว้พระจันทร์" + "และกินข้าวเม่า" + ), + ), + ( + "2023-11-27", + ( + "พระราชพิธีบุญแข่งเรือลอยกระทงไฟไหว้พระจันทร์" + "และกินข้าวเม่า" + ), + ), + ( + "2023-11-28", + ( + "พระราชพิธีบุญแข่งเรือลอยกระทงไฟไหว้พระจันทร์" + "และกินข้าวเม่า" + ), + ), + ), + "th", + ) From 18ab78d6ce06700ff8c3d56ac5fbdd5f52c54a30 Mon Sep 17 00:00:00 2001 From: PPsyrius <19505219+PPsyrius@users.noreply.github.com> Date: Wed, 7 Jun 2023 23:01:38 +0700 Subject: [PATCH 06/20] [KH] PH's coveralls back to 100% again --- tests/test_calendars.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/test_calendars.py b/tests/test_calendars.py index 655a49ab2..40d77be1b 100644 --- a/tests/test_calendars.py +++ b/tests/test_calendars.py @@ -22,6 +22,12 @@ def setUp(self) -> None: super().setUpClass() self.calendar = calendars._ThaiLunisolar() + def test_check_calendar(self): + self.assertRaises( + ValueError, + lambda: calendars._ThaiLunisolar("INVALID_CALENDAR"), + ) + def test_asarnha_bucha_date(self): # THAI_CALENDAR asarnha_bucha_year_date = { From 6d6e885bbbe86883082cfe264ebc019d9d898f77 Mon Sep 17 00:00:00 2001 From: PPsyrius <19505219+PPsyrius@users.noreply.github.com> Date: Thu, 8 Jun 2023 00:22:33 +0700 Subject: [PATCH 07/20] [KH] initial batch of suggestions Co-Authored-By: ~Jhellico --- holidays/countries/cambodia.py | 8 ++++---- tests/countries/test_cambodia.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/holidays/countries/cambodia.py b/holidays/countries/cambodia.py index 3b82c98c2..c6bb83f39 100644 --- a/holidays/countries/cambodia.py +++ b/holidays/countries/cambodia.py @@ -83,7 +83,7 @@ class Cambodia(HolidayBase, InternationalHolidays): def __init__(self, *args, **kwargs): InternationalHolidays.__init__(self) - self.thls = _ThaiLunisolar() + self.thls = _ThaiLunisolar(KHMER_CALENDAR) super().__init__(*args, **kwargs) def _populate(self, year): @@ -122,7 +122,7 @@ def _populate(self, year): if year != 2020: # Khmer New Year's Day sangkranta = tr("ពិធីបុណ្យចូលឆ្នាំថ្មីប្រពៃណីជាតិ") - sangkranta_years_apr14 = (2017, 2018, 2021, 2022, 2023) + sangkranta_years_apr14 = {2017, 2018, 2021, 2022, 2023} dt = self._add_holiday( sangkranta, APR, 14 if year in sangkranta_years_apr14 else 13 ) @@ -276,7 +276,7 @@ def _populate(self, year): # Defunct from 2020 onwards. if year <= 2019: - meak_bochea_date = self.thls.makha_bucha_date(year, KHMER_CALENDAR) + meak_bochea_date = self.thls.makha_bucha_date(year) if meak_bochea_date: # Meak Bochea Day self._add_holiday(tr("ពិធីបុណ្យមាឃបូជា"), meak_bochea_date) @@ -287,7 +287,7 @@ def _populate(self, year): # This utilizes Thai calendar as a base, though are calculated to # always happen in the Traditional Visakhamas month (May). - visaka_bochea_date = self.thls.visakha_bucha_date(year, KHMER_CALENDAR) + visaka_bochea_date = self.thls.visakha_bucha_date(year) if visaka_bochea_date: # Visaka Bochea Day self._add_holiday(tr("ពិធីបុណ្យវិសាខបូជា"), visaka_bochea_date) diff --git a/tests/countries/test_cambodia.py b/tests/countries/test_cambodia.py index d84298c8e..8b90c1636 100644 --- a/tests/countries/test_cambodia.py +++ b/tests/countries/test_cambodia.py @@ -173,7 +173,7 @@ def test_day_of_victory_over_genocidal_regime(self): ) def test_sangkranta(self): - sangkranta_years_apr14 = (2017, 2018, 2021, 2022, 2023) + sangkranta_years_apr14 = {2017, 2018, 2021, 2022, 2023} for year in range(1993, 2058): if year != 2020: if year in sangkranta_years_apr14: From 28a9c71c70dd04d576b117b4312d674b9ad76ce1 Mon Sep 17 00:00:00 2001 From: PPsyrius <19505219+PPsyrius@users.noreply.github.com> Date: Thu, 8 Jun 2023 00:59:04 +0700 Subject: [PATCH 08/20] [KH] increments country count to 128 --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 58fcdc9ac..933234899 100644 --- a/README.rst +++ b/README.rst @@ -108,7 +108,7 @@ Available Countries .. _ISO 3166-2 code: https://en.wikipedia.org/wiki/ISO_3166-2 .. _ISO 639-1 code: https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes -We currently support 127 country codes. The standard way to refer to a country +We currently support 128 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 of the countries support more than one language for holiday names output. From 3ca1f39cf590a688c05cf9b66c7c246659eb232f Mon Sep 17 00:00:00 2001 From: PPsyrius <19505219+PPsyrius@users.noreply.github.com> Date: Fri, 9 Jun 2023 12:24:46 +0700 Subject: [PATCH 09/20] [KH] refractor Cambodia testcases --- tests/countries/test_cambodia.py | 55 +++++++++++++++----------------- 1 file changed, 25 insertions(+), 30 deletions(-) diff --git a/tests/countries/test_cambodia.py b/tests/countries/test_cambodia.py index 8b90c1636..44369ec9b 100644 --- a/tests/countries/test_cambodia.py +++ b/tests/countries/test_cambodia.py @@ -16,11 +16,7 @@ class TestCambodia(TestCase): @classmethod def setUpClass(cls): - super().setUpClass( - Cambodia, - years=range(1993, 2077), - years_non_observed=range(1993, 2077), - ) + super().setUpClass(Cambodia, years=range(1993, 2059)) def test_country_aliases(self): self.assertCountryAliases(Cambodia, KH, KHM) @@ -174,16 +170,15 @@ def test_day_of_victory_over_genocidal_regime(self): def test_sangkranta(self): sangkranta_years_apr14 = {2017, 2018, 2021, 2022, 2023} - for year in range(1993, 2058): - if year != 2020: - if year in sangkranta_years_apr14: - self.assertHoliday( - f"{year}-04-14", f"{year}-04-15", f"{year}-04-16" - ) - else: - self.assertHoliday( - f"{year}-04-13", f"{year}-04-14", f"{year}-04-15" - ) + for year in set(range(1993, 2058)).difference({2020}): + if year in sangkranta_years_apr14: + self.assertHoliday( + f"{year}-04-14", f"{year}-04-15", f"{year}-04-16" + ) + else: + self.assertHoliday( + f"{year}-04-13", f"{year}-04-14", f"{year}-04-15" + ) def test_king_sihamoni_birthday(self): name = ( @@ -280,19 +275,20 @@ def test_international_human_rights_day(self): def test_meak_bochea(self): name = "ពិធីបុណ្យមាឃបូជា" - dt = ( + self.assertHolidaysName( + name, "2015-02-03", "2016-02-22", "2017-02-11", "2018-01-31", "2019-02-19", ) - self.assertHolidaysName(name, dt) - self.assertNoHolidayName(name, Cambodia(years=2058)) + self.assertNoHolidayName(name, 2058) def test_visaka_bochea(self): name = "ពិធីបុណ្យវិសាខបូជា" - dt = ( + self.assertHolidaysName( + name, "2015-05-02", "2016-05-20", "2017-05-10", @@ -303,12 +299,12 @@ def test_visaka_bochea(self): "2022-05-15", "2023-05-04", ) - self.assertHolidaysName(name, dt) - self.assertNoHolidayName(name, Cambodia(years=2058)) + self.assertNoHolidayName(name, 2058) def test_preah_neangkoal(self): name = "ព្រះរាជពិធីច្រត់ព្រះនង្គ័ល" - dt = ( + self.assertHolidaysName( + name, "2015-05-06", "2016-05-24", "2017-05-14", @@ -319,12 +315,12 @@ def test_preah_neangkoal(self): "2022-05-19", "2023-05-08", ) - self.assertHolidaysName(name, dt) - self.assertNoHolidayName(name, Cambodia(years=2058)) + self.assertNoHolidayName(name, 2058) def test_pchum_ben(self): name = "ពិធីបុណ្យភ្ផុំបិណ្ឌ" - dt = ( + self.assertHolidaysName( + name, # 2 Days Celebration "2015-10-11", "2015-10-12", @@ -353,12 +349,12 @@ def test_pchum_ben(self): "2023-10-14", "2023-10-15", ) - self.assertHolidaysName(name, dt) - self.assertNoHolidayName(name, Cambodia(years=2058)) + self.assertNoHolidayName(name, 2058) def test_bon_om_touk(self): name = "ព្រះរាជពិធីបុណ្យអុំទូក បណ្តែតប្រទីប និងសំពះព្រះខែអកអំបុក" - dt = ( + self.assertHolidaysName( + name, # 3 Days Celebration "2015-11-24", "2015-11-25", @@ -388,8 +384,7 @@ def test_bon_om_touk(self): "2023-11-27", "2023-11-28", ) - self.assertHolidaysName(name, dt) - self.assertNoHolidayName(name, Cambodia(years=2058)) + self.assertNoHolidayName(name, 2058) def test_l10n_default(self): self.assertLocalizedHolidays( From 772e6f047ab7d506cdd75906653b2ae9f0e6181c Mon Sep 17 00:00:00 2001 From: PPsyrius <19505219+PPsyrius@users.noreply.github.com> Date: Fri, 9 Jun 2023 16:09:25 +0700 Subject: [PATCH 10/20] [KH] remove redundant `((...),),` (see #1296) --- holidays/countries/cambodia.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/holidays/countries/cambodia.py b/holidays/countries/cambodia.py index c6bb83f39..6b2250860 100644 --- a/holidays/countries/cambodia.py +++ b/holidays/countries/cambodia.py @@ -68,8 +68,8 @@ class Cambodia(HolidayBase, InternationalHolidays): (MAY, 2, special_in_lieu_holidays), (MAY, 16, special_in_lieu_holidays), ), - 2018: ((MAY, 21, special_in_lieu_holidays),), - 2019: ((SEP, 30, special_in_lieu_holidays),), + 2018: (MAY, 21, special_in_lieu_holidays), + 2019: (SEP, 30, special_in_lieu_holidays), 2020: ( (MAY, 11, special_in_lieu_holidays), (AUG, 17, sangkranta_in_lieu_covid), From aabfa038614e6d68ca6a484720f6094c8ba47370 Mon Sep 17 00:00:00 2001 From: PPsyrius <19505219+PPsyrius@users.noreply.github.com> Date: Fri, 9 Jun 2023 16:19:03 +0700 Subject: [PATCH 11/20] Revert "[KH] remove redundant `((...),),` (see #1296)" This reverts commit 772e6f047ab7d506cdd75906653b2ae9f0e6181c. --- holidays/countries/cambodia.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/holidays/countries/cambodia.py b/holidays/countries/cambodia.py index 6b2250860..c6bb83f39 100644 --- a/holidays/countries/cambodia.py +++ b/holidays/countries/cambodia.py @@ -68,8 +68,8 @@ class Cambodia(HolidayBase, InternationalHolidays): (MAY, 2, special_in_lieu_holidays), (MAY, 16, special_in_lieu_holidays), ), - 2018: (MAY, 21, special_in_lieu_holidays), - 2019: (SEP, 30, special_in_lieu_holidays), + 2018: ((MAY, 21, special_in_lieu_holidays),), + 2019: ((SEP, 30, special_in_lieu_holidays),), 2020: ( (MAY, 11, special_in_lieu_holidays), (AUG, 17, sangkranta_in_lieu_covid), From b965f81c0065a79be26932986676875a555f115f Mon Sep 17 00:00:00 2001 From: PPsyrius <19505219+PPsyrius@users.noreply.github.com> Date: Sat, 10 Jun 2023 00:31:37 +0700 Subject: [PATCH 12/20] Revert "Revert "[KH] remove redundant `((...),),` (see #1296)"" This reverts commit aabfa038614e6d68ca6a484720f6094c8ba47370. --- holidays/countries/cambodia.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/holidays/countries/cambodia.py b/holidays/countries/cambodia.py index c6bb83f39..6b2250860 100644 --- a/holidays/countries/cambodia.py +++ b/holidays/countries/cambodia.py @@ -68,8 +68,8 @@ class Cambodia(HolidayBase, InternationalHolidays): (MAY, 2, special_in_lieu_holidays), (MAY, 16, special_in_lieu_holidays), ), - 2018: ((MAY, 21, special_in_lieu_holidays),), - 2019: ((SEP, 30, special_in_lieu_holidays),), + 2018: (MAY, 21, special_in_lieu_holidays), + 2019: (SEP, 30, special_in_lieu_holidays), 2020: ( (MAY, 11, special_in_lieu_holidays), (AUG, 17, sangkranta_in_lieu_covid), From 05d1299ba82c833ee5542e6f12959e8e4f63f9bc Mon Sep 17 00:00:00 2001 From: PPsyrius <19505219+PPsyrius@users.noreply.github.com> Date: Sat, 10 Jun 2023 12:08:44 +0700 Subject: [PATCH 13/20] [TH] initial `ThaiCalendarHolidays` attempt --- holidays/countries/thailand.py | 27 +++---- holidays/groups/__init__.py | 1 + holidays/groups/thai.py | 127 +++++++++++++++++++++++++++++++++ holidays/holiday_groups.py | 1 + 4 files changed, 138 insertions(+), 18 deletions(-) create mode 100644 holidays/groups/thai.py diff --git a/holidays/countries/thailand.py b/holidays/countries/thailand.py index ad72d08ef..4bd475327 100644 --- a/holidays/countries/thailand.py +++ b/holidays/countries/thailand.py @@ -13,14 +13,13 @@ from datetime import timedelta as td from gettext import gettext as tr -from holidays.calendars import _ThaiLunisolar from holidays.constants import JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP from holidays.constants import OCT, NOV, DEC from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import InternationalHolidays +from holidays.holiday_groups import InternationalHolidays, ThaiCalendarHolidays -class Thailand(HolidayBase, InternationalHolidays): +class Thailand(HolidayBase, InternationalHolidays, ThaiCalendarHolidays): """ A subclass of :py:class:`HolidayBase` representing public holidays in Thailand. (Based on South Korean and Singaporean Implementation) @@ -252,7 +251,7 @@ class Thailand(HolidayBase, InternationalHolidays): def __init__(self, **kwargs) -> None: InternationalHolidays.__init__(self) - self.thls = _ThaiLunisolar() + ThaiCalendarHolidays.__init__(self) super().__init__(**kwargs) def _populate(self, year): @@ -584,39 +583,31 @@ def _add_observed(dt: date) -> None: # วันมาฆบูชา # Status: In-Use. - makha_bucha_date = self.thls.makha_bucha_date(year) + makha_bucha_date = self._add_makha_bucha(tr("วันมาฆบูชา")) if makha_bucha_date: - _add_observed( - self._add_holiday(tr("วันมาฆบูชา"), makha_bucha_date) - ) + _add_observed(makha_bucha_date) # Visakha Bucha. # วันวิสาขบูชา # Status: In-Use. - visakha_bucha_date = self.thls.visakha_bucha_date(year) + visakha_bucha_date = self._add_visakha_bucha(tr("วันวิสาขบูชา")) if visakha_bucha_date: - _add_observed( - self._add_holiday(tr("วันวิสาขบูชา"), visakha_bucha_date) - ) + _add_observed(visakha_bucha_date) # Asarnha Bucha. # วันอาสาฬหบูชา # Status: In-Use. # This has its own in-lieu trigger. - asarnha_bucha_date = self.thls.asarnha_bucha_date(year) - if asarnha_bucha_date: - self._add_holiday(tr("วันอาสาฬหบูชา"), asarnha_bucha_date) + asarnha_bucha_date = self._add_asarnha_bucha(tr("วันอาสาฬหบูชา")) # Buddhist Lent Day. # วันเข้าพรรษา # Status: In-Use. # This has its own in-lieu trigger. - khao_phansa_date = self.thls.khao_phansa_date(year) - if khao_phansa_date: - self._add_holiday(tr("วันเข้าพรรษา"), khao_phansa_date) + self._add_khao_phansa(tr("วันเข้าพรรษา")) # Asarnha Bucha/Buddhist Lent Day (in lieu). # วันหยุดชดเชยวันอาสาฬหบูชา diff --git a/holidays/groups/__init__.py b/holidays/groups/__init__.py index bdf7cff5a..d4b3e10b1 100644 --- a/holidays/groups/__init__.py +++ b/holidays/groups/__init__.py @@ -15,3 +15,4 @@ from holidays.groups.hindu import HinduCalendarHolidays from holidays.groups.international import InternationalHolidays from holidays.groups.islamic import IslamicHolidays +from holidays.groups.thai import ThaiCalendarHolidays diff --git a/holidays/groups/thai.py b/holidays/groups/thai.py new file mode 100644 index 000000000..725780618 --- /dev/null +++ b/holidays/groups/thai.py @@ -0,0 +1,127 @@ +# python-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: dr-prodigy (c) 2017-2022 +# ryanss (c) 2014-2017 +# Website: https://github.com/dr-prodigy/python-holidays +# License: MIT (see LICENSE file) + +from datetime import date +from typing import Optional + +from holidays.calendars import _ThaiLunisolar, KHMER_CALENDAR, THAI_CALENDAR + + +class ThaiCalendarHolidays: + """ + Thai lunisolar calendar holidays. + + For more info, see class `_ThaiLunisolar`. + """ + + def __init__(self, calendar=THAI_CALENDAR) -> None: + self.__verify_calendar(calendar) + self.__calendar = calendar + self.__thai_calendar = _ThaiLunisolar(calendar) + + @staticmethod + def __verify_calendar(calendar): + """ + Verify calendar type. + """ + if calendar not in {KHMER_CALENDAR, THAI_CALENDAR}: + raise ValueError( + f"Unknown calendar name: {calendar}. " + "Use `KHMER_CALENDAR` or `THAI_CALENDAR`." + ) + + def _add_asarnha_bucha(self, name, calendar=None) -> Optional[date]: + """ + Add Asarnha Bucha. + + Asalha Pūjā (also written as Asarnha Bucha Day) is a Buddhist festival + celebrated on the 15th Waxing Day (Full Moon) of Month 8. + + Khmer variant: always fall on Month 8. + Thai variant: will use Month 8.8 instead for Athikamat years. + + https://en.wikipedia.org/wiki/Asalha_Puja + """ + calendar = calendar or self.__calendar + self.__verify_calendar(calendar) + + return self._add_thai_calendar_holiday( + name, self.__thai_calendar.asarnha_bucha_date(self._year, calendar) + ) + + def _add_khao_phansa(self, name, calendar=None) -> Optional[date]: + """ + Add Khao Phansa. + + Start of Buddhist Lent (also written as Khao Phansa Day) is a Buddhist + festival celebrated on the 1st Waning Day of Month 8. + + Khmer variant: always fall on Month 8. + Thai variant: will use Month 8.8 instead for Athikamat years. + + https://en.wikipedia.org/wiki/Vassa + """ + calendar = calendar or self.__calendar + self.__verify_calendar(calendar) + + return self._add_thai_calendar_holiday( + name, self.__thai_calendar.khao_phansa_date(self._year, calendar) + ) + + def _add_makha_bucha(self, name, calendar=None) -> Optional[date]: + """ + Add Makha Bucha. + + Māgha Pūjā (also written as Makha Bucha Day) is a Buddhist festival + celebrated on the 15th Waxing Day (Full Moon) of Month 3. + + Khmer variant: always fall on Month 3. + Thai variant: will use Month 4 instead for Athikamat years. + + https://en.wikipedia.org/wiki/M%C4%81gha_P%C5%ABj%C4%81 + """ + calendar = calendar or self.__calendar + self.__verify_calendar(calendar) + + return self._add_thai_calendar_holiday( + name, self.__thai_calendar.makha_bucha_date(self._year, calendar) + ) + + def _add_thai_calendar_holiday(self, name, dt) -> Optional[date]: + """ + Add Thai calendar holiday. + + If the result from `_ThaiLunisolar` is none then no holidays added. + """ + if dt is None: + return None + + return self._add_holiday(name, dt) + + def _add_visakha_bucha(self, name, calendar=None) -> Optional[date]: + """ + Add Visakha Bucha. + + Vesak(also written as Makha Bucha Day and Meak Bochea Day) is a + Buddhist festival celebrated on the 15th Waxing Day (Full Moon) + of Month 6. + + Khmer variant: always fall on Month 6. + Thai variant: will use Month 7 instead for Athikamat years. + + https://en.wikipedia.org/wiki/M%C4%81gha_P%C5%ABj%C4%81 + """ + calendar = calendar or self.__calendar + self.__verify_calendar(calendar) + + return self._add_thai_calendar_holiday( + name, self.__thai_calendar.visakha_bucha_date(self._year, calendar) + ) diff --git a/holidays/holiday_groups.py b/holidays/holiday_groups.py index 535cf0918..90c3e825f 100644 --- a/holidays/holiday_groups.py +++ b/holidays/holiday_groups.py @@ -14,3 +14,4 @@ from holidays.groups import BuddhistCalendarHolidays, ChineseCalendarHolidays from holidays.groups import ChristianHolidays, HinduCalendarHolidays from holidays.groups import InternationalHolidays, IslamicHolidays +from holidays.groups import ThaiCalendarHolidays From 453e0e379485bbe76e8492d8a72d627e43558cdc Mon Sep 17 00:00:00 2001 From: PPsyrius <19505219+PPsyrius@users.noreply.github.com> Date: Sat, 10 Jun 2023 14:28:22 +0700 Subject: [PATCH 14/20] [KH] Migrates Cambodia `_ThaiLunisolar` to holiday groups --- holidays/countries/cambodia.py | 35 ++++------- holidays/groups/thai.py | 45 ++++++++++++++ holidays/locale/en_US/LC_MESSAGES/KH.po | 10 +-- holidays/locale/en_US/LC_MESSAGES/TH.po | 82 ++++++++++++------------- holidays/locale/km/LC_MESSAGES/KH.po | 10 +-- holidays/locale/th/LC_MESSAGES/KH.po | 10 +-- holidays/locale/th/LC_MESSAGES/TH.po | 82 ++++++++++++------------- 7 files changed, 154 insertions(+), 120 deletions(-) diff --git a/holidays/countries/cambodia.py b/holidays/countries/cambodia.py index 6b2250860..79664dc00 100644 --- a/holidays/countries/cambodia.py +++ b/holidays/countries/cambodia.py @@ -12,13 +12,13 @@ from datetime import timedelta as td from gettext import gettext as tr -from holidays.calendars import _ThaiLunisolar, KHMER_CALENDAR +from holidays.calendars import KHMER_CALENDAR from holidays.constants import JAN, APR, MAY, JUN, AUG, SEP, OCT, NOV, DEC from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import InternationalHolidays +from holidays.holiday_groups import InternationalHolidays, ThaiCalendarHolidays -class Cambodia(HolidayBase, InternationalHolidays): +class Cambodia(HolidayBase, InternationalHolidays, ThaiCalendarHolidays): """ A subclass of :py:class:`HolidayBase` representing public holidays in Cambodia. @@ -83,7 +83,7 @@ class Cambodia(HolidayBase, InternationalHolidays): def __init__(self, *args, **kwargs): InternationalHolidays.__init__(self) - self.thls = _ThaiLunisolar(KHMER_CALENDAR) + ThaiCalendarHolidays.__init__(self, KHMER_CALENDAR) super().__init__(*args, **kwargs) def _populate(self, year): @@ -276,10 +276,8 @@ def _populate(self, year): # Defunct from 2020 onwards. if year <= 2019: - meak_bochea_date = self.thls.makha_bucha_date(year) - if meak_bochea_date: - # Meak Bochea Day - self._add_holiday(tr("ពិធីបុណ្យមាឃបូជា"), meak_bochea_date) + # Meak Bochea Day + self._add_makha_bucha(tr("ពិធីបុណ្យមាឃបូជា")) # ពិធីបុណ្យវិសាខបូជា # Status: In-Use. @@ -287,23 +285,16 @@ def _populate(self, year): # This utilizes Thai calendar as a base, though are calculated to # always happen in the Traditional Visakhamas month (May). - visaka_bochea_date = self.thls.visakha_bucha_date(year) - if visaka_bochea_date: - # Visaka Bochea Day - self._add_holiday(tr("ពិធីបុណ្យវិសាខបូជា"), visaka_bochea_date) + # Visaka Bochea Day + self._add_visakha_bucha(tr("ពិធីបុណ្យវិសាខបូជា")) # ព្រះរាជពិធីច្រត់ព្រះនង្គ័ល # Status: In-Use. # 4th Waning Day of Month 6. # Unlike Thai ones, Cambodian Royal Ploughing Ceremony is always fixed. - preah_neangkoal_date = self.thls.preah_neangkoal_date(year) - if preah_neangkoal_date: - self._add_holiday( - # Royal Ploughing Ceremony - tr("ព្រះរាជពិធីច្រត់ព្រះនង្គ័ល"), - preah_neangkoal_date, - ) + # Royal Ploughing Ceremony + self._add_preah_neangkoal(tr("ព្រះរាជពិធីច្រត់ព្រះនង្គ័ល")) # ពិធីបុណ្យភ្ផុំបិណ្ឌ # Status: In-Use. @@ -312,10 +303,9 @@ def _populate(self, year): # Pchum Ben Day pchum_ben = tr("ពិធីបុណ្យភ្ផុំបិណ្ឌ") - pchum_ben_date = self.thls.pchum_ben_date(year) + pchum_ben_date = self.add_pchum_ben(pchum_ben) if pchum_ben_date: self._add_holiday(pchum_ben, pchum_ben_date + td(days=-1)) - self._add_holiday(pchum_ben, pchum_ben_date) if year >= 2017: self._add_holiday(pchum_ben, pchum_ben_date + td(days=+1)) @@ -327,10 +317,9 @@ def _populate(self, year): # Water Festival "ព្រះរាជពិធីបុណ្យអុំទូក បណ្តែតប្រទីប និងសំពះព្រះខែអកអំបុក" ) - bon_om_touk_date = self.thls.loy_krathong_date(year) + bon_om_touk_date = self._add_loy_krathong(bon_om_touk) if bon_om_touk_date: self._add_holiday(bon_om_touk, bon_om_touk_date + td(days=-1)) - self._add_holiday(bon_om_touk, bon_om_touk_date) self._add_holiday(bon_om_touk, bon_om_touk_date + td(days=+1)) diff --git a/holidays/groups/thai.py b/holidays/groups/thai.py index 725780618..3afb05d62 100644 --- a/holidays/groups/thai.py +++ b/holidays/groups/thai.py @@ -76,6 +76,22 @@ def _add_khao_phansa(self, name, calendar=None) -> Optional[date]: name, self.__thai_calendar.khao_phansa_date(self._year, calendar) ) + def _add_loy_krathong(self, name) -> Optional[date]: + """ + Add Loy Krathong. + + Also known as "Boun That Louang" and "Bon Om Touk". + This concides with the 15th Waxing Day (Full Moon) of Month 12 + in Thai Lunar Calendar. + + https://en.wikipedia.org/wiki/Loy_Krathong + https://en.wikipedia.org/wiki/Bon_Om_Touk + """ + + return self._add_thai_calendar_holiday( + name, self.__thai_calendar.loy_krathong_date(self._year) + ) + def _add_makha_bucha(self, name, calendar=None) -> Optional[date]: """ Add Makha Bucha. @@ -95,6 +111,35 @@ def _add_makha_bucha(self, name, calendar=None) -> Optional[date]: name, self.__thai_calendar.makha_bucha_date(self._year, calendar) ) + def _add_pchum_ben(self, name) -> Optional[date]: + """ + Add Pchum Ben. + + Also known as "Prachum Bandar". + This concides with the 15th Waning Day (New Moon) of Month 10 in + Thai Lunar Calendar. + + https://en.wikipedia.org/wiki/Pchum_Ben + """ + + return self._add_thai_calendar_holiday( + name, self.__thai_calendar.pchum_ben_date(self._year) + ) + + def _add_preah_neangkoal(self, name) -> Optional[date]: + """ + Add Preah Reach Pithi Chrat Preah Neangkoal. + + Also known as "Cambodian Royal Ploughing Ceremony". This always + concides with the 4th Waning Day of Month 6 in Khmer Lunar Calendar. + + https://en.wikipedia.org/wiki/Royal_Ploughing_Ceremony + """ + + return self._add_thai_calendar_holiday( + name, self.__thai_calendar.preah_neangkoal_date(self._year) + ) + def _add_thai_calendar_holiday(self, name, dt) -> Optional[date]: """ Add Thai calendar holiday. diff --git a/holidays/locale/en_US/LC_MESSAGES/KH.po b/holidays/locale/en_US/LC_MESSAGES/KH.po index a404c49fd..290088dff 100644 --- a/holidays/locale/en_US/LC_MESSAGES/KH.po +++ b/holidays/locale/en_US/LC_MESSAGES/KH.po @@ -114,26 +114,26 @@ msgid "ទិវាសិទ្ធិមនុស្សអន្តរជាត msgstr "International Human Rights Day" #. Meak Bochea Day -#: ./holidays/countries/cambodia.py:282 +#: ./holidays/countries/cambodia.py:280 msgid "ពិធីបុណ្យមាឃបូជា" msgstr "Meak Bochea Day" #. Visaka Bochea Day -#: ./holidays/countries/cambodia.py:293 +#: ./holidays/countries/cambodia.py:289 msgid "ពិធីបុណ្យវិសាខបូជា" msgstr "Visaka Bochea Day" #. Royal Ploughing Ceremony -#: ./holidays/countries/cambodia.py:304 +#: ./holidays/countries/cambodia.py:297 msgid "ព្រះរាជពិធីច្រត់ព្រះនង្គ័ល" msgstr "Royal Ploughing Ceremony" #. Pchum Ben Day -#: ./holidays/countries/cambodia.py:314 +#: ./holidays/countries/cambodia.py:305 msgid "ពិធីបុណ្យភ្ផុំបិណ្ឌ" msgstr "Pchum Ben Day" #. Water Festival -#: ./holidays/countries/cambodia.py:326 +#: ./holidays/countries/cambodia.py:316 msgid "ព្រះរាជពិធីបុណ្យអុំទូក បណ្តែតប្រទីប និងសំពះព្រះខែអកអំបុក" msgstr "Water Festival" diff --git a/holidays/locale/en_US/LC_MESSAGES/TH.po b/holidays/locale/en_US/LC_MESSAGES/TH.po index caa3985a3..546077368 100644 --- a/holidays/locale/en_US/LC_MESSAGES/TH.po +++ b/holidays/locale/en_US/LC_MESSAGES/TH.po @@ -14,171 +14,171 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "X-Generator: Poedit 3.2.2\n" -#: ./holidays/countries/thailand.py:120 +#: ./holidays/countries/thailand.py:119 msgid "วันหยุดชดเชย" msgstr "Special In Lieu Holiday" -#: ./holidays/countries/thailand.py:121 +#: ./holidays/countries/thailand.py:120 msgid "วันเลือกตั้ง" msgstr "Thai Election Day" -#: ./holidays/countries/thailand.py:122 +#: ./holidays/countries/thailand.py:121 msgid "ชดเชยวันเลือกตั้ง" msgstr "Thai Election Day (in lieu)" -#: ./holidays/countries/thailand.py:123 +#: ./holidays/countries/thailand.py:122 msgid "วันหยุดพิเศษ (เพิ่มเติม)" msgstr "Bridge Public Holiday" -#: ./holidays/countries/thailand.py:127 +#: ./holidays/countries/thailand.py:126 msgid "พระราชพิธีกาญจนาภิเษก พ.ศ. 2539" msgstr "HM King Bhumibol Adulyadej's Golden Jubilee" -#: ./holidays/countries/thailand.py:128 +#: ./holidays/countries/thailand.py:127 msgid "พระราชพิธีฉลองสิริราชสมบัติครบ 60 ปี พ.ศ. 2549" msgstr "HM King Bhumibol Adulyadej's 60th Anniversary of Accession Event" -#: ./holidays/countries/thailand.py:131 +#: ./holidays/countries/thailand.py:130 msgid "วันหยุดพิเศษ (คมช.)" msgstr "Emergency Lockdown (Thai Military Coup d'état)" -#: ./holidays/countries/thailand.py:132 +#: ./holidays/countries/thailand.py:131 msgid "วันหยุดพิเศษ (การเมือง)" msgstr "Emergency Lockdown (Thai Political Unrest)" -#: ./holidays/countries/thailand.py:133 +#: ./holidays/countries/thailand.py:132 msgid "วันหยุดพิเศษ (มหาอุทกภัย พ.ศ. 2554)" msgstr "Emergency Lockdown (2011 Thailand Floods)" -#: ./holidays/countries/thailand.py:136 +#: ./holidays/countries/thailand.py:135 msgid "วันหยุดพิเศษ (ร่วมถวายอาลัย ส่งดวงพระวิญญาณพระบรมศพ)" msgstr "Day of Mourning for HM King Bhumibol Adulyadej" -#: ./holidays/countries/thailand.py:139 +#: ./holidays/countries/thailand.py:138 msgid "" "วันพระราชพิธีถวายพระเพลิงพระบรมศพพระบาทสมเด็จพระปรมินทรมหาภูมิพลอดุลยเดช" msgstr "HM King Bhumibol Adulyadej's Royal Cremation Ceremony" -#: ./holidays/countries/thailand.py:143 +#: ./holidays/countries/thailand.py:142 msgid "พระราชพิธีบรมราชาภิเษก พระบาทสมเด็จพระวชิรเกล้าเจ้าอยู่หัว" msgstr "HM King Maha Vajiralongkorn's Coronation Celebrations" -#: ./holidays/countries/thailand.py:146 +#: ./holidays/countries/thailand.py:145 msgid "ชดเชยวันสงกรานต์" msgstr "Songkran Festival (in lieu)" -#: ./holidays/countries/thailand.py:293 ./holidays/countries/thailand.py:317 -#: ./holidays/countries/thailand.py:369 ./holidays/countries/thailand.py:637 -#: ./holidays/countries/thailand.py:642 +#: ./holidays/countries/thailand.py:292 ./holidays/countries/thailand.py:316 +#: ./holidays/countries/thailand.py:368 ./holidays/countries/thailand.py:628 +#: ./holidays/countries/thailand.py:633 #, c-format msgid "ชดเชย%s" msgstr "%s (in lieu)" -#: ./holidays/countries/thailand.py:305 +#: ./holidays/countries/thailand.py:304 msgid "วันขึ้นปีใหม่" msgstr "New Year's Day" -#: ./holidays/countries/thailand.py:317 ./holidays/countries/thailand.py:573 +#: ./holidays/countries/thailand.py:316 ./holidays/countries/thailand.py:572 msgid "วันสิ้นปี" msgstr "New Year's Eve" -#: ./holidays/countries/thailand.py:331 +#: ./holidays/countries/thailand.py:330 msgid "วันจักรี" msgstr "Chakri Memorial Day" -#: ./holidays/countries/thailand.py:348 +#: ./holidays/countries/thailand.py:347 msgid "วันสงกรานต์" msgstr "Songkran Festival" -#: ./holidays/countries/thailand.py:392 +#: ./holidays/countries/thailand.py:391 msgid "วันแรงงานแห่งชาติ" msgstr "National Labour Day" -#: ./holidays/countries/thailand.py:403 +#: ./holidays/countries/thailand.py:402 msgid "วันชาติ" msgstr "National Day" -#: ./holidays/countries/thailand.py:413 +#: ./holidays/countries/thailand.py:412 msgid "วันฉัตรมงคล" msgstr "Coronation Day" -#: ./holidays/countries/thailand.py:428 +#: ./holidays/countries/thailand.py:427 msgid "" "วันเฉลิมพระชนมพรรษาสมเด็จพระนางเจ้าสุทิดา พัชรสุธาพิมลลักษณ พระบรมราชินี" msgstr "HM Queen Suthida's Birthday" -#: ./holidays/countries/thailand.py:445 +#: ./holidays/countries/thailand.py:444 msgid "" "วันเฉลิมพระชนมพรรษาพระบาทสมเด็จพระปรเมนทรรามาธิบดีศรีสินทรมหาวชิราลงกรณ " "พระวชิรเกล้าเจ้าอยู่หัว" msgstr "HM King Maha Vajiralongkorn's Birthday" -#: ./holidays/countries/thailand.py:467 +#: ./holidays/countries/thailand.py:466 msgid "วันเฉลิมพระชนมพรรษาสมเด็จพระนางเจ้าสิริกิติ์ พระบรมราชินีนาถ" msgstr "HM Queen Sirikit's Birthday" -#: ./holidays/countries/thailand.py:465 +#: ./holidays/countries/thailand.py:464 msgid "วันเฉลิมพระชนมพรรษาสมเด็จพระบรมราชชนนีพันปีหลวง" msgstr "HM Queen Sirikit The Queen Mother's Birthday" -#: ./holidays/countries/thailand.py:482 +#: ./holidays/countries/thailand.py:481 msgid "วันแม่แห่งชาติ" msgstr "National Mother's Day" -#: ./holidays/countries/thailand.py:502 +#: ./holidays/countries/thailand.py:501 msgid "วันคล้ายวันสวรรคตพระบาทสมเด็จพระปรมินทรมหาภูมิพลอดุลยเดช บรมนาถบพิตร" msgstr "HM King Bhumibol Adulyadej Memorial Day" -#: ./holidays/countries/thailand.py:497 +#: ./holidays/countries/thailand.py:496 msgid "" "วันคล้ายวันสวรรคตพระบาทสมเด็จพระบรมชนกาธิเบศร มหาภูมิพลอดุลยเดชมหาราช " "บรมนาถบพิตร" msgstr "HM King Bhumibol Adulyadej the Great Memorial Day" -#: ./holidays/countries/thailand.py:515 +#: ./holidays/countries/thailand.py:514 msgid "วันปิยมหาราช" msgstr "HM King Chulalongkorn Memorial Day" -#: ./holidays/countries/thailand.py:538 +#: ./holidays/countries/thailand.py:537 msgid "วันเฉลิมพระชนมพรรษาพระบาทสมเด็จพระปรมินทรมหาภูมิพลอดุลยเดช บรมนาถบพิตร" msgstr "HM King Bhumibol Adulyadej's Birthday" -#: ./holidays/countries/thailand.py:533 +#: ./holidays/countries/thailand.py:532 msgid "" "วันคล้ายวันเฉลิมพระชนมพรรษาพระบาทสมเด็จพระปรมินทรมหาภูมิพลอดุลยเดช " "บรมนาถบพิตร" msgstr "HM King Bhumibol Adulyadej's Birthday" -#: ./holidays/countries/thailand.py:527 +#: ./holidays/countries/thailand.py:526 msgid "" "วันคล้ายวันเฉลิมพระชนมพรรษาพระบาทสมเด็จพระบรมชนกาธิเบศร " "มหาภูมิพลอดุลยเดชมหาราช บรมนาถบพิตร" msgstr "HM King Bhumibol Adulyadej the Great's Birthday" -#: ./holidays/countries/thailand.py:554 +#: ./holidays/countries/thailand.py:553 msgid "วันพ่อแห่งชาติ" msgstr "National Father's Day" -#: ./holidays/countries/thailand.py:563 +#: ./holidays/countries/thailand.py:562 msgid "วันรัฐธรรมนูญ" msgstr "Constitution Day" -#: ./holidays/countries/thailand.py:590 +#: ./holidays/countries/thailand.py:586 msgid "วันมาฆบูชา" msgstr "Makha Bucha" -#: ./holidays/countries/thailand.py:600 +#: ./holidays/countries/thailand.py:594 msgid "วันวิสาขบูชา" msgstr "Visakha Bucha" -#: ./holidays/countries/thailand.py:610 ./holidays/countries/thailand.py:642 +#: ./holidays/countries/thailand.py:603 ./holidays/countries/thailand.py:633 msgid "วันอาสาฬหบูชา" msgstr "Asarnha Bucha" -#: ./holidays/countries/thailand.py:619 ./holidays/countries/thailand.py:637 +#: ./holidays/countries/thailand.py:610 ./holidays/countries/thailand.py:628 msgid "วันเข้าพรรษา" msgstr "Buddhist Lent Day" -#: ./holidays/countries/thailand.py:658 +#: ./holidays/countries/thailand.py:649 msgid "วันพืชมงคล" msgstr "Royal Ploughing Ceremony" diff --git a/holidays/locale/km/LC_MESSAGES/KH.po b/holidays/locale/km/LC_MESSAGES/KH.po index 0d493eab2..87c6d3939 100644 --- a/holidays/locale/km/LC_MESSAGES/KH.po +++ b/holidays/locale/km/LC_MESSAGES/KH.po @@ -114,26 +114,26 @@ msgid "ទិវាសិទ្ធិមនុស្សអន្តរជាត msgstr "" #. Meak Bochea Day -#: ./holidays/countries/cambodia.py:282 +#: ./holidays/countries/cambodia.py:280 msgid "ពិធីបុណ្យមាឃបូជា" msgstr "" #. Visaka Bochea Day -#: ./holidays/countries/cambodia.py:293 +#: ./holidays/countries/cambodia.py:289 msgid "ពិធីបុណ្យវិសាខបូជា" msgstr "" #. Royal Ploughing Ceremony -#: ./holidays/countries/cambodia.py:304 +#: ./holidays/countries/cambodia.py:297 msgid "ព្រះរាជពិធីច្រត់ព្រះនង្គ័ល" msgstr "" #. Pchum Ben Day -#: ./holidays/countries/cambodia.py:314 +#: ./holidays/countries/cambodia.py:305 msgid "ពិធីបុណ្យភ្ផុំបិណ្ឌ" msgstr "" #. Water Festival -#: ./holidays/countries/cambodia.py:326 +#: ./holidays/countries/cambodia.py:316 msgid "ព្រះរាជពិធីបុណ្យអុំទូក បណ្តែតប្រទីប និងសំពះព្រះខែអកអំបុក" msgstr "" diff --git a/holidays/locale/th/LC_MESSAGES/KH.po b/holidays/locale/th/LC_MESSAGES/KH.po index 336baafe1..224fbe4fb 100644 --- a/holidays/locale/th/LC_MESSAGES/KH.po +++ b/holidays/locale/th/LC_MESSAGES/KH.po @@ -120,26 +120,26 @@ msgid "ទិវាសិទ្ធិមនុស្សអន្តរជាត msgstr "วันสิทธิมนุษยชนโลก" #. Meak Bochea Day -#: ./holidays/countries/cambodia.py:282 +#: ./holidays/countries/cambodia.py:280 msgid "ពិធីបុណ្យមាឃបូជា" msgstr "วันมาฆบูชา" #. Visaka Bochea Day -#: ./holidays/countries/cambodia.py:293 +#: ./holidays/countries/cambodia.py:289 msgid "ពិធីបុណ្យវិសាខបូជា" msgstr "วันวิสาขบูชา" #. Royal Ploughing Ceremony -#: ./holidays/countries/cambodia.py:304 +#: ./holidays/countries/cambodia.py:297 msgid "ព្រះរាជពិធីច្រត់ព្រះនង្គ័ល" msgstr "พระราชพิธีบุญจรดพระนังคัลแรกนาขวัญ" #. Pchum Ben Day -#: ./holidays/countries/cambodia.py:314 +#: ./holidays/countries/cambodia.py:305 msgid "ពិធីបុណ្យភ្ផុំបិណ្ឌ" msgstr "เทศกาลงานวันสาร์ทภจุมบิณฑ์เขมร" #. Water Festival -#: ./holidays/countries/cambodia.py:326 +#: ./holidays/countries/cambodia.py:316 msgid "ព្រះរាជពិធីបុណ្យអុំទូក បណ្តែតប្រទីប និងសំពះព្រះខែអកអំបុក" msgstr "พระราชพิธีบุญแข่งเรือลอยกระทงไฟไหว้พระจันทร์และกินข้าวเม่า" diff --git a/holidays/locale/th/LC_MESSAGES/TH.po b/holidays/locale/th/LC_MESSAGES/TH.po index cb00eceea..d57f0e696 100644 --- a/holidays/locale/th/LC_MESSAGES/TH.po +++ b/holidays/locale/th/LC_MESSAGES/TH.po @@ -14,171 +14,171 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "X-Generator: Poedit 3.2.2\n" -#: ./holidays/countries/thailand.py:120 +#: ./holidays/countries/thailand.py:119 msgid "วันหยุดชดเชย" msgstr "" -#: ./holidays/countries/thailand.py:121 +#: ./holidays/countries/thailand.py:120 msgid "วันเลือกตั้ง" msgstr "" -#: ./holidays/countries/thailand.py:293 ./holidays/countries/thailand.py:317 -#: ./holidays/countries/thailand.py:369 ./holidays/countries/thailand.py:637 -#: ./holidays/countries/thailand.py:642 +#: ./holidays/countries/thailand.py:292 ./holidays/countries/thailand.py:316 +#: ./holidays/countries/thailand.py:368 ./holidays/countries/thailand.py:628 +#: ./holidays/countries/thailand.py:633 #, c-format msgid "ชดเชย%s" msgstr "" -#: ./holidays/countries/thailand.py:123 +#: ./holidays/countries/thailand.py:122 msgid "วันหยุดพิเศษ (เพิ่มเติม)" msgstr "" -#: ./holidays/countries/thailand.py:127 +#: ./holidays/countries/thailand.py:126 msgid "พระราชพิธีกาญจนาภิเษก พ.ศ. 2539" msgstr "" -#: ./holidays/countries/thailand.py:128 +#: ./holidays/countries/thailand.py:127 msgid "พระราชพิธีฉลองสิริราชสมบัติครบ 60 ปี พ.ศ. 2549" msgstr "" -#: ./holidays/countries/thailand.py:131 +#: ./holidays/countries/thailand.py:130 msgid "วันหยุดพิเศษ (คมช.)" msgstr "" -#: ./holidays/countries/thailand.py:132 +#: ./holidays/countries/thailand.py:131 msgid "วันหยุดพิเศษ (การเมือง)" msgstr "" -#: ./holidays/countries/thailand.py:133 +#: ./holidays/countries/thailand.py:132 msgid "วันหยุดพิเศษ (มหาอุทกภัย พ.ศ. 2554)" msgstr "" -#: ./holidays/countries/thailand.py:136 +#: ./holidays/countries/thailand.py:135 msgid "วันหยุดพิเศษ (ร่วมถวายอาลัย ส่งดวงพระวิญญาณพระบรมศพ)" msgstr "" -#: ./holidays/countries/thailand.py:139 +#: ./holidays/countries/thailand.py:138 msgid "" "วันพระราชพิธีถวายพระเพลิงพระบรมศพพระบาทสมเด็จพระปรมินทรมหาภูมิพลอดุลยเดช" msgstr "" -#: ./holidays/countries/thailand.py:143 +#: ./holidays/countries/thailand.py:142 msgid "พระราชพิธีบรมราชาภิเษก พระบาทสมเด็จพระวชิรเกล้าเจ้าอยู่หัว" msgstr "" -#: ./holidays/countries/thailand.py:348 +#: ./holidays/countries/thailand.py:347 msgid "วันสงกรานต์" msgstr "" -#: ./holidays/countries/thailand.py:305 +#: ./holidays/countries/thailand.py:304 msgid "วันขึ้นปีใหม่" msgstr "" -#: ./holidays/countries/thailand.py:317 ./holidays/countries/thailand.py:573 +#: ./holidays/countries/thailand.py:316 ./holidays/countries/thailand.py:572 msgid "วันสิ้นปี" msgstr "" -#: ./holidays/countries/thailand.py:331 +#: ./holidays/countries/thailand.py:330 msgid "วันจักรี" msgstr "" -#: ./holidays/countries/thailand.py:392 +#: ./holidays/countries/thailand.py:391 msgid "วันแรงงานแห่งชาติ" msgstr "" -#: ./holidays/countries/thailand.py:403 +#: ./holidays/countries/thailand.py:402 msgid "วันชาติ" msgstr "" -#: ./holidays/countries/thailand.py:413 +#: ./holidays/countries/thailand.py:412 msgid "วันฉัตรมงคล" msgstr "" -#: ./holidays/countries/thailand.py:428 +#: ./holidays/countries/thailand.py:427 msgid "" "วันเฉลิมพระชนมพรรษาสมเด็จพระนางเจ้าสุทิดา พัชรสุธาพิมลลักษณ พระบรมราชินี" msgstr "" -#: ./holidays/countries/thailand.py:445 +#: ./holidays/countries/thailand.py:444 msgid "" "วันเฉลิมพระชนมพรรษาพระบาทสมเด็จพระปรเมนทรรามาธิบดีศรีสินทรมหาวชิราลงกรณ " "พระวชิรเกล้าเจ้าอยู่หัว" msgstr "" -#: ./holidays/countries/thailand.py:467 +#: ./holidays/countries/thailand.py:466 msgid "วันเฉลิมพระชนมพรรษาสมเด็จพระนางเจ้าสิริกิติ์ พระบรมราชินีนาถ" msgstr "" -#: ./holidays/countries/thailand.py:465 +#: ./holidays/countries/thailand.py:464 msgid "วันเฉลิมพระชนมพรรษาสมเด็จพระบรมราชชนนีพันปีหลวง" msgstr "" -#: ./holidays/countries/thailand.py:482 +#: ./holidays/countries/thailand.py:481 msgid "วันแม่แห่งชาติ" msgstr "" -#: ./holidays/countries/thailand.py:502 +#: ./holidays/countries/thailand.py:501 msgid "วันคล้ายวันสวรรคตพระบาทสมเด็จพระปรมินทรมหาภูมิพลอดุลยเดช บรมนาถบพิตร" msgstr "" -#: ./holidays/countries/thailand.py:497 +#: ./holidays/countries/thailand.py:496 msgid "" "วันคล้ายวันสวรรคตพระบาทสมเด็จพระบรมชนกาธิเบศร มหาภูมิพลอดุลยเดชมหาราช " "บรมนาถบพิตร" msgstr "" -#: ./holidays/countries/thailand.py:515 +#: ./holidays/countries/thailand.py:514 msgid "วันปิยมหาราช" msgstr "" -#: ./holidays/countries/thailand.py:538 +#: ./holidays/countries/thailand.py:537 msgid "วันเฉลิมพระชนมพรรษาพระบาทสมเด็จพระปรมินทรมหาภูมิพลอดุลยเดช บรมนาถบพิตร" msgstr "" -#: ./holidays/countries/thailand.py:533 +#: ./holidays/countries/thailand.py:532 msgid "" "วันคล้ายวันเฉลิมพระชนมพรรษาพระบาทสมเด็จพระปรมินทรมหาภูมิพลอดุลยเดช " "บรมนาถบพิตร" msgstr "" -#: ./holidays/countries/thailand.py:527 +#: ./holidays/countries/thailand.py:526 msgid "" "วันคล้ายวันเฉลิมพระชนมพรรษาพระบาทสมเด็จพระบรมชนกาธิเบศร " "มหาภูมิพลอดุลยเดชมหาราช บรมนาถบพิตร" msgstr "" -#: ./holidays/countries/thailand.py:554 +#: ./holidays/countries/thailand.py:553 msgid "วันพ่อแห่งชาติ" msgstr "" -#: ./holidays/countries/thailand.py:563 +#: ./holidays/countries/thailand.py:562 msgid "วันรัฐธรรมนูญ" msgstr "" -#: ./holidays/countries/thailand.py:590 +#: ./holidays/countries/thailand.py:586 msgid "วันมาฆบูชา" msgstr "" -#: ./holidays/countries/thailand.py:600 +#: ./holidays/countries/thailand.py:594 msgid "วันวิสาขบูชา" msgstr "" -#: ./holidays/countries/thailand.py:610 ./holidays/countries/thailand.py:642 +#: ./holidays/countries/thailand.py:603 ./holidays/countries/thailand.py:633 msgid "วันอาสาฬหบูชา" msgstr "" -#: ./holidays/countries/thailand.py:619 ./holidays/countries/thailand.py:637 +#: ./holidays/countries/thailand.py:610 ./holidays/countries/thailand.py:628 msgid "วันเข้าพรรษา" msgstr "" -#: ./holidays/countries/thailand.py:658 +#: ./holidays/countries/thailand.py:649 msgid "วันพืชมงคล" msgstr "" -#: ./holidays/countries/thailand.py:122 +#: ./holidays/countries/thailand.py:121 msgid "ชดเชยวันเลือกตั้ง" msgstr "" -#: ./holidays/countries/thailand.py:146 +#: ./holidays/countries/thailand.py:145 msgid "ชดเชยวันสงกรานต์" msgstr "" From 0a2a78b330403df052a39d42b7eb449e86455280 Mon Sep 17 00:00:00 2001 From: PPsyrius <19505219+PPsyrius@users.noreply.github.com> Date: Sat, 10 Jun 2023 14:31:46 +0700 Subject: [PATCH 15/20] [KH] oof, typo fixed --- holidays/countries/cambodia.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/holidays/countries/cambodia.py b/holidays/countries/cambodia.py index 79664dc00..b6cfa8515 100644 --- a/holidays/countries/cambodia.py +++ b/holidays/countries/cambodia.py @@ -303,7 +303,7 @@ def _populate(self, year): # Pchum Ben Day pchum_ben = tr("ពិធីបុណ្យភ្ផុំបិណ្ឌ") - pchum_ben_date = self.add_pchum_ben(pchum_ben) + pchum_ben_date = self._add_pchum_ben(pchum_ben) if pchum_ben_date: self._add_holiday(pchum_ben, pchum_ben_date + td(days=-1)) if year >= 2017: From 583f4dde61b6dd9fddaeb19142c3ed34cf5d9d20 Mon Sep 17 00:00:00 2001 From: PPsyrius <19505219+PPsyrius@users.noreply.github.com> Date: Sat, 10 Jun 2023 14:50:39 +0700 Subject: [PATCH 16/20] [group] `__verify+calender()` test for `ThaiCalendarHolidays` --- tests/test_holiday_groups.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/test_holiday_groups.py b/tests/test_holiday_groups.py index 470d8c835..41b36bd72 100644 --- a/tests/test_holiday_groups.py +++ b/tests/test_holiday_groups.py @@ -12,7 +12,7 @@ from unittest import TestCase from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays +from holidays.holiday_groups import ChristianHolidays, ThaiCalendarHolidays class TestChristianHolidays(TestCase): @@ -37,3 +37,11 @@ def _populate(self, year): test_holidays._add_christmas_day_three("Third day") self.assertIn("2022-12-27", test_holidays) self.assertEqual(1, len(test_holidays)) + + +class TestThaiCalendarHolidays(TestCase): + def test_check_calendar(self): + self.assertRaises( + ValueError, + lambda: ThaiCalendarHolidays("INVALID_CALENDAR"), + ) From e8b2cfa56351bac863d1c81748efc289605bca97 Mon Sep 17 00:00:00 2001 From: PPsyrius <19505219+PPsyrius@users.noreply.github.com> Date: Mon, 12 Jun 2023 12:18:36 +0700 Subject: [PATCH 17/20] [group] remove redundant checks --- holidays/groups/thai.py | 35 ++++++++++------------------------- tests/test_holiday_groups.py | 10 +--------- 2 files changed, 11 insertions(+), 34 deletions(-) diff --git a/holidays/groups/thai.py b/holidays/groups/thai.py index 3afb05d62..7c1fad0de 100644 --- a/holidays/groups/thai.py +++ b/holidays/groups/thai.py @@ -12,7 +12,7 @@ from datetime import date from typing import Optional -from holidays.calendars import _ThaiLunisolar, KHMER_CALENDAR, THAI_CALENDAR +from holidays.calendars import _ThaiLunisolar, THAI_CALENDAR class ThaiCalendarHolidays: @@ -20,23 +20,12 @@ class ThaiCalendarHolidays: Thai lunisolar calendar holidays. For more info, see class `_ThaiLunisolar`. + Calendar-type checking are done by `_ThaiLunisolar`. """ def __init__(self, calendar=THAI_CALENDAR) -> None: - self.__verify_calendar(calendar) self.__calendar = calendar - self.__thai_calendar = _ThaiLunisolar(calendar) - - @staticmethod - def __verify_calendar(calendar): - """ - Verify calendar type. - """ - if calendar not in {KHMER_CALENDAR, THAI_CALENDAR}: - raise ValueError( - f"Unknown calendar name: {calendar}. " - "Use `KHMER_CALENDAR` or `THAI_CALENDAR`." - ) + self._thai_calendar = _ThaiLunisolar(calendar) def _add_asarnha_bucha(self, name, calendar=None) -> Optional[date]: """ @@ -51,10 +40,9 @@ def _add_asarnha_bucha(self, name, calendar=None) -> Optional[date]: https://en.wikipedia.org/wiki/Asalha_Puja """ calendar = calendar or self.__calendar - self.__verify_calendar(calendar) return self._add_thai_calendar_holiday( - name, self.__thai_calendar.asarnha_bucha_date(self._year, calendar) + name, self._thai_calendar.asarnha_bucha_date(self._year, calendar) ) def _add_khao_phansa(self, name, calendar=None) -> Optional[date]: @@ -70,10 +58,9 @@ def _add_khao_phansa(self, name, calendar=None) -> Optional[date]: https://en.wikipedia.org/wiki/Vassa """ calendar = calendar or self.__calendar - self.__verify_calendar(calendar) return self._add_thai_calendar_holiday( - name, self.__thai_calendar.khao_phansa_date(self._year, calendar) + name, self._thai_calendar.khao_phansa_date(self._year, calendar) ) def _add_loy_krathong(self, name) -> Optional[date]: @@ -89,7 +76,7 @@ def _add_loy_krathong(self, name) -> Optional[date]: """ return self._add_thai_calendar_holiday( - name, self.__thai_calendar.loy_krathong_date(self._year) + name, self._thai_calendar.loy_krathong_date(self._year) ) def _add_makha_bucha(self, name, calendar=None) -> Optional[date]: @@ -105,10 +92,9 @@ def _add_makha_bucha(self, name, calendar=None) -> Optional[date]: https://en.wikipedia.org/wiki/M%C4%81gha_P%C5%ABj%C4%81 """ calendar = calendar or self.__calendar - self.__verify_calendar(calendar) return self._add_thai_calendar_holiday( - name, self.__thai_calendar.makha_bucha_date(self._year, calendar) + name, self._thai_calendar.makha_bucha_date(self._year, calendar) ) def _add_pchum_ben(self, name) -> Optional[date]: @@ -123,7 +109,7 @@ def _add_pchum_ben(self, name) -> Optional[date]: """ return self._add_thai_calendar_holiday( - name, self.__thai_calendar.pchum_ben_date(self._year) + name, self._thai_calendar.pchum_ben_date(self._year) ) def _add_preah_neangkoal(self, name) -> Optional[date]: @@ -137,7 +123,7 @@ def _add_preah_neangkoal(self, name) -> Optional[date]: """ return self._add_thai_calendar_holiday( - name, self.__thai_calendar.preah_neangkoal_date(self._year) + name, self._thai_calendar.preah_neangkoal_date(self._year) ) def _add_thai_calendar_holiday(self, name, dt) -> Optional[date]: @@ -165,8 +151,7 @@ def _add_visakha_bucha(self, name, calendar=None) -> Optional[date]: https://en.wikipedia.org/wiki/M%C4%81gha_P%C5%ABj%C4%81 """ calendar = calendar or self.__calendar - self.__verify_calendar(calendar) return self._add_thai_calendar_holiday( - name, self.__thai_calendar.visakha_bucha_date(self._year, calendar) + name, self._thai_calendar.visakha_bucha_date(self._year, calendar) ) diff --git a/tests/test_holiday_groups.py b/tests/test_holiday_groups.py index 41b36bd72..470d8c835 100644 --- a/tests/test_holiday_groups.py +++ b/tests/test_holiday_groups.py @@ -12,7 +12,7 @@ from unittest import TestCase from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, ThaiCalendarHolidays +from holidays.holiday_groups import ChristianHolidays class TestChristianHolidays(TestCase): @@ -37,11 +37,3 @@ def _populate(self, year): test_holidays._add_christmas_day_three("Third day") self.assertIn("2022-12-27", test_holidays) self.assertEqual(1, len(test_holidays)) - - -class TestThaiCalendarHolidays(TestCase): - def test_check_calendar(self): - self.assertRaises( - ValueError, - lambda: ThaiCalendarHolidays("INVALID_CALENDAR"), - ) From bcd9a7bc9d456e6c90cc825a2b676795215df1ad Mon Sep 17 00:00:00 2001 From: PPsyrius <19505219+PPsyrius@users.noreply.github.com> Date: Fri, 16 Jun 2023 21:05:53 +0700 Subject: [PATCH 18/20] [KH] migrate children's day to holiday groups --- holidays/countries/cambodia.py | 2 +- tests/countries/test_cambodia.py | 294 +++++++++++++++---------------- 2 files changed, 140 insertions(+), 156 deletions(-) diff --git a/holidays/countries/cambodia.py b/holidays/countries/cambodia.py index b6cfa8515..f140f5189 100644 --- a/holidays/countries/cambodia.py +++ b/holidays/countries/cambodia.py @@ -169,7 +169,7 @@ def _populate(self, year): if year <= 2019: # International Children Day - self._add_holiday(tr("ទិវាកុមារអន្តរជាតិ"), JUN, 1) + self._add_childrens_day(tr("ទិវាកុមារអន្តរជាតិ")) # ព្រះរាជពិធីបុណ្យចម្រើនព្រះជន្ម សម្តេចព្រះមហាក្សត្រី ព្រះវររាជមាតា # នរោត្តម មុនិនាថ​ សីហនុ diff --git a/tests/countries/test_cambodia.py b/tests/countries/test_cambodia.py index 44369ec9b..3652ee9d9 100644 --- a/tests/countries/test_cambodia.py +++ b/tests/countries/test_cambodia.py @@ -39,7 +39,7 @@ def test_special_holidays(self): ) def test_2022(self): - self.assertHolidays( + self.assertHoliday( Cambodia(years=2022), ("2022-01-01", "ទិវាចូលឆ្នាំសាកល"), ("2022-01-07", "ទិវាជ័យជម្នះលើរបបប្រល័យពូជសាសន៍"), @@ -102,7 +102,7 @@ def test_2022(self): ) def test_2023(self): - self.assertHolidays( + self.assertHoliday( Cambodia(years=2023), ("2023-01-01", "ទិវាចូលឆ្នាំសាកល"), ("2023-01-07", "ទិវាជ័យជម្នះលើរបបប្រល័យពូជសាសន៍"), @@ -163,7 +163,7 @@ def test_2023(self): ) def test_day_of_victory_over_genocidal_regime(self): - self.assertHolidaysName( + self.assertHolidayName( "ទិវាជ័យជម្នះលើរបបប្រល័យពូជសាសន៍", (f"{year}-01-07" for year in range(1993, 2058)), ) @@ -186,27 +186,27 @@ def test_king_sihamoni_birthday(self): "ព្រះបាទសម្តេចព្រះបរមនាថ នរោត្តម សីហមុនី" ) self.assertNoHolidayName(name, 2004) - self.assertHolidaysName( + self.assertHolidayName( name, (f"{year}-05-13" for year in range(2005, 2020)) ) - self.assertHolidaysName( + self.assertHolidayName( name, (f"{year}-05-14" for year in range(2005, 2058)) ) - self.assertHolidaysName( + self.assertHolidayName( name, (f"{year}-05-15" for year in range(2005, 2020)) ) def test_national_day_of_remembrance(self): name = "ទិវាជាតិនៃការចងចាំ" self.assertNoHolidayName(name, 2017) - self.assertHolidaysName( + self.assertHolidayName( name, (f"{year}-05-20" for year in range(2018, 2020)) ) self.assertNoHolidayName(name, 2020) def test_international_children_day(self): name = "ទិវាកុមារអន្តរជាតិ" - self.assertHolidaysName( + self.assertHolidayName( name, (f"{year}-06-01" for year in range(1993, 2020)), ) @@ -218,12 +218,12 @@ def test_queen_mother_monineath_birthday(self): "ព្រះវររាជមាតា នរោត្តម មុនិនាថ​ សីហនុ" ) self.assertNoHolidayName(name, 1993) - self.assertHolidaysName( + self.assertHolidayName( name, (f"{year}-06-18" for year in range(1994, 2058)) ) def test_constitution_day(self): - self.assertHolidaysName( + self.assertHolidayName( "ទិវាប្រកាសរដ្ឋធម្មនុញ្ញ", (f"{year}-09-24" for year in range(1993, 2058)), ) @@ -235,14 +235,14 @@ def test_king_sihanouk_memorial_day(self): " និងឯកភាពជាតិខ្មែរ ព្រះបរមរតនកោដ្ឋ" ) self.assertNoHolidayName(name, 2011) - self.assertHolidaysName( + self.assertHolidayName( name, (f"{year}-10-15" for year in range(2012, 2058)), ) def test_paris_peace_agreement_day(self): name = "ទិវារំលឹកសន្ធិសញ្ញាសន្តិភាពទីក្រុងប៉ារីស" - self.assertHolidaysName( + self.assertHolidayName( name, (f"{year}-10-23" for year in range(1993, 2020)), ) @@ -255,19 +255,19 @@ def test_king_sihamoni_coronation_day(self): "ព្រះមហាក្សត្រនៃព្រះរាជាណាចក្រកម្ពុជា" ) self.assertNoHolidayName(name, 2003) - self.assertHolidaysName( + self.assertHolidayName( name, (f"{year}-10-29" for year in range(2004, 2058)) ) def test_national_independence_day(self): - self.assertHolidaysName( + self.assertHolidayName( "ពិធីបុណ្យឯករាជ្យជាតិ", (f"{year}-11-09" for year in range(1993, 2058)), ) def test_international_human_rights_day(self): name = "ទិវាសិទ្ធិមនុស្សអន្តរជាតិ" - self.assertHolidaysName( + self.assertHolidayName( name, (f"{year}-12-10" for year in range(1993, 2020)), ) @@ -275,7 +275,7 @@ def test_international_human_rights_day(self): def test_meak_bochea(self): name = "ពិធីបុណ្យមាឃបូជា" - self.assertHolidaysName( + self.assertHolidayName( name, "2015-02-03", "2016-02-22", @@ -287,7 +287,7 @@ def test_meak_bochea(self): def test_visaka_bochea(self): name = "ពិធីបុណ្យវិសាខបូជា" - self.assertHolidaysName( + self.assertHolidayName( name, "2015-05-02", "2016-05-20", @@ -303,7 +303,7 @@ def test_visaka_bochea(self): def test_preah_neangkoal(self): name = "ព្រះរាជពិធីច្រត់ព្រះនង្គ័ល" - self.assertHolidaysName( + self.assertHolidayName( name, "2015-05-06", "2016-05-24", @@ -319,7 +319,7 @@ def test_preah_neangkoal(self): def test_pchum_ben(self): name = "ពិធីបុណ្យភ្ផុំបិណ្ឌ" - self.assertHolidaysName( + self.assertHolidayName( name, # 2 Days Celebration "2015-10-11", @@ -353,7 +353,7 @@ def test_pchum_ben(self): def test_bon_om_touk(self): name = "ព្រះរាជពិធីបុណ្យអុំទូក បណ្តែតប្រទីប និងសំពះព្រះខែអកអំបុក" - self.assertHolidaysName( + self.assertHolidayName( name, # 3 Days Celebration "2015-11-24", @@ -388,171 +388,155 @@ def test_bon_om_touk(self): def test_l10n_default(self): self.assertLocalizedHolidays( + ("2023-01-01", "ទិវាចូលឆ្នាំសាកល"), + ("2023-01-07", "ទិវាជ័យជម្នះលើរបបប្រល័យពូជសាសន៍"), + ("2023-03-08", "ទិវាអន្តរជាតិនារី"), + ("2023-04-14", "ពិធីបុណ្យចូលឆ្នាំថ្មីប្រពៃណីជាតិ"), + ("2023-04-15", "ពិធីបុណ្យចូលឆ្នាំថ្មីប្រពៃណីជាតិ"), + ("2023-04-16", "ពិធីបុណ្យចូលឆ្នាំថ្មីប្រពៃណីជាតិ"), + ("2023-05-01", "ទិវាពលកម្មអន្តរជាតិ"), + ("2023-05-04", "ពិធីបុណ្យវិសាខបូជា"), + ("2023-05-08", "ព្រះរាជពិធីច្រត់ព្រះនង្គ័ល"), ( - ("2023-01-01", "ទិវាចូលឆ្នាំសាកល"), - ("2023-01-07", "ទិវាជ័យជម្នះលើរបបប្រល័យពូជសាសន៍"), - ("2023-03-08", "ទិវាអន្តរជាតិនារី"), - ("2023-04-14", "ពិធីបុណ្យចូលឆ្នាំថ្មីប្រពៃណីជាតិ"), - ("2023-04-15", "ពិធីបុណ្យចូលឆ្នាំថ្មីប្រពៃណីជាតិ"), - ("2023-04-16", "ពិធីបុណ្យចូលឆ្នាំថ្មីប្រពៃណីជាតិ"), - ("2023-05-01", "ទិវាពលកម្មអន្តរជាតិ"), - ("2023-05-04", "ពិធីបុណ្យវិសាខបូជា"), - ("2023-05-08", "ព្រះរាជពិធីច្រត់ព្រះនង្គ័ល"), - ( - "2023-05-14", - ( - "ព្រះរាជពិធីបុណ្យចម្រើនព្រះជន្ម ព្រះករុណា " - "ព្រះបាទសម្តេចព្រះបរមនាថ នរោត្តម សីហមុនី" - ), - ), - ( - "2023-06-18", - ( - "ព្រះរាជពិធីបុណ្យចម្រើនព្រះជន្ម សម្តេចព្រះមហាក្សត្រី " - "ព្រះវររាជមាតា នរោត្តម មុនិនាថ​ សីហនុ" - ), - ), - ("2023-09-24", "ទិវាប្រកាសរដ្ឋធម្មនុញ្ញ"), - ("2023-10-13", "ពិធីបុណ្យភ្ផុំបិណ្ឌ"), - ("2023-10-14", "ពិធីបុណ្យភ្ផុំបិណ្ឌ"), - ( - "2023-10-15", - ( - "ទិវាប្រារព្ឋពិធីគោរពព្រះវិញ្ញាណក្ខន្ឋ ព្រះករុណា " - "ព្រះបាទសម្តេចព្រះ នរោត្តម សីហនុ ព្រះមហាវីរក្សត្រ " - "ព្រះវររាជបិតាឯករាជ្យ បូរណភាពទឹកដី និងឯកភាពជាតិខ្មែរ " - "ព្រះបរមរតនកោដ្ឋ; ពិធីបុណ្យភ្ផុំបិណ្ឌ" - ), - ), + "2023-05-14", ( - "2023-10-29", - ( - "ព្រះរាជពិធីគ្រងព្រះបរមរាជសម្បត្តិ របស់ ព្រះករុណា " - "ព្រះបាទសម្តេចព្រះបរមនាថ នរោត្តម សីហមុនី " - "ព្រះមហាក្សត្រនៃព្រះរាជាណាចក្រកម្ពុជា" - ), + "ព្រះរាជពិធីបុណ្យចម្រើនព្រះជន្ម ព្រះករុណា " + "ព្រះបាទសម្តេចព្រះបរមនាថ នរោត្តម សីហមុនី" ), - ("2023-11-09", "ពិធីបុណ្យឯករាជ្យជាតិ"), + ), + ( + "2023-06-18", ( - "2023-11-26", - "ព្រះរាជពិធីបុណ្យអុំទូក បណ្តែតប្រទីប និងសំពះព្រះខែអកអំបុក", + "ព្រះរាជពិធីបុណ្យចម្រើនព្រះជន្ម សម្តេចព្រះមហាក្សត្រី " + "ព្រះវររាជមាតា នរោត្តម មុនិនាថ​ សីហនុ" ), + ), + ("2023-09-24", "ទិវាប្រកាសរដ្ឋធម្មនុញ្ញ"), + ("2023-10-13", "ពិធីបុណ្យភ្ផុំបិណ្ឌ"), + ("2023-10-14", "ពិធីបុណ្យភ្ផុំបិណ្ឌ"), + ( + "2023-10-15", ( - "2023-11-27", - "ព្រះរាជពិធីបុណ្យអុំទូក បណ្តែតប្រទីប និងសំពះព្រះខែអកអំបុក", + "ទិវាប្រារព្ឋពិធីគោរពព្រះវិញ្ញាណក្ខន្ឋ ព្រះករុណា " + "ព្រះបាទសម្តេចព្រះ នរោត្តម សីហនុ ព្រះមហាវីរក្សត្រ " + "ព្រះវររាជបិតាឯករាជ្យ បូរណភាពទឹកដី និងឯកភាពជាតិខ្មែរ " + "ព្រះបរមរតនកោដ្ឋ; ពិធីបុណ្យភ្ផុំបិណ្ឌ" ), + ), + ( + "2023-10-29", ( - "2023-11-28", - "ព្រះរាជពិធីបុណ្យអុំទូក បណ្តែតប្រទីប និងសំពះព្រះខែអកអំបុក", + "ព្រះរាជពិធីគ្រងព្រះបរមរាជសម្បត្តិ របស់ ព្រះករុណា " + "ព្រះបាទសម្តេចព្រះបរមនាថ នរោត្តម សីហមុនី " + "ព្រះមហាក្សត្រនៃព្រះរាជាណាចក្រកម្ពុជា" ), ), - "km", + ("2023-11-09", "ពិធីបុណ្យឯករាជ្យជាតិ"), + ( + "2023-11-26", + "ព្រះរាជពិធីបុណ្យអុំទូក បណ្តែតប្រទីប និងសំពះព្រះខែអកអំបុក", + ), + ( + "2023-11-27", + "ព្រះរាជពិធីបុណ្យអុំទូក បណ្តែតប្រទីប និងសំពះព្រះខែអកអំបុក", + ), + ( + "2023-11-28", + "ព្រះរាជពិធីបុណ្យអុំទូក បណ្តែតប្រទីប និងសំពះព្រះខែអកអំបុក", + ), ) def test_l10n_en_us(self): self.assertLocalizedHolidays( + "en_US", + ("2023-01-01", "International New Year Day"), + ("2023-01-07", "Day of Victory over the Genocidal Regime"), + ("2023-03-08", "International Women's Rights Day"), + ("2023-04-14", "Khmer New Year's Day"), + ("2023-04-15", "Khmer New Year's Day"), + ("2023-04-16", "Khmer New Year's Day"), + ("2023-05-01", "International Labor Day"), + ("2023-05-04", "Visaka Bochea Day"), + ("2023-05-08", "Royal Ploughing Ceremony"), + ("2023-05-14", "HM King Norodom Sihamoni's Birthday"), ( - ("2023-01-01", "International New Year Day"), - ("2023-01-07", "Day of Victory over the Genocidal Regime"), - ("2023-03-08", "International Women's Rights Day"), - ("2023-04-14", "Khmer New Year's Day"), - ("2023-04-15", "Khmer New Year's Day"), - ("2023-04-16", "Khmer New Year's Day"), - ("2023-05-01", "International Labor Day"), - ("2023-05-04", "Visaka Bochea Day"), - ("2023-05-08", "Royal Ploughing Ceremony"), - ("2023-05-14", "HM King Norodom Sihamoni's Birthday"), - ( - "2023-06-18", - ( - "HM Queen Norodom Monineath Sihanouk " - "the Queen-Mother's Birthday" - ), - ), - ("2023-09-24", "Constitution Day"), - ("2023-10-13", "Pchum Ben Day"), - ("2023-10-14", "Pchum Ben Day"), + "2023-06-18", ( - "2023-10-15", - "HM King Norodom Sihanouk Mourning Day; Pchum Ben Day", + "HM Queen Norodom Monineath Sihanouk " + "the Queen-Mother's Birthday" ), - ("2023-10-29", "HM King Norodom Sihamoni's Coronation Day"), - ("2023-11-09", "National Independence Day"), - ("2023-11-26", "Water Festival"), - ("2023-11-27", "Water Festival"), - ("2023-11-28", "Water Festival"), ), - "en_US", + ("2023-09-24", "Constitution Day"), + ("2023-10-13", "Pchum Ben Day"), + ("2023-10-14", "Pchum Ben Day"), + ( + "2023-10-15", + "HM King Norodom Sihanouk Mourning Day; Pchum Ben Day", + ), + ("2023-10-29", "HM King Norodom Sihamoni's Coronation Day"), + ("2023-11-09", "National Independence Day"), + ("2023-11-26", "Water Festival"), + ("2023-11-27", "Water Festival"), + ("2023-11-28", "Water Festival"), ) def test_l10n_th(self): self.assertLocalizedHolidays( + "th", + ("2023-01-01", "วันปีใหม่สากล"), + ("2023-01-07", "วันชัยชนะเหนือระบอบฆ่าล้างเผ่าพันธุ์เขมรแดง"), + ("2023-03-08", "วันสตรีสากล"), + ("2023-04-14", "เทศกาลขึ้นปีใหม่ประเพณี"), + ("2023-04-15", "เทศกาลขึ้นปีใหม่ประเพณี"), + ("2023-04-16", "เทศกาลขึ้นปีใหม่ประเพณี"), + ("2023-05-01", "วันแรงงานสากล"), + ("2023-05-04", "วันวิสาขบูชา"), + ("2023-05-08", "พระราชพิธีบุญจรดพระนังคัลแรกนาขวัญ"), ( - ("2023-01-01", "วันปีใหม่สากล"), - ("2023-01-07", "วันชัยชนะเหนือระบอบฆ่าล้างเผ่าพันธุ์เขมรแดง"), - ("2023-03-08", "วันสตรีสากล"), - ("2023-04-14", "เทศกาลขึ้นปีใหม่ประเพณี"), - ("2023-04-15", "เทศกาลขึ้นปีใหม่ประเพณี"), - ("2023-04-16", "เทศกาลขึ้นปีใหม่ประเพณี"), - ("2023-05-01", "วันแรงงานสากล"), - ("2023-05-04", "วันวิสาขบูชา"), - ("2023-05-08", "พระราชพิธีบุญจรดพระนังคัลแรกนาขวัญ"), - ( - "2023-05-14", - ( - "พระราชพิธีเฉลิมพระชนมพรรษา พระบาทสมเด็จพระบรมนาถ " - "นโรดมสีหมุนี พระมหากษัตริย์แห่งราชอาณาจักรกัมพูชา" - ), - ), - ( - "2023-06-18", - ( - "พระราชพิธีเฉลิมพระชนมพรรษา สมเด็จพระบรมราชินี " - "นโรดม มนีนาถ สีหนุ" - ), - ), - ("2023-09-24", "วันรัฐธรรมนูญ"), - ("2023-10-13", "เทศกาลงานวันสาร์ทภจุมบิณฑ์เขมร"), - ("2023-10-14", "เทศกาลงานวันสาร์ทภจุมบิณฑ์เขมร"), - ( - "2023-10-15", - ( - "วันสดุดีพระบาทสมเด็จพระบรมนาถนโรดม สีหนุ " - "พระบิดาแห่งเอกราช บูรณภาพแห่งดินแดน " - "และเอกภาพของชาติกัมพูชา; " - "เทศกาลงานวันสาร์ทภจุมบิณฑ์เขมร" - ), - ), + "2023-05-14", ( - "2023-10-29", - ( - "พระราชพิธีเฉลิมฉลองการขึ้นครองราชสมบัติ " - "พระบาทสมเด็จพระบรมนาถ นโรดมสีหมุนี " - "พระมหากษัตริย์แห่งราชอาณาจักรกัมพูชา" - ), + "พระราชพิธีเฉลิมพระชนมพรรษา พระบาทสมเด็จพระบรมนาถ " + "นโรดมสีหมุนี พระมหากษัตริย์แห่งราชอาณาจักรกัมพูชา" ), - ("2023-11-09", "วันประกาศเอกราชจากฝรั่งเศส"), + ), + ( + "2023-06-18", ( - "2023-11-26", - ( - "พระราชพิธีบุญแข่งเรือลอยกระทงไฟไหว้พระจันทร์" - "และกินข้าวเม่า" - ), + "พระราชพิธีเฉลิมพระชนมพรรษา สมเด็จพระบรมราชินี " + "นโรดม มนีนาถ สีหนุ" ), + ), + ("2023-09-24", "วันรัฐธรรมนูญ"), + ("2023-10-13", "เทศกาลงานวันสาร์ทภจุมบิณฑ์เขมร"), + ("2023-10-14", "เทศกาลงานวันสาร์ทภจุมบิณฑ์เขมร"), + ( + "2023-10-15", ( - "2023-11-27", - ( - "พระราชพิธีบุญแข่งเรือลอยกระทงไฟไหว้พระจันทร์" - "และกินข้าวเม่า" - ), + "วันสดุดีพระบาทสมเด็จพระบรมนาถนโรดม สีหนุ " + "พระบิดาแห่งเอกราช บูรณภาพแห่งดินแดน " + "และเอกภาพของชาติกัมพูชา; " + "เทศกาลงานวันสาร์ทภจุมบิณฑ์เขมร" ), + ), + ( + "2023-10-29", ( - "2023-11-28", - ( - "พระราชพิธีบุญแข่งเรือลอยกระทงไฟไหว้พระจันทร์" - "และกินข้าวเม่า" - ), + "พระราชพิธีเฉลิมฉลองการขึ้นครองราชสมบัติ " + "พระบาทสมเด็จพระบรมนาถ นโรดมสีหมุนี " + "พระมหากษัตริย์แห่งราชอาณาจักรกัมพูชา" ), ), - "th", + ("2023-11-09", "วันประกาศเอกราชจากฝรั่งเศส"), + ( + "2023-11-26", + "พระราชพิธีบุญแข่งเรือลอยกระทงไฟไหว้พระจันทร์และกินข้าวเม่า", + ), + ( + "2023-11-27", + "พระราชพิธีบุญแข่งเรือลอยกระทงไฟไหว้พระจันทร์และกินข้าวเม่า", + ), + ( + "2023-11-28", + "พระราชพิธีบุญแข่งเรือลอยกระทงไฟไหว้พระจันทร์และกินข้าวเม่า", + ), ) From a3f71d7b1c94c9b01c6d747347963686502d66ec Mon Sep 17 00:00:00 2001 From: PPsyrius <19505219+PPsyrius@users.noreply.github.com> Date: Fri, 16 Jun 2023 21:15:40 +0700 Subject: [PATCH 19/20] [KH] turn out not all Holidays got their s removed --- tests/countries/test_cambodia.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/countries/test_cambodia.py b/tests/countries/test_cambodia.py index 3652ee9d9..131fee6b1 100644 --- a/tests/countries/test_cambodia.py +++ b/tests/countries/test_cambodia.py @@ -39,7 +39,7 @@ def test_special_holidays(self): ) def test_2022(self): - self.assertHoliday( + self.assertHolidays( Cambodia(years=2022), ("2022-01-01", "ទិវាចូលឆ្នាំសាកល"), ("2022-01-07", "ទិវាជ័យជម្នះលើរបបប្រល័យពូជសាសន៍"), @@ -102,7 +102,7 @@ def test_2022(self): ) def test_2023(self): - self.assertHoliday( + self.assertHolidays( Cambodia(years=2023), ("2023-01-01", "ទិវាចូលឆ្នាំសាកល"), ("2023-01-07", "ទិវាជ័យជម្នះលើរបបប្រល័យពូជសាសន៍"), From 1cba9aee490a3bb01db687308ab9c95a07ce2a2f Mon Sep 17 00:00:00 2001 From: PPsyrius <19505219+PPsyrius@users.noreply.github.com> Date: Fri, 16 Jun 2023 22:21:02 +0700 Subject: [PATCH 20/20] [KH] adjust comment, rerun l10n Co-Authored-By: Arkadii Yakovets <2201626+arkid15r@users.noreply.github.com> --- holidays/countries/cambodia.py | 10 +-- holidays/countries/thailand.py | 9 +-- holidays/locale/en_US/LC_MESSAGES/KH.po | 44 ++++++------- holidays/locale/en_US/LC_MESSAGES/TH.po | 82 ++++++++++++------------- holidays/locale/km/LC_MESSAGES/KH.po | 44 ++++++------- holidays/locale/th/LC_MESSAGES/KH.po | 44 ++++++------- holidays/locale/th/LC_MESSAGES/TH.po | 82 ++++++++++++------------- 7 files changed, 152 insertions(+), 163 deletions(-) diff --git a/holidays/countries/cambodia.py b/holidays/countries/cambodia.py index f140f5189..0ae18c861 100644 --- a/holidays/countries/cambodia.py +++ b/holidays/countries/cambodia.py @@ -23,7 +23,6 @@ class Cambodia(HolidayBase, InternationalHolidays, ThaiCalendarHolidays): A subclass of :py:class:`HolidayBase` representing public holidays in Cambodia. - References: - Based on: https://www.nbc.gov.kh/english/news_and_events/official_holiday.php @@ -262,13 +261,8 @@ def _populate(self, year): self._add_holiday(tr("ទិវាសិទ្ធិមនុស្សអន្តរជាតិ"), DEC, 10) # Cambodian Lunar Calendar Holidays - - """ - See `_ThaiLunisolar` in holidays/utils.py for more details. - - Cambodian Lunar Calendar Holidays only work from 1941 (B.E. 2485) - onwards until 2057 (B.E. 2601). - """ + # See `_ThaiLunisolar` in holidays/utils.py for more details. + # Cambodian Lunar Calendar Holidays only work from 1941 to 2057. # ពិធីបុណ្យមាឃបូជា # Status: Defunct. diff --git a/holidays/countries/thailand.py b/holidays/countries/thailand.py index 4bd475327..42c032591 100644 --- a/holidays/countries/thailand.py +++ b/holidays/countries/thailand.py @@ -24,7 +24,6 @@ class Thailand(HolidayBase, InternationalHolidays, ThaiCalendarHolidays): A subclass of :py:class:`HolidayBase` representing public holidays in Thailand. (Based on South Korean and Singaporean Implementation) - References: - Based on: https://en.wikipedia.org/wiki/Public_holidays_in_Thailand @@ -572,13 +571,9 @@ def _add_observed(dt: date) -> None: self._add_new_years_eve(tr("วันสิ้นปี")) # Thai Lunar Calendar Holidays + # See `_ThaiLunisolar` in holidays/utils.py for more details. + # Thai Lunar Calendar Holidays only work from 1941 to 2057. - """ - See `_ThaiLunisolar` in holidays/utils.py for more details. - - Thai Lunar Calendar Holidays only work from 1941 (B.E. 2484) onwards - until 2057 (B.E. 2600). - """ # Makha Bucha. # วันมาฆบูชา # Status: In-Use. diff --git a/holidays/locale/en_US/LC_MESSAGES/KH.po b/holidays/locale/en_US/LC_MESSAGES/KH.po index 290088dff..2b1d76a57 100644 --- a/holidays/locale/en_US/LC_MESSAGES/KH.po +++ b/holidays/locale/en_US/LC_MESSAGES/KH.po @@ -16,74 +16,74 @@ msgstr "" "X-Generator: Poedit 3.3.1\n" #. Khmer New Year's Replacement Holiday -#: ./holidays/countries/cambodia.py:59 +#: ./holidays/countries/cambodia.py:58 msgid "ថ្ងៃឈប់សម្រាកសងជំនួសឲ្យពិធីបុណ្យចូលឆ្នាំថ្មីប្រពៃណីជាតិ" msgstr "Khmer New Year's Replacement Holiday" #. Special Public Holiday -#: ./holidays/countries/cambodia.py:64 +#: ./holidays/countries/cambodia.py:63 msgid "ថ្ងៃឈប់សម្រាកសងជំនួស" msgstr "Special Public Holiday" #. International New Year Day. -#: ./holidays/countries/cambodia.py:102 +#: ./holidays/countries/cambodia.py:101 msgid "ទិវាចូលឆ្នាំសាកល" msgstr "International New Year Day" #. Day of Victory over the Genocidal Regime. -#: ./holidays/countries/cambodia.py:109 +#: ./holidays/countries/cambodia.py:108 msgid "ទិវាជ័យជម្នះលើរបបប្រល័យពូជសាសន៍" msgstr "Day of Victory over the Genocidal Regime" #. International Women's Rights Day -#: ./holidays/countries/cambodia.py:115 +#: ./holidays/countries/cambodia.py:114 msgid "ទិវាអន្តរជាតិនារី" msgstr "International Women's Rights Day" #. Khmer New Year's Day -#: ./holidays/countries/cambodia.py:124 +#: ./holidays/countries/cambodia.py:123 msgid "ពិធីបុណ្យចូលឆ្នាំថ្មីប្រពៃណីជាតិ" msgstr "Khmer New Year's Day" #. International Labor Day -#: ./holidays/countries/cambodia.py:136 +#: ./holidays/countries/cambodia.py:135 msgid "ទិវាពលកម្មអន្តរជាតិ" msgstr "International Labor Day" #. Birthday of His Majesty Preah Bat Samdech Preah Boromneath NORODOM #. SIHAMONI, #. King of Cambodia -#: ./holidays/countries/cambodia.py:144 +#: ./holidays/countries/cambodia.py:143 msgid "" "ព្រះរាជពិធីបុណ្យចម្រើនព្រះជន្ម ព្រះករុណា ព្រះបាទសម្តេចព្រះបរមនាថ នរោត្តម " "សីហមុនី" msgstr "HM King Norodom Sihamoni's Birthday" #. National Day of Remembrance -#: ./holidays/countries/cambodia.py:164 +#: ./holidays/countries/cambodia.py:163 msgid "ទិវាជាតិនៃការចងចាំ" msgstr "National Day of Remembrance" #. International Children Day -#: ./holidays/countries/cambodia.py:172 +#: ./holidays/countries/cambodia.py:171 msgid "ទិវាកុមារអន្តរជាតិ" msgstr "International Children Day" #. Birthday of Her Majesty the Queen-Mother NORODOM MONINEATH SIHANOUK of #. Cambodia -#: ./holidays/countries/cambodia.py:183 +#: ./holidays/countries/cambodia.py:182 msgid "" "ព្រះរាជពិធីបុណ្យចម្រើនព្រះជន្ម សម្តេចព្រះមហាក្សត្រី ព្រះវររាជមាតា នរោត្តម " "មុនិនាថ​ សីហនុ" msgstr "HM Queen Norodom Monineath Sihanouk the Queen-Mother's Birthday" #. Constitution Day -#: ./holidays/countries/cambodia.py:196 +#: ./holidays/countries/cambodia.py:195 msgid "ទិវាប្រកាសរដ្ឋធម្មនុញ្ញ" msgstr "Constitution Day" #. Mourning Day of the Late King-Father NORODOM SIHANOUK of Cambodia -#: ./holidays/countries/cambodia.py:208 +#: ./holidays/countries/cambodia.py:207 msgid "" "ទិវាប្រារព្ឋពិធីគោរពព្រះវិញ្ញាណក្ខន្ឋ ព្រះករុណា ព្រះបាទសម្តេចព្រះ នរោត្តម " "សីហនុ ព្រះមហាវីរក្សត្រ ព្រះវររាជបិតាឯករាជ្យ បូរណភាពទឹកដី និងឯកភាពជាតិខ្មែរ " @@ -91,49 +91,49 @@ msgid "" msgstr "HM King Norodom Sihanouk Mourning Day" #. Paris Peace Agreement's Day -#: ./holidays/countries/cambodia.py:225 +#: ./holidays/countries/cambodia.py:224 msgid "ទិវារំលឹកសន្ធិសញ្ញាសន្តិភាពទីក្រុងប៉ារីស" msgstr "Paris Peace Agreement's Day" #. Coronation Day of His Majesty Preah Bat Samdech Preah Boromneath NORODOM #. SIHAMONI, King of Cambodia -#: ./holidays/countries/cambodia.py:240 +#: ./holidays/countries/cambodia.py:239 msgid "" "ព្រះរាជពិធីគ្រងព្រះបរមរាជសម្បត្តិ របស់ ព្រះករុណា ព្រះបាទសម្តេចព្រះបរមនាថ " "នរោត្តម សីហមុនី ព្រះមហាក្សត្រនៃព្រះរាជាណាចក្រកម្ពុជា" msgstr "HM King Norodom Sihamoni's Coronation Day" #. National Independence Day -#: ./holidays/countries/cambodia.py:254 +#: ./holidays/countries/cambodia.py:253 msgid "ពិធីបុណ្យឯករាជ្យជាតិ" msgstr "National Independence Day" #. International Human Rights Day -#: ./holidays/countries/cambodia.py:262 +#: ./holidays/countries/cambodia.py:261 msgid "ទិវាសិទ្ធិមនុស្សអន្តរជាតិ" msgstr "International Human Rights Day" #. Meak Bochea Day -#: ./holidays/countries/cambodia.py:280 +#: ./holidays/countries/cambodia.py:274 msgid "ពិធីបុណ្យមាឃបូជា" msgstr "Meak Bochea Day" #. Visaka Bochea Day -#: ./holidays/countries/cambodia.py:289 +#: ./holidays/countries/cambodia.py:283 msgid "ពិធីបុណ្យវិសាខបូជា" msgstr "Visaka Bochea Day" #. Royal Ploughing Ceremony -#: ./holidays/countries/cambodia.py:297 +#: ./holidays/countries/cambodia.py:291 msgid "ព្រះរាជពិធីច្រត់ព្រះនង្គ័ល" msgstr "Royal Ploughing Ceremony" #. Pchum Ben Day -#: ./holidays/countries/cambodia.py:305 +#: ./holidays/countries/cambodia.py:299 msgid "ពិធីបុណ្យភ្ផុំបិណ្ឌ" msgstr "Pchum Ben Day" #. Water Festival -#: ./holidays/countries/cambodia.py:316 +#: ./holidays/countries/cambodia.py:310 msgid "ព្រះរាជពិធីបុណ្យអុំទូក បណ្តែតប្រទីប និងសំពះព្រះខែអកអំបុក" msgstr "Water Festival" diff --git a/holidays/locale/en_US/LC_MESSAGES/TH.po b/holidays/locale/en_US/LC_MESSAGES/TH.po index 546077368..1a2eb7d78 100644 --- a/holidays/locale/en_US/LC_MESSAGES/TH.po +++ b/holidays/locale/en_US/LC_MESSAGES/TH.po @@ -14,171 +14,171 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "X-Generator: Poedit 3.2.2\n" -#: ./holidays/countries/thailand.py:119 +#: ./holidays/countries/thailand.py:118 msgid "วันหยุดชดเชย" msgstr "Special In Lieu Holiday" -#: ./holidays/countries/thailand.py:120 +#: ./holidays/countries/thailand.py:119 msgid "วันเลือกตั้ง" msgstr "Thai Election Day" -#: ./holidays/countries/thailand.py:121 +#: ./holidays/countries/thailand.py:120 msgid "ชดเชยวันเลือกตั้ง" msgstr "Thai Election Day (in lieu)" -#: ./holidays/countries/thailand.py:122 +#: ./holidays/countries/thailand.py:121 msgid "วันหยุดพิเศษ (เพิ่มเติม)" msgstr "Bridge Public Holiday" -#: ./holidays/countries/thailand.py:126 +#: ./holidays/countries/thailand.py:125 msgid "พระราชพิธีกาญจนาภิเษก พ.ศ. 2539" msgstr "HM King Bhumibol Adulyadej's Golden Jubilee" -#: ./holidays/countries/thailand.py:127 +#: ./holidays/countries/thailand.py:126 msgid "พระราชพิธีฉลองสิริราชสมบัติครบ 60 ปี พ.ศ. 2549" msgstr "HM King Bhumibol Adulyadej's 60th Anniversary of Accession Event" -#: ./holidays/countries/thailand.py:130 +#: ./holidays/countries/thailand.py:129 msgid "วันหยุดพิเศษ (คมช.)" msgstr "Emergency Lockdown (Thai Military Coup d'état)" -#: ./holidays/countries/thailand.py:131 +#: ./holidays/countries/thailand.py:130 msgid "วันหยุดพิเศษ (การเมือง)" msgstr "Emergency Lockdown (Thai Political Unrest)" -#: ./holidays/countries/thailand.py:132 +#: ./holidays/countries/thailand.py:131 msgid "วันหยุดพิเศษ (มหาอุทกภัย พ.ศ. 2554)" msgstr "Emergency Lockdown (2011 Thailand Floods)" -#: ./holidays/countries/thailand.py:135 +#: ./holidays/countries/thailand.py:134 msgid "วันหยุดพิเศษ (ร่วมถวายอาลัย ส่งดวงพระวิญญาณพระบรมศพ)" msgstr "Day of Mourning for HM King Bhumibol Adulyadej" -#: ./holidays/countries/thailand.py:138 +#: ./holidays/countries/thailand.py:137 msgid "" "วันพระราชพิธีถวายพระเพลิงพระบรมศพพระบาทสมเด็จพระปรมินทรมหาภูมิพลอดุลยเดช" msgstr "HM King Bhumibol Adulyadej's Royal Cremation Ceremony" -#: ./holidays/countries/thailand.py:142 +#: ./holidays/countries/thailand.py:141 msgid "พระราชพิธีบรมราชาภิเษก พระบาทสมเด็จพระวชิรเกล้าเจ้าอยู่หัว" msgstr "HM King Maha Vajiralongkorn's Coronation Celebrations" -#: ./holidays/countries/thailand.py:145 +#: ./holidays/countries/thailand.py:144 msgid "ชดเชยวันสงกรานต์" msgstr "Songkran Festival (in lieu)" -#: ./holidays/countries/thailand.py:292 ./holidays/countries/thailand.py:316 -#: ./holidays/countries/thailand.py:368 ./holidays/countries/thailand.py:628 -#: ./holidays/countries/thailand.py:633 +#: ./holidays/countries/thailand.py:291 ./holidays/countries/thailand.py:315 +#: ./holidays/countries/thailand.py:367 ./holidays/countries/thailand.py:623 +#: ./holidays/countries/thailand.py:628 #, c-format msgid "ชดเชย%s" msgstr "%s (in lieu)" -#: ./holidays/countries/thailand.py:304 +#: ./holidays/countries/thailand.py:303 msgid "วันขึ้นปีใหม่" msgstr "New Year's Day" -#: ./holidays/countries/thailand.py:316 ./holidays/countries/thailand.py:572 +#: ./holidays/countries/thailand.py:315 ./holidays/countries/thailand.py:571 msgid "วันสิ้นปี" msgstr "New Year's Eve" -#: ./holidays/countries/thailand.py:330 +#: ./holidays/countries/thailand.py:329 msgid "วันจักรี" msgstr "Chakri Memorial Day" -#: ./holidays/countries/thailand.py:347 +#: ./holidays/countries/thailand.py:346 msgid "วันสงกรานต์" msgstr "Songkran Festival" -#: ./holidays/countries/thailand.py:391 +#: ./holidays/countries/thailand.py:390 msgid "วันแรงงานแห่งชาติ" msgstr "National Labour Day" -#: ./holidays/countries/thailand.py:402 +#: ./holidays/countries/thailand.py:401 msgid "วันชาติ" msgstr "National Day" -#: ./holidays/countries/thailand.py:412 +#: ./holidays/countries/thailand.py:411 msgid "วันฉัตรมงคล" msgstr "Coronation Day" -#: ./holidays/countries/thailand.py:427 +#: ./holidays/countries/thailand.py:426 msgid "" "วันเฉลิมพระชนมพรรษาสมเด็จพระนางเจ้าสุทิดา พัชรสุธาพิมลลักษณ พระบรมราชินี" msgstr "HM Queen Suthida's Birthday" -#: ./holidays/countries/thailand.py:444 +#: ./holidays/countries/thailand.py:443 msgid "" "วันเฉลิมพระชนมพรรษาพระบาทสมเด็จพระปรเมนทรรามาธิบดีศรีสินทรมหาวชิราลงกรณ " "พระวชิรเกล้าเจ้าอยู่หัว" msgstr "HM King Maha Vajiralongkorn's Birthday" -#: ./holidays/countries/thailand.py:466 +#: ./holidays/countries/thailand.py:465 msgid "วันเฉลิมพระชนมพรรษาสมเด็จพระนางเจ้าสิริกิติ์ พระบรมราชินีนาถ" msgstr "HM Queen Sirikit's Birthday" -#: ./holidays/countries/thailand.py:464 +#: ./holidays/countries/thailand.py:463 msgid "วันเฉลิมพระชนมพรรษาสมเด็จพระบรมราชชนนีพันปีหลวง" msgstr "HM Queen Sirikit The Queen Mother's Birthday" -#: ./holidays/countries/thailand.py:481 +#: ./holidays/countries/thailand.py:480 msgid "วันแม่แห่งชาติ" msgstr "National Mother's Day" -#: ./holidays/countries/thailand.py:501 +#: ./holidays/countries/thailand.py:500 msgid "วันคล้ายวันสวรรคตพระบาทสมเด็จพระปรมินทรมหาภูมิพลอดุลยเดช บรมนาถบพิตร" msgstr "HM King Bhumibol Adulyadej Memorial Day" -#: ./holidays/countries/thailand.py:496 +#: ./holidays/countries/thailand.py:495 msgid "" "วันคล้ายวันสวรรคตพระบาทสมเด็จพระบรมชนกาธิเบศร มหาภูมิพลอดุลยเดชมหาราช " "บรมนาถบพิตร" msgstr "HM King Bhumibol Adulyadej the Great Memorial Day" -#: ./holidays/countries/thailand.py:514 +#: ./holidays/countries/thailand.py:513 msgid "วันปิยมหาราช" msgstr "HM King Chulalongkorn Memorial Day" -#: ./holidays/countries/thailand.py:537 +#: ./holidays/countries/thailand.py:536 msgid "วันเฉลิมพระชนมพรรษาพระบาทสมเด็จพระปรมินทรมหาภูมิพลอดุลยเดช บรมนาถบพิตร" msgstr "HM King Bhumibol Adulyadej's Birthday" -#: ./holidays/countries/thailand.py:532 +#: ./holidays/countries/thailand.py:531 msgid "" "วันคล้ายวันเฉลิมพระชนมพรรษาพระบาทสมเด็จพระปรมินทรมหาภูมิพลอดุลยเดช " "บรมนาถบพิตร" msgstr "HM King Bhumibol Adulyadej's Birthday" -#: ./holidays/countries/thailand.py:526 +#: ./holidays/countries/thailand.py:525 msgid "" "วันคล้ายวันเฉลิมพระชนมพรรษาพระบาทสมเด็จพระบรมชนกาธิเบศร " "มหาภูมิพลอดุลยเดชมหาราช บรมนาถบพิตร" msgstr "HM King Bhumibol Adulyadej the Great's Birthday" -#: ./holidays/countries/thailand.py:553 +#: ./holidays/countries/thailand.py:552 msgid "วันพ่อแห่งชาติ" msgstr "National Father's Day" -#: ./holidays/countries/thailand.py:562 +#: ./holidays/countries/thailand.py:561 msgid "วันรัฐธรรมนูญ" msgstr "Constitution Day" -#: ./holidays/countries/thailand.py:586 +#: ./holidays/countries/thailand.py:581 msgid "วันมาฆบูชา" msgstr "Makha Bucha" -#: ./holidays/countries/thailand.py:594 +#: ./holidays/countries/thailand.py:589 msgid "วันวิสาขบูชา" msgstr "Visakha Bucha" -#: ./holidays/countries/thailand.py:603 ./holidays/countries/thailand.py:633 +#: ./holidays/countries/thailand.py:598 ./holidays/countries/thailand.py:628 msgid "วันอาสาฬหบูชา" msgstr "Asarnha Bucha" -#: ./holidays/countries/thailand.py:610 ./holidays/countries/thailand.py:628 +#: ./holidays/countries/thailand.py:605 ./holidays/countries/thailand.py:623 msgid "วันเข้าพรรษา" msgstr "Buddhist Lent Day" -#: ./holidays/countries/thailand.py:649 +#: ./holidays/countries/thailand.py:644 msgid "วันพืชมงคล" msgstr "Royal Ploughing Ceremony" diff --git a/holidays/locale/km/LC_MESSAGES/KH.po b/holidays/locale/km/LC_MESSAGES/KH.po index 87c6d3939..85f74278f 100644 --- a/holidays/locale/km/LC_MESSAGES/KH.po +++ b/holidays/locale/km/LC_MESSAGES/KH.po @@ -16,74 +16,74 @@ msgstr "" "X-Generator: Poedit 3.3.1\n" #. Khmer New Year's Replacement Holiday -#: ./holidays/countries/cambodia.py:59 +#: ./holidays/countries/cambodia.py:58 msgid "ថ្ងៃឈប់សម្រាកសងជំនួសឲ្យពិធីបុណ្យចូលឆ្នាំថ្មីប្រពៃណីជាតិ" msgstr "" #. Special Public Holiday -#: ./holidays/countries/cambodia.py:64 +#: ./holidays/countries/cambodia.py:63 msgid "ថ្ងៃឈប់សម្រាកសងជំនួស" msgstr "" #. International New Year Day. -#: ./holidays/countries/cambodia.py:102 +#: ./holidays/countries/cambodia.py:101 msgid "ទិវាចូលឆ្នាំសាកល" msgstr "" #. Day of Victory over the Genocidal Regime. -#: ./holidays/countries/cambodia.py:109 +#: ./holidays/countries/cambodia.py:108 msgid "ទិវាជ័យជម្នះលើរបបប្រល័យពូជសាសន៍" msgstr "" #. International Women's Rights Day -#: ./holidays/countries/cambodia.py:115 +#: ./holidays/countries/cambodia.py:114 msgid "ទិវាអន្តរជាតិនារី" msgstr "" #. Khmer New Year's Day -#: ./holidays/countries/cambodia.py:124 +#: ./holidays/countries/cambodia.py:123 msgid "ពិធីបុណ្យចូលឆ្នាំថ្មីប្រពៃណីជាតិ" msgstr "" #. International Labor Day -#: ./holidays/countries/cambodia.py:136 +#: ./holidays/countries/cambodia.py:135 msgid "ទិវាពលកម្មអន្តរជាតិ" msgstr "" #. Birthday of His Majesty Preah Bat Samdech Preah Boromneath NORODOM #. SIHAMONI, #. King of Cambodia -#: ./holidays/countries/cambodia.py:144 +#: ./holidays/countries/cambodia.py:143 msgid "" "ព្រះរាជពិធីបុណ្យចម្រើនព្រះជន្ម ព្រះករុណា ព្រះបាទសម្តេចព្រះបរមនាថ នរោត្តម " "សីហមុនី" msgstr "" #. National Day of Remembrance -#: ./holidays/countries/cambodia.py:164 +#: ./holidays/countries/cambodia.py:163 msgid "ទិវាជាតិនៃការចងចាំ" msgstr "" #. International Children Day -#: ./holidays/countries/cambodia.py:172 +#: ./holidays/countries/cambodia.py:171 msgid "ទិវាកុមារអន្តរជាតិ" msgstr "" #. Birthday of Her Majesty the Queen-Mother NORODOM MONINEATH SIHANOUK of #. Cambodia -#: ./holidays/countries/cambodia.py:183 +#: ./holidays/countries/cambodia.py:182 msgid "" "ព្រះរាជពិធីបុណ្យចម្រើនព្រះជន្ម សម្តេចព្រះមហាក្សត្រី ព្រះវររាជមាតា នរោត្តម " "មុនិនាថ​ សីហនុ" msgstr "" #. Constitution Day -#: ./holidays/countries/cambodia.py:196 +#: ./holidays/countries/cambodia.py:195 msgid "ទិវាប្រកាសរដ្ឋធម្មនុញ្ញ" msgstr "" #. Mourning Day of the Late King-Father NORODOM SIHANOUK of Cambodia -#: ./holidays/countries/cambodia.py:208 +#: ./holidays/countries/cambodia.py:207 msgid "" "ទិវាប្រារព្ឋពិធីគោរពព្រះវិញ្ញាណក្ខន្ឋ ព្រះករុណា ព្រះបាទសម្តេចព្រះ នរោត្តម " "សីហនុ ព្រះមហាវីរក្សត្រ ព្រះវររាជបិតាឯករាជ្យ បូរណភាពទឹកដី និងឯកភាពជាតិខ្មែរ " @@ -91,49 +91,49 @@ msgid "" msgstr "" #. Paris Peace Agreement's Day -#: ./holidays/countries/cambodia.py:225 +#: ./holidays/countries/cambodia.py:224 msgid "ទិវារំលឹកសន្ធិសញ្ញាសន្តិភាពទីក្រុងប៉ារីស" msgstr "" #. Coronation Day of His Majesty Preah Bat Samdech Preah Boromneath NORODOM #. SIHAMONI, King of Cambodia -#: ./holidays/countries/cambodia.py:240 +#: ./holidays/countries/cambodia.py:239 msgid "" "ព្រះរាជពិធីគ្រងព្រះបរមរាជសម្បត្តិ របស់ ព្រះករុណា ព្រះបាទសម្តេចព្រះបរមនាថ " "នរោត្តម សីហមុនី ព្រះមហាក្សត្រនៃព្រះរាជាណាចក្រកម្ពុជា" msgstr "" #. National Independence Day -#: ./holidays/countries/cambodia.py:254 +#: ./holidays/countries/cambodia.py:253 msgid "ពិធីបុណ្យឯករាជ្យជាតិ" msgstr "" #. International Human Rights Day -#: ./holidays/countries/cambodia.py:262 +#: ./holidays/countries/cambodia.py:261 msgid "ទិវាសិទ្ធិមនុស្សអន្តរជាតិ" msgstr "" #. Meak Bochea Day -#: ./holidays/countries/cambodia.py:280 +#: ./holidays/countries/cambodia.py:274 msgid "ពិធីបុណ្យមាឃបូជា" msgstr "" #. Visaka Bochea Day -#: ./holidays/countries/cambodia.py:289 +#: ./holidays/countries/cambodia.py:283 msgid "ពិធីបុណ្យវិសាខបូជា" msgstr "" #. Royal Ploughing Ceremony -#: ./holidays/countries/cambodia.py:297 +#: ./holidays/countries/cambodia.py:291 msgid "ព្រះរាជពិធីច្រត់ព្រះនង្គ័ល" msgstr "" #. Pchum Ben Day -#: ./holidays/countries/cambodia.py:305 +#: ./holidays/countries/cambodia.py:299 msgid "ពិធីបុណ្យភ្ផុំបិណ្ឌ" msgstr "" #. Water Festival -#: ./holidays/countries/cambodia.py:316 +#: ./holidays/countries/cambodia.py:310 msgid "ព្រះរាជពិធីបុណ្យអុំទូក បណ្តែតប្រទីប និងសំពះព្រះខែអកអំបុក" msgstr "" diff --git a/holidays/locale/th/LC_MESSAGES/KH.po b/holidays/locale/th/LC_MESSAGES/KH.po index 224fbe4fb..4540d4da5 100644 --- a/holidays/locale/th/LC_MESSAGES/KH.po +++ b/holidays/locale/th/LC_MESSAGES/KH.po @@ -16,44 +16,44 @@ msgstr "" "X-Generator: Poedit 3.3.1\n" #. Khmer New Year's Replacement Holiday -#: ./holidays/countries/cambodia.py:59 +#: ./holidays/countries/cambodia.py:58 msgid "ថ្ងៃឈប់សម្រាកសងជំនួសឲ្យពិធីបុណ្យចូលឆ្នាំថ្មីប្រពៃណីជាតិ" msgstr "วันหยุดชดเชยเทศกาลขึ้นปีใหม่ประเพณี" #. Special Public Holiday -#: ./holidays/countries/cambodia.py:64 +#: ./holidays/countries/cambodia.py:63 msgid "ថ្ងៃឈប់សម្រាកសងជំនួស" msgstr "วันหยุดชดเชย" #. International New Year Day. -#: ./holidays/countries/cambodia.py:102 +#: ./holidays/countries/cambodia.py:101 msgid "ទិវាចូលឆ្នាំសាកល" msgstr "วันปีใหม่สากล" #. Day of Victory over the Genocidal Regime. -#: ./holidays/countries/cambodia.py:109 +#: ./holidays/countries/cambodia.py:108 msgid "ទិវាជ័យជម្នះលើរបបប្រល័យពូជសាសន៍" msgstr "วันชัยชนะเหนือระบอบฆ่าล้างเผ่าพันธุ์เขมรแดง" #. International Women's Rights Day -#: ./holidays/countries/cambodia.py:115 +#: ./holidays/countries/cambodia.py:114 msgid "ទិវាអន្តរជាតិនារី" msgstr "วันสตรีสากล" #. Khmer New Year's Day -#: ./holidays/countries/cambodia.py:124 +#: ./holidays/countries/cambodia.py:123 msgid "ពិធីបុណ្យចូលឆ្នាំថ្មីប្រពៃណីជាតិ" msgstr "เทศกาลขึ้นปีใหม่ประเพณี" #. International Labor Day -#: ./holidays/countries/cambodia.py:136 +#: ./holidays/countries/cambodia.py:135 msgid "ទិវាពលកម្មអន្តរជាតិ" msgstr "วันแรงงานสากล" #. Birthday of His Majesty Preah Bat Samdech Preah Boromneath NORODOM #. SIHAMONI, #. King of Cambodia -#: ./holidays/countries/cambodia.py:144 +#: ./holidays/countries/cambodia.py:143 msgid "" "ព្រះរាជពិធីបុណ្យចម្រើនព្រះជន្ម ព្រះករុណា ព្រះបាទសម្តេចព្រះបរមនាថ នរោត្តម " "សីហមុនី" @@ -62,30 +62,30 @@ msgstr "" "พระมหากษัตริย์แห่งราชอาณาจักรกัมพูชา" #. National Day of Remembrance -#: ./holidays/countries/cambodia.py:164 +#: ./holidays/countries/cambodia.py:163 msgid "ទិវាជាតិនៃការចងចាំ" msgstr "วันแห่งความทรงจำ" #. International Children Day -#: ./holidays/countries/cambodia.py:172 +#: ./holidays/countries/cambodia.py:171 msgid "ទិវាកុមារអន្តរជាតិ" msgstr "วันเด็กสากล" #. Birthday of Her Majesty the Queen-Mother NORODOM MONINEATH SIHANOUK of #. Cambodia -#: ./holidays/countries/cambodia.py:183 +#: ./holidays/countries/cambodia.py:182 msgid "" "ព្រះរាជពិធីបុណ្យចម្រើនព្រះជន្ម សម្តេចព្រះមហាក្សត្រី ព្រះវររាជមាតា នរោត្តម " "មុនិនាថ​ សីហនុ" msgstr "พระราชพิธีเฉลิมพระชนมพรรษา สมเด็จพระบรมราชินี นโรดม มนีนาถ สีหนุ" #. Constitution Day -#: ./holidays/countries/cambodia.py:196 +#: ./holidays/countries/cambodia.py:195 msgid "ទិវាប្រកាសរដ្ឋធម្មនុញ្ញ" msgstr "วันรัฐธรรมนูญ" #. Mourning Day of the Late King-Father NORODOM SIHANOUK of Cambodia -#: ./holidays/countries/cambodia.py:208 +#: ./holidays/countries/cambodia.py:207 msgid "" "ទិវាប្រារព្ឋពិធីគោរពព្រះវិញ្ញាណក្ខន្ឋ ព្រះករុណា ព្រះបាទសម្តេចព្រះ នរោត្តម " "សីហនុ ព្រះមហាវីរក្សត្រ ព្រះវររាជបិតាឯករាជ្យ បូរណភាពទឹកដី និងឯកភាពជាតិខ្មែរ " @@ -95,13 +95,13 @@ msgstr "" " และเอกภาพของชาติกัมพูชา" #. Paris Peace Agreement's Day -#: ./holidays/countries/cambodia.py:225 +#: ./holidays/countries/cambodia.py:224 msgid "ទិវារំលឹកសន្ធិសញ្ញាសន្តិភាពទីក្រុងប៉ារីស" msgstr "วันรำลึกข้อตกลงสันติภาพกรุงปารีส" #. Coronation Day of His Majesty Preah Bat Samdech Preah Boromneath NORODOM #. SIHAMONI, King of Cambodia -#: ./holidays/countries/cambodia.py:240 +#: ./holidays/countries/cambodia.py:239 msgid "" "ព្រះរាជពិធីគ្រងព្រះបរមរាជសម្បត្តិ របស់ ព្រះករុណា ព្រះបាទសម្តេចព្រះបរមនាថ " "នរោត្តម សីហមុនី ព្រះមហាក្សត្រនៃព្រះរាជាណាចក្រកម្ពុជា" @@ -110,36 +110,36 @@ msgstr "" "พระมหากษัตริย์แห่งราชอาณาจักรกัมพูชา" #. National Independence Day -#: ./holidays/countries/cambodia.py:254 +#: ./holidays/countries/cambodia.py:253 msgid "ពិធីបុណ្យឯករាជ្យជាតិ" msgstr "วันประกาศเอกราชจากฝรั่งเศส" #. International Human Rights Day -#: ./holidays/countries/cambodia.py:262 +#: ./holidays/countries/cambodia.py:261 msgid "ទិវាសិទ្ធិមនុស្សអន្តរជាតិ" msgstr "วันสิทธิมนุษยชนโลก" #. Meak Bochea Day -#: ./holidays/countries/cambodia.py:280 +#: ./holidays/countries/cambodia.py:274 msgid "ពិធីបុណ្យមាឃបូជា" msgstr "วันมาฆบูชา" #. Visaka Bochea Day -#: ./holidays/countries/cambodia.py:289 +#: ./holidays/countries/cambodia.py:283 msgid "ពិធីបុណ្យវិសាខបូជា" msgstr "วันวิสาขบูชา" #. Royal Ploughing Ceremony -#: ./holidays/countries/cambodia.py:297 +#: ./holidays/countries/cambodia.py:291 msgid "ព្រះរាជពិធីច្រត់ព្រះនង្គ័ល" msgstr "พระราชพิธีบุญจรดพระนังคัลแรกนาขวัญ" #. Pchum Ben Day -#: ./holidays/countries/cambodia.py:305 +#: ./holidays/countries/cambodia.py:299 msgid "ពិធីបុណ្យភ្ផុំបិណ្ឌ" msgstr "เทศกาลงานวันสาร์ทภจุมบิณฑ์เขมร" #. Water Festival -#: ./holidays/countries/cambodia.py:316 +#: ./holidays/countries/cambodia.py:310 msgid "ព្រះរាជពិធីបុណ្យអុំទូក បណ្តែតប្រទីប និងសំពះព្រះខែអកអំបុក" msgstr "พระราชพิธีบุญแข่งเรือลอยกระทงไฟไหว้พระจันทร์และกินข้าวเม่า" diff --git a/holidays/locale/th/LC_MESSAGES/TH.po b/holidays/locale/th/LC_MESSAGES/TH.po index d57f0e696..81bff4493 100644 --- a/holidays/locale/th/LC_MESSAGES/TH.po +++ b/holidays/locale/th/LC_MESSAGES/TH.po @@ -14,171 +14,171 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "X-Generator: Poedit 3.2.2\n" -#: ./holidays/countries/thailand.py:119 +#: ./holidays/countries/thailand.py:118 msgid "วันหยุดชดเชย" msgstr "" -#: ./holidays/countries/thailand.py:120 +#: ./holidays/countries/thailand.py:119 msgid "วันเลือกตั้ง" msgstr "" -#: ./holidays/countries/thailand.py:292 ./holidays/countries/thailand.py:316 -#: ./holidays/countries/thailand.py:368 ./holidays/countries/thailand.py:628 -#: ./holidays/countries/thailand.py:633 +#: ./holidays/countries/thailand.py:291 ./holidays/countries/thailand.py:315 +#: ./holidays/countries/thailand.py:367 ./holidays/countries/thailand.py:623 +#: ./holidays/countries/thailand.py:628 #, c-format msgid "ชดเชย%s" msgstr "" -#: ./holidays/countries/thailand.py:122 +#: ./holidays/countries/thailand.py:121 msgid "วันหยุดพิเศษ (เพิ่มเติม)" msgstr "" -#: ./holidays/countries/thailand.py:126 +#: ./holidays/countries/thailand.py:125 msgid "พระราชพิธีกาญจนาภิเษก พ.ศ. 2539" msgstr "" -#: ./holidays/countries/thailand.py:127 +#: ./holidays/countries/thailand.py:126 msgid "พระราชพิธีฉลองสิริราชสมบัติครบ 60 ปี พ.ศ. 2549" msgstr "" -#: ./holidays/countries/thailand.py:130 +#: ./holidays/countries/thailand.py:129 msgid "วันหยุดพิเศษ (คมช.)" msgstr "" -#: ./holidays/countries/thailand.py:131 +#: ./holidays/countries/thailand.py:130 msgid "วันหยุดพิเศษ (การเมือง)" msgstr "" -#: ./holidays/countries/thailand.py:132 +#: ./holidays/countries/thailand.py:131 msgid "วันหยุดพิเศษ (มหาอุทกภัย พ.ศ. 2554)" msgstr "" -#: ./holidays/countries/thailand.py:135 +#: ./holidays/countries/thailand.py:134 msgid "วันหยุดพิเศษ (ร่วมถวายอาลัย ส่งดวงพระวิญญาณพระบรมศพ)" msgstr "" -#: ./holidays/countries/thailand.py:138 +#: ./holidays/countries/thailand.py:137 msgid "" "วันพระราชพิธีถวายพระเพลิงพระบรมศพพระบาทสมเด็จพระปรมินทรมหาภูมิพลอดุลยเดช" msgstr "" -#: ./holidays/countries/thailand.py:142 +#: ./holidays/countries/thailand.py:141 msgid "พระราชพิธีบรมราชาภิเษก พระบาทสมเด็จพระวชิรเกล้าเจ้าอยู่หัว" msgstr "" -#: ./holidays/countries/thailand.py:347 +#: ./holidays/countries/thailand.py:346 msgid "วันสงกรานต์" msgstr "" -#: ./holidays/countries/thailand.py:304 +#: ./holidays/countries/thailand.py:303 msgid "วันขึ้นปีใหม่" msgstr "" -#: ./holidays/countries/thailand.py:316 ./holidays/countries/thailand.py:572 +#: ./holidays/countries/thailand.py:315 ./holidays/countries/thailand.py:571 msgid "วันสิ้นปี" msgstr "" -#: ./holidays/countries/thailand.py:330 +#: ./holidays/countries/thailand.py:329 msgid "วันจักรี" msgstr "" -#: ./holidays/countries/thailand.py:391 +#: ./holidays/countries/thailand.py:390 msgid "วันแรงงานแห่งชาติ" msgstr "" -#: ./holidays/countries/thailand.py:402 +#: ./holidays/countries/thailand.py:401 msgid "วันชาติ" msgstr "" -#: ./holidays/countries/thailand.py:412 +#: ./holidays/countries/thailand.py:411 msgid "วันฉัตรมงคล" msgstr "" -#: ./holidays/countries/thailand.py:427 +#: ./holidays/countries/thailand.py:426 msgid "" "วันเฉลิมพระชนมพรรษาสมเด็จพระนางเจ้าสุทิดา พัชรสุธาพิมลลักษณ พระบรมราชินี" msgstr "" -#: ./holidays/countries/thailand.py:444 +#: ./holidays/countries/thailand.py:443 msgid "" "วันเฉลิมพระชนมพรรษาพระบาทสมเด็จพระปรเมนทรรามาธิบดีศรีสินทรมหาวชิราลงกรณ " "พระวชิรเกล้าเจ้าอยู่หัว" msgstr "" -#: ./holidays/countries/thailand.py:466 +#: ./holidays/countries/thailand.py:465 msgid "วันเฉลิมพระชนมพรรษาสมเด็จพระนางเจ้าสิริกิติ์ พระบรมราชินีนาถ" msgstr "" -#: ./holidays/countries/thailand.py:464 +#: ./holidays/countries/thailand.py:463 msgid "วันเฉลิมพระชนมพรรษาสมเด็จพระบรมราชชนนีพันปีหลวง" msgstr "" -#: ./holidays/countries/thailand.py:481 +#: ./holidays/countries/thailand.py:480 msgid "วันแม่แห่งชาติ" msgstr "" -#: ./holidays/countries/thailand.py:501 +#: ./holidays/countries/thailand.py:500 msgid "วันคล้ายวันสวรรคตพระบาทสมเด็จพระปรมินทรมหาภูมิพลอดุลยเดช บรมนาถบพิตร" msgstr "" -#: ./holidays/countries/thailand.py:496 +#: ./holidays/countries/thailand.py:495 msgid "" "วันคล้ายวันสวรรคตพระบาทสมเด็จพระบรมชนกาธิเบศร มหาภูมิพลอดุลยเดชมหาราช " "บรมนาถบพิตร" msgstr "" -#: ./holidays/countries/thailand.py:514 +#: ./holidays/countries/thailand.py:513 msgid "วันปิยมหาราช" msgstr "" -#: ./holidays/countries/thailand.py:537 +#: ./holidays/countries/thailand.py:536 msgid "วันเฉลิมพระชนมพรรษาพระบาทสมเด็จพระปรมินทรมหาภูมิพลอดุลยเดช บรมนาถบพิตร" msgstr "" -#: ./holidays/countries/thailand.py:532 +#: ./holidays/countries/thailand.py:531 msgid "" "วันคล้ายวันเฉลิมพระชนมพรรษาพระบาทสมเด็จพระปรมินทรมหาภูมิพลอดุลยเดช " "บรมนาถบพิตร" msgstr "" -#: ./holidays/countries/thailand.py:526 +#: ./holidays/countries/thailand.py:525 msgid "" "วันคล้ายวันเฉลิมพระชนมพรรษาพระบาทสมเด็จพระบรมชนกาธิเบศร " "มหาภูมิพลอดุลยเดชมหาราช บรมนาถบพิตร" msgstr "" -#: ./holidays/countries/thailand.py:553 +#: ./holidays/countries/thailand.py:552 msgid "วันพ่อแห่งชาติ" msgstr "" -#: ./holidays/countries/thailand.py:562 +#: ./holidays/countries/thailand.py:561 msgid "วันรัฐธรรมนูญ" msgstr "" -#: ./holidays/countries/thailand.py:586 +#: ./holidays/countries/thailand.py:581 msgid "วันมาฆบูชา" msgstr "" -#: ./holidays/countries/thailand.py:594 +#: ./holidays/countries/thailand.py:589 msgid "วันวิสาขบูชา" msgstr "" -#: ./holidays/countries/thailand.py:603 ./holidays/countries/thailand.py:633 +#: ./holidays/countries/thailand.py:598 ./holidays/countries/thailand.py:628 msgid "วันอาสาฬหบูชา" msgstr "" -#: ./holidays/countries/thailand.py:610 ./holidays/countries/thailand.py:628 +#: ./holidays/countries/thailand.py:605 ./holidays/countries/thailand.py:623 msgid "วันเข้าพรรษา" msgstr "" -#: ./holidays/countries/thailand.py:649 +#: ./holidays/countries/thailand.py:644 msgid "วันพืชมงคล" msgstr "" -#: ./holidays/countries/thailand.py:121 +#: ./holidays/countries/thailand.py:120 msgid "ชดเชยวันเลือกตั้ง" msgstr "" -#: ./holidays/countries/thailand.py:145 +#: ./holidays/countries/thailand.py:144 msgid "ชดเชยวันสงกรานต์" msgstr ""