From f483f24d1eb1833a9e5279d9eb5a7ae5ead3a9ba Mon Sep 17 00:00:00 2001 From: PPsyrius <19505219+PPsyrius@users.noreply.github.com> Date: Fri, 31 Jan 2025 15:59:15 +0700 Subject: [PATCH 1/5] Update United Kingdom & Isle of Man holidays: add l10n support --- README.rst | 4 +- holidays/countries/isle_of_man.py | 25 +++-- holidays/countries/united_kingdom.py | 128 +++++++++++++----------- holidays/locale/en_GB/LC_MESSAGES/GB.po | 124 +++++++++++++++++++++++ holidays/locale/en_GB/LC_MESSAGES/IM.po | 112 +++++++++++++++++++++ holidays/locale/en_US/LC_MESSAGES/GB.po | 124 +++++++++++++++++++++++ holidays/locale/en_US/LC_MESSAGES/IM.po | 112 +++++++++++++++++++++ holidays/locale/th/LC_MESSAGES/GB.po | 126 +++++++++++++++++++++++ holidays/locale/th/LC_MESSAGES/IM.po | 114 +++++++++++++++++++++ tests/countries/test_isle_of_man.py | 45 +++++++++ tests/countries/test_united_kingdom.py | 60 +++++++++++ 11 files changed, 905 insertions(+), 69 deletions(-) create mode 100644 holidays/locale/en_GB/LC_MESSAGES/GB.po create mode 100644 holidays/locale/en_GB/LC_MESSAGES/IM.po create mode 100644 holidays/locale/en_US/LC_MESSAGES/GB.po create mode 100644 holidays/locale/en_US/LC_MESSAGES/IM.po create mode 100644 holidays/locale/th/LC_MESSAGES/GB.po create mode 100644 holidays/locale/th/LC_MESSAGES/IM.po diff --git a/README.rst b/README.rst index f0a82befa..dea3b93e7 100644 --- a/README.rst +++ b/README.rst @@ -538,7 +538,7 @@ All other default values are highlighted with bold: * - Isle of Man - IM - - - + - **en_GB**, en_US, th - * - Israel - IL @@ -903,7 +903,7 @@ All other default values are highlighted with bold: * - United Kingdom - GB - Subdivisions: ENG (England), NIR (Northern Ireland), SCT (Scotland), WLS (Wales) - - + - **en_GB**, en_US, th - * - United States Minor Outlying Islands - UM diff --git a/holidays/countries/isle_of_man.py b/holidays/countries/isle_of_man.py index 2828deaa6..35f7cafb6 100644 --- a/holidays/countries/isle_of_man.py +++ b/holidays/countries/isle_of_man.py @@ -10,6 +10,8 @@ # Website: https://github.com/vacanza/holidays # License: MIT (see LICENSE file) +from gettext import gettext as tr + from holidays.countries.united_kingdom import UnitedKingdom, UnitedKingdomStaticHolidays from holidays.groups import ChristianHolidays, InternationalHolidays, StaticHolidays from holidays.observed_holiday_base import ObservedHolidayBase, SAT_SUN_TO_NEXT_MON @@ -31,25 +33,26 @@ def __init__(self, *args, **kwargs): # Override UnitedKingdom __init__(). def _populate_public_holidays(self) -> None: super()._populate_public_holidays() - # Easter Monday - self._add_easter_monday("Easter Monday") + # Easter Monday. + self._add_easter_monday(tr("Easter Monday")) - # Whit Monday. if self._year <= 1970: - self._add_whit_monday("Whit Monday") + # Whit Monday. + self._add_whit_monday(tr("Whit Monday")) - # Late Summer bank holiday (last Monday in August) if self._year >= 1971: - self._add_holiday_last_mon_of_aug("Late Summer Bank Holiday") + # Late Summer Bank Holiday. + self._add_holiday_last_mon_of_aug(tr("Late Summer Bank Holiday")) # Isle of Man exclusive holidays - # TT bank holiday (first Friday in June) - self._add_holiday_1st_fri_of_jun("TT Bank Holiday") - # Tynwald Day - # Move to the next Monday if falls on a weekend. - jul_5 = self._add_holiday_jul_5("Tynwald Day") + # TT Bank Holiday. + self._add_holiday_1st_fri_of_jun(tr("TT Bank Holiday")) + + # Tynwald Day. + jul_5 = self._add_holiday_jul_5(tr("Tynwald Day")) if self._year >= 1992: + # Move to the next Monday if falls on a weekend. self._move_holiday(jul_5, show_observed_label=False) diff --git a/holidays/countries/united_kingdom.py b/holidays/countries/united_kingdom.py index f2c0b8c6b..b87ea8984 100644 --- a/holidays/countries/united_kingdom.py +++ b/holidays/countries/united_kingdom.py @@ -10,6 +10,7 @@ # Website: https://github.com/vacanza/holidays # License: MIT (see LICENSE file) +from gettext import gettext as tr from typing import Union from holidays.calendars.gregorian import APR, MAY, JUN, JUL, SEP, DEC @@ -37,7 +38,9 @@ class UnitedKingdom(ObservedHolidayBase, ChristianHolidays, InternationalHoliday """ country = "GB" - observed_label = "%s (observed)" + default_language = "en_GB" + # %s (observed). + observed_label = tr("%s (observed)") subdivisions: Union[tuple[()], tuple[str, ...]] = ( "ENG", # England "NIR", # Northern Ireland @@ -50,6 +53,7 @@ class UnitedKingdom(ObservedHolidayBase, ChristianHolidays, InternationalHoliday "Scotland": "SCT", "Wales": "WLS", } + supported_languages = ("en_GB", "en_US", "th") _deprecated_subdivisions = ("UK",) # Bank Holidays Act 1871 start_year = 1872 @@ -64,25 +68,25 @@ def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) def _populate_public_holidays(self) -> None: - # Good Friday - self._add_good_friday("Good Friday") + # Good Friday. + self._add_good_friday(tr("Good Friday")) - # May Day bank holiday (first Monday in May) if self._year >= 1978: - name = "May Day" + # May Day. + name = tr("May Day") if self._year in {1995, 2020}: self._add_holiday_may_8(name) else: self._add_holiday_1st_mon_of_may(name) - # Spring bank holiday (last Monday in May) if self._year >= 1971: spring_bank_dates = { 2002: (JUN, 4), 2012: (JUN, 4), 2022: (JUN, 2), } - name = "Spring Bank Holiday" + # Spring Bank Holiday. + name = tr("Spring Bank Holiday") if self._year in spring_bank_dates: self._add_holiday(name, spring_bank_dates[self._year]) else: @@ -90,94 +94,97 @@ def _populate_public_holidays(self) -> None: def _populate_subdiv_holidays(self): if self.subdiv != "SCT": - # New Year's Day if self._year >= 1975: - self._add_observed(self._add_new_years_day("New Year's Day")) + # New Year's Day. + self._add_observed(self._add_new_years_day(tr("New Year's Day"))) - # Christmas Day self._add_observed( - self._add_christmas_day("Christmas Day"), rule=SAT_SUN_TO_NEXT_MON_TUE + # Christmas Day. + self._add_christmas_day(tr("Christmas Day")), + rule=SAT_SUN_TO_NEXT_MON_TUE, ) - # Boxing Day self._add_observed( - self._add_christmas_day_two("Boxing Day"), rule=SAT_SUN_TO_NEXT_MON_TUE + # Boxing Day. + self._add_christmas_day_two(tr("Boxing Day")), + rule=SAT_SUN_TO_NEXT_MON_TUE, ) super()._populate_subdiv_holidays() def _populate_subdiv_eng_public_holidays(self): - # Easter Monday - self._add_easter_monday("Easter Monday") + # Easter Monday. + self._add_easter_monday(tr("Easter Monday")) - # Whit Monday. if self._year <= 1970: - self._add_whit_monday("Whit Monday") + # Whit Monday. + self._add_whit_monday(tr("Whit Monday")) - # Late Summer bank holiday (last Monday in August) if self._year >= 1971: - self._add_holiday_last_mon_of_aug("Late Summer Bank Holiday") + # Late Summer Bank Holiday. + self._add_holiday_last_mon_of_aug(tr("Late Summer Bank Holiday")) def _populate_subdiv_nir_public_holidays(self): if self._year >= 1903: - # Saint Patrick's Day - self._add_observed(self._add_holiday_mar_17("Saint Patrick's Day")) + # Saint Patrick's Day. + self._add_observed(self._add_holiday_mar_17(tr("Saint Patrick's Day"))) - # Easter Monday - self._add_easter_monday("Easter Monday") + # Easter Monday. + self._add_easter_monday(tr("Easter Monday")) - # Whit Monday. if self._year <= 1970: - self._add_whit_monday("Whit Monday") + # Whit Monday. + self._add_whit_monday(tr("Whit Monday")) - # Battle of the Boyne - self._add_observed(self._add_holiday_jul_12("Battle of the Boyne")) + # Battle of the Boyne. + self._add_observed(self._add_holiday_jul_12(tr("Battle of the Boyne"))) - # Late Summer bank holiday (last Monday in August) if self._year >= 1971: - self._add_holiday_last_mon_of_aug("Late Summer Bank Holiday") + # Late Summer Bank Holiday. + self._add_holiday_last_mon_of_aug(tr("Late Summer Bank Holiday")) def _populate_subdiv_sct_public_holidays(self): - # New Year's Day - jan_1 = self._add_new_years_day("New Year's Day") + # New Year's Day. + jan_1 = self._add_new_years_day(tr("New Year's Day")) - # New Year Holiday self._add_observed( - self._add_new_years_day_two("New Year Holiday"), + # New Year Holiday. + self._add_new_years_day_two(tr("New Year Holiday")), rule=SAT_SUN_TO_NEXT_MON_TUE + MON_TO_NEXT_TUE, ) self._add_observed(jan_1) - # Summer bank holiday (first Monday in August) - self._add_holiday_1st_mon_of_aug("Summer Bank Holiday") + # Summer Bank Holiday. + self._add_holiday_1st_mon_of_aug(tr("Summer Bank Holiday")) if self._year >= 2006: - # Saint Andrew's Day - self._add_observed(self._add_holiday_nov_30("Saint Andrew's Day")) + # Saint Andrew's Day. + self._add_observed(self._add_holiday_nov_30(tr("Saint Andrew's Day"))) - # Christmas Day self._add_observed( - self._add_christmas_day("Christmas Day"), + # Christmas Day. + self._add_christmas_day(tr("Christmas Day")), rule=SAT_SUN_TO_NEXT_MON_TUE if self._year >= 1974 else SAT_SUN_TO_NEXT_MON, ) if self._year >= 1974: - # Boxing Day self._add_observed( - self._add_christmas_day_two("Boxing Day"), rule=SAT_SUN_TO_NEXT_MON_TUE + # Boxing Day. + self._add_christmas_day_two(tr("Boxing Day")), + rule=SAT_SUN_TO_NEXT_MON_TUE, ) def _populate_subdiv_wls_public_holidays(self): - # Easter Monday - self._add_easter_monday("Easter Monday") + # Easter Monday. + self._add_easter_monday(tr("Easter Monday")) - # Whit Monday. if self._year <= 1970: - self._add_whit_monday("Whit Monday") + # Whit Monday. + self._add_whit_monday(tr("Whit Monday")) - # Late Summer bank holiday (last Monday in August) if self._year >= 1971: - self._add_holiday_last_mon_of_aug("Late Summer Bank Holiday") + # Late Summer Bank Holiday. + self._add_holiday_last_mon_of_aug(tr("Late Summer Bank Holiday")) class UK(UnitedKingdom): @@ -194,15 +201,24 @@ class GBR(UnitedKingdom): class UnitedKingdomStaticHolidays: special_public_holidays = { - 1977: (JUN, 7, "Silver Jubilee of Elizabeth II"), - 1981: (JUL, 29, "Wedding of Charles and Diana"), - 1999: (DEC, 31, "Millennium Celebrations"), - 2002: (JUN, 3, "Golden Jubilee of Elizabeth II"), - 2011: (APR, 29, "Wedding of William and Catherine"), - 2012: (JUN, 5, "Diamond Jubilee of Elizabeth II"), + # Silver Jubilee of Elizabeth II. + 1977: (JUN, 7, tr("Silver Jubilee of Elizabeth II")), + # Wedding of Charles and Diana. + 1981: (JUL, 29, tr("Wedding of Charles and Diana")), + # Millennium Celebrations. + 1999: (DEC, 31, tr("Millennium Celebrations")), + # Golden Jubilee of Elizabeth II. + 2002: (JUN, 3, tr("Golden Jubilee of Elizabeth II")), + # Wedding of William and Catherine. + 2011: (APR, 29, tr("Wedding of William and Catherine")), + # Diamond Jubilee of Elizabeth II. + 2012: (JUN, 5, tr("Diamond Jubilee of Elizabeth II")), 2022: ( - (JUN, 3, "Platinum Jubilee of Elizabeth II"), - (SEP, 19, "State Funeral of Queen Elizabeth II"), + # Platinum Jubilee of Elizabeth II. + (JUN, 3, tr("Platinum Jubilee of Elizabeth II")), + # State Funeral of Queen Elizabeth II. + (SEP, 19, tr("State Funeral of Queen Elizabeth II")), ), - 2023: (MAY, 8, "Coronation of Charles III"), + # Coronation of Charles III. + 2023: (MAY, 8, tr("Coronation of Charles III")), } diff --git a/holidays/locale/en_GB/LC_MESSAGES/GB.po b/holidays/locale/en_GB/LC_MESSAGES/GB.po new file mode 100644 index 000000000..f51aacec9 --- /dev/null +++ b/holidays/locale/en_GB/LC_MESSAGES/GB.po @@ -0,0 +1,124 @@ +# holidays +# -------- +# A fast, efficient Python library for generating country, province and state +# specific sets of holidays on the fly. It aims to make determining whether a +# specific date is a holiday as fast and flexible as possible. +# +# Authors: Vacanza Team and individual contributors (see AUTHORS file) +# dr-prodigy (c) 2017-2023 +# ryanss (c) 2014-2017 +# Website: https://github.com/vacanza/holidays +# License: MIT (see LICENSE file) +# +# United Kingdom holidays. +# +msgid "" +msgstr "" +"Project-Id-Version: Holidays 0.66\n" +"POT-Creation-Date: 2025-01-29 14:18+0700\n" +"PO-Revision-Date: 2025-01-31 13:54+0700\n" +"Last-Translator: PPsyrius \n" +"Language-Team: Holidays Localization Team\n" +"Language: en_GB\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Lingva 5.0.3\n" +"X-Generator: Poedit 3.5\n" + +#. %s (observed). +#, c-format +msgid "%s (observed)" +msgstr "" + +#. Good Friday. +msgid "Good Friday" +msgstr "" + +#. May Day. +msgid "May Day" +msgstr "" + +#. Spring Bank Holiday. +msgid "Spring Bank Holiday" +msgstr "" + +#. New Year's Day. +msgid "New Year's Day" +msgstr "" + +#. Christmas Day. +msgid "Christmas Day" +msgstr "" + +#. Boxing Day. +msgid "Boxing Day" +msgstr "" + +#. Easter Monday. +msgid "Easter Monday" +msgstr "" + +#. Whit Monday. +msgid "Whit Monday" +msgstr "" + +#. Late Summer Bank Holiday. +msgid "Late Summer Bank Holiday" +msgstr "" + +#. Saint Patrick's Day. +msgid "Saint Patrick's Day" +msgstr "" + +#. Battle of the Boyne. +msgid "Battle of the Boyne" +msgstr "" + +#. New Year Holiday. +msgid "New Year Holiday" +msgstr "" + +#. Summer Bank Holiday. +msgid "Summer Bank Holiday" +msgstr "" + +#. Saint Andrew's Day. +msgid "Saint Andrew's Day" +msgstr "" + +#. Silver Jubilee of Elizabeth II. +msgid "Silver Jubilee of Elizabeth II" +msgstr "" + +#. Wedding of Charles and Diana. +msgid "Wedding of Charles and Diana" +msgstr "" + +#. Millennium Celebrations. +msgid "Millennium Celebrations" +msgstr "" + +#. Golden Jubilee of Elizabeth II. +msgid "Golden Jubilee of Elizabeth II" +msgstr "" + +#. Wedding of William and Catherine. +msgid "Wedding of William and Catherine" +msgstr "" + +#. Diamond Jubilee of Elizabeth II. +msgid "Diamond Jubilee of Elizabeth II" +msgstr "" + +#. Platinum Jubilee of Elizabeth II. +msgid "Platinum Jubilee of Elizabeth II" +msgstr "" + +#. State Funeral of Queen Elizabeth II. +msgid "State Funeral of Queen Elizabeth II" +msgstr "" + +#. Coronation of Charles III. +msgid "Coronation of Charles III" +msgstr "" diff --git a/holidays/locale/en_GB/LC_MESSAGES/IM.po b/holidays/locale/en_GB/LC_MESSAGES/IM.po new file mode 100644 index 000000000..97ec728d5 --- /dev/null +++ b/holidays/locale/en_GB/LC_MESSAGES/IM.po @@ -0,0 +1,112 @@ +# holidays +# -------- +# A fast, efficient Python library for generating country, province and state +# specific sets of holidays on the fly. It aims to make determining whether a +# specific date is a holiday as fast and flexible as possible. +# +# Authors: Vacanza Team and individual contributors (see AUTHORS file) +# dr-prodigy (c) 2017-2023 +# ryanss (c) 2014-2017 +# Website: https://github.com/vacanza/holidays +# License: MIT (see LICENSE file) +# +# Isle of Man holidays. +# +msgid "" +msgstr "" +"Project-Id-Version: Holidays 0.66\n" +"POT-Creation-Date: 2025-01-31 13:46+0700\n" +"PO-Revision-Date: 2025-01-31 13:54+0700\n" +"Last-Translator: PPsyrius \n" +"Language-Team: Holidays Localization Team\n" +"Language: en_GB\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Lingva 5.0.3\n" +"X-Generator: Poedit 3.5\n" + +#. %s (observed). +#, c-format +msgid "%s (observed)" +msgstr "" + +#. Good Friday. +msgid "Good Friday" +msgstr "" + +#. May Day. +msgid "May Day" +msgstr "" + +#. Spring Bank Holiday. +msgid "Spring Bank Holiday" +msgstr "" + +#. New Year's Day. +msgid "New Year's Day" +msgstr "" + +#. Christmas Day. +msgid "Christmas Day" +msgstr "" + +#. Boxing Day. +msgid "Boxing Day" +msgstr "" + +#. Easter Monday. +msgid "Easter Monday" +msgstr "" + +#. Whit Monday. +msgid "Whit Monday" +msgstr "" + +#. Late Summer Bank Holiday. +msgid "Late Summer Bank Holiday" +msgstr "" + +#. Silver Jubilee of Elizabeth II. +msgid "Silver Jubilee of Elizabeth II" +msgstr "" + +#. Wedding of Charles and Diana. +msgid "Wedding of Charles and Diana" +msgstr "" + +#. Millennium Celebrations. +msgid "Millennium Celebrations" +msgstr "" + +#. Golden Jubilee of Elizabeth II. +msgid "Golden Jubilee of Elizabeth II" +msgstr "" + +#. Wedding of William and Catherine. +msgid "Wedding of William and Catherine" +msgstr "" + +#. Diamond Jubilee of Elizabeth II. +msgid "Diamond Jubilee of Elizabeth II" +msgstr "" + +#. Platinum Jubilee of Elizabeth II. +msgid "Platinum Jubilee of Elizabeth II" +msgstr "" + +#. State Funeral of Queen Elizabeth II. +msgid "State Funeral of Queen Elizabeth II" +msgstr "" + +#. Coronation of Charles III. +msgid "Coronation of Charles III" +msgstr "" + +#. TT Bank Holiday. +msgid "TT Bank Holiday" +msgstr "" + +#. Tynwald Day. +msgid "Tynwald Day" +msgstr "" diff --git a/holidays/locale/en_US/LC_MESSAGES/GB.po b/holidays/locale/en_US/LC_MESSAGES/GB.po new file mode 100644 index 000000000..b65c54b17 --- /dev/null +++ b/holidays/locale/en_US/LC_MESSAGES/GB.po @@ -0,0 +1,124 @@ +# holidays +# -------- +# A fast, efficient Python library for generating country, province and state +# specific sets of holidays on the fly. It aims to make determining whether a +# specific date is a holiday as fast and flexible as possible. +# +# Authors: Vacanza Team and individual contributors (see AUTHORS file) +# dr-prodigy (c) 2017-2023 +# ryanss (c) 2014-2017 +# Website: https://github.com/vacanza/holidays +# License: MIT (see LICENSE file) +# +# United Kingdom holidays en_US localization. +# +msgid "" +msgstr "" +"Project-Id-Version: Holidays 0.66\n" +"POT-Creation-Date: 2025-01-29 14:18+0700\n" +"PO-Revision-Date: 2025-01-31 13:54+0700\n" +"Last-Translator: PPsyrius \n" +"Language-Team: Holidays Localization Team\n" +"Language: en_US\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Lingva 5.0.3\n" +"X-Generator: Poedit 3.5\n" + +#. %s (observed). +#, c-format +msgid "%s (observed)" +msgstr "%s (observed)" + +#. Good Friday. +msgid "Good Friday" +msgstr "Good Friday" + +#. May Day. +msgid "May Day" +msgstr "May Day" + +#. Spring Bank Holiday. +msgid "Spring Bank Holiday" +msgstr "Spring Bank Holiday" + +#. New Year's Day. +msgid "New Year's Day" +msgstr "New Year's Day" + +#. Christmas Day. +msgid "Christmas Day" +msgstr "Christmas Day" + +#. Boxing Day. +msgid "Boxing Day" +msgstr "Boxing Day" + +#. Easter Monday. +msgid "Easter Monday" +msgstr "Easter Monday" + +#. Whit Monday. +msgid "Whit Monday" +msgstr "Whit Monday" + +#. Late Summer Bank Holiday. +msgid "Late Summer Bank Holiday" +msgstr "Late Summer Bank Holiday" + +#. Saint Patrick's Day. +msgid "Saint Patrick's Day" +msgstr "Saint Patrick's Day" + +#. Battle of the Boyne. +msgid "Battle of the Boyne" +msgstr "Battle of the Boyne" + +#. New Year Holiday. +msgid "New Year Holiday" +msgstr "New Year Holiday" + +#. Summer Bank Holiday. +msgid "Summer Bank Holiday" +msgstr "Summer Bank Holiday" + +#. Saint Andrew's Day. +msgid "Saint Andrew's Day" +msgstr "Saint Andrew's Day" + +#. Silver Jubilee of Elizabeth II. +msgid "Silver Jubilee of Elizabeth II" +msgstr "Silver Jubilee of Elizabeth II" + +#. Wedding of Charles and Diana. +msgid "Wedding of Charles and Diana" +msgstr "Wedding of Charles and Diana" + +#. Millennium Celebrations. +msgid "Millennium Celebrations" +msgstr "Millennium Celebrations" + +#. Golden Jubilee of Elizabeth II. +msgid "Golden Jubilee of Elizabeth II" +msgstr "Golden Jubilee of Elizabeth II" + +#. Wedding of William and Catherine. +msgid "Wedding of William and Catherine" +msgstr "Wedding of William and Catherine" + +#. Diamond Jubilee of Elizabeth II. +msgid "Diamond Jubilee of Elizabeth II" +msgstr "Diamond Jubilee of Elizabeth II" + +#. Platinum Jubilee of Elizabeth II. +msgid "Platinum Jubilee of Elizabeth II" +msgstr "Platinum Jubilee of Elizabeth II" + +#. State Funeral of Queen Elizabeth II. +msgid "State Funeral of Queen Elizabeth II" +msgstr "State Funeral of Queen Elizabeth II" + +#. Coronation of Charles III. +msgid "Coronation of Charles III" +msgstr "Coronation of Charles III" diff --git a/holidays/locale/en_US/LC_MESSAGES/IM.po b/holidays/locale/en_US/LC_MESSAGES/IM.po new file mode 100644 index 000000000..868c7a36c --- /dev/null +++ b/holidays/locale/en_US/LC_MESSAGES/IM.po @@ -0,0 +1,112 @@ +# holidays +# -------- +# A fast, efficient Python library for generating country, province and state +# specific sets of holidays on the fly. It aims to make determining whether a +# specific date is a holiday as fast and flexible as possible. +# +# Authors: Vacanza Team and individual contributors (see AUTHORS file) +# dr-prodigy (c) 2017-2023 +# ryanss (c) 2014-2017 +# Website: https://github.com/vacanza/holidays +# License: MIT (see LICENSE file) +# +# Isle of Man holidays. +# +msgid "" +msgstr "" +"Project-Id-Version: Holidays 0.66\n" +"POT-Creation-Date: 2025-01-31 13:46+0700\n" +"PO-Revision-Date: 2025-01-31 13:54+0700\n" +"Last-Translator: PPsyrius \n" +"Language-Team: Holidays Localization Team\n" +"Language: en_US\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Lingva 5.0.3\n" +"X-Generator: Poedit 3.5\n" + +#. %s (observed). +#, c-format +msgid "%s (observed)" +msgstr "%s (observed)" + +#. Good Friday. +msgid "Good Friday" +msgstr "Good Friday" + +#. May Day. +msgid "May Day" +msgstr "May Day" + +#. Spring Bank Holiday. +msgid "Spring Bank Holiday" +msgstr "Spring Bank Holiday" + +#. New Year's Day. +msgid "New Year's Day" +msgstr "New Year's Day" + +#. Christmas Day. +msgid "Christmas Day" +msgstr "Christmas Day" + +#. Boxing Day. +msgid "Boxing Day" +msgstr "Boxing Day" + +#. Easter Monday. +msgid "Easter Monday" +msgstr "Easter Monday" + +#. Whit Monday. +msgid "Whit Monday" +msgstr "Whit Monday" + +#. Late Summer Bank Holiday. +msgid "Late Summer Bank Holiday" +msgstr "Late Summer Bank Holiday" + +#. Silver Jubilee of Elizabeth II. +msgid "Silver Jubilee of Elizabeth II" +msgstr "Silver Jubilee of Elizabeth II" + +#. Wedding of Charles and Diana. +msgid "Wedding of Charles and Diana" +msgstr "Wedding of Charles and Diana" + +#. Millennium Celebrations. +msgid "Millennium Celebrations" +msgstr "Millennium Celebrations" + +#. Golden Jubilee of Elizabeth II. +msgid "Golden Jubilee of Elizabeth II" +msgstr "Golden Jubilee of Elizabeth II" + +#. Wedding of William and Catherine. +msgid "Wedding of William and Catherine" +msgstr "Wedding of William and Catherine" + +#. Diamond Jubilee of Elizabeth II. +msgid "Diamond Jubilee of Elizabeth II" +msgstr "Diamond Jubilee of Elizabeth II" + +#. Platinum Jubilee of Elizabeth II. +msgid "Platinum Jubilee of Elizabeth II" +msgstr "Platinum Jubilee of Elizabeth II" + +#. State Funeral of Queen Elizabeth II. +msgid "State Funeral of Queen Elizabeth II" +msgstr "State Funeral of Queen Elizabeth II" + +#. Coronation of Charles III. +msgid "Coronation of Charles III" +msgstr "Coronation of Charles III" + +#. TT Bank Holiday. +msgid "TT Bank Holiday" +msgstr "TT Bank Holiday" + +#. Tynwald Day. +msgid "Tynwald Day" +msgstr "Tynwald Day" diff --git a/holidays/locale/th/LC_MESSAGES/GB.po b/holidays/locale/th/LC_MESSAGES/GB.po new file mode 100644 index 000000000..44dceb7f4 --- /dev/null +++ b/holidays/locale/th/LC_MESSAGES/GB.po @@ -0,0 +1,126 @@ +# holidays +# -------- +# A fast, efficient Python library for generating country, province and state +# specific sets of holidays on the fly. It aims to make determining whether a +# specific date is a holiday as fast and flexible as possible. +# +# Authors: Vacanza Team and individual contributors (see AUTHORS file) +# dr-prodigy (c) 2017-2023 +# ryanss (c) 2014-2017 +# Website: https://github.com/vacanza/holidays +# License: MIT (see LICENSE file) +# +# United Kingdom holidays th localization. +# +msgid "" +msgstr "" +"Project-Id-Version: Holidays 0.66\n" +"POT-Creation-Date: 2025-01-29 14:18+0700\n" +"PO-Revision-Date: 2025-01-31 13:54+0700\n" +"Last-Translator: PPsyrius \n" +"Language-Team: 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" +"Generated-By: Lingva 5.0.3\n" +"X-Generator: Poedit 3.5\n" + +#. %s (observed). +#, c-format +msgid "%s (observed)" +msgstr "ชดเชย%s" + +#. Good Friday. +msgid "Good Friday" +msgstr "วันศุกร์ประเสริฐ" + +#. May Day. +msgid "May Day" +msgstr "วันเมย์เดย์" + +#. Spring Bank Holiday. +msgid "Spring Bank Holiday" +msgstr "วันหยุดฤดูใบไม้ผลิของธนาคาร" + +#. New Year's Day. +msgid "New Year's Day" +msgstr "วันขึ้นปีใหม่" + +#. Christmas Day. +msgid "Christmas Day" +msgstr "วันคริสต์มาส" + +#. Boxing Day. +msgid "Boxing Day" +msgstr "วันเปิดกล่องของขวัญ" + +#. Easter Monday. +msgid "Easter Monday" +msgstr "วันจันทร์อีสเตอร์" + +#. Whit Monday. +msgid "Whit Monday" +msgstr "วันจันทร์หลังวันสมโภชพระจิตเจ้า" + +#. Late Summer Bank Holiday. +msgid "Late Summer Bank Holiday" +msgstr "วันหยุดช่วงปลายฤดูร้อนของธนาคาร" + +#. Saint Patrick's Day. +msgid "Saint Patrick's Day" +msgstr "วันนักบุญแพทริก" + +#. Battle of the Boyne. +msgid "Battle of the Boyne" +msgstr "วันรำลึกยุทธการแม่น้ำบอยน์" + +#. New Year Holiday. +msgid "New Year Holiday" +msgstr "หยุดวันขึ้นปีใหม่" + +#. Summer Bank Holiday. +msgid "Summer Bank Holiday" +msgstr "วันหยุดฤดูร้อนของธนาคาร" + +#. Saint Andrew's Day. +msgid "Saint Andrew's Day" +msgstr "วันนักบุญแอนดรูว์" + +#. Silver Jubilee of Elizabeth II. +msgid "Silver Jubilee of Elizabeth II" +msgstr "พระราชพิธีฉลองสิริราชสมบัติครบ 25 ปี สมเด็จพระราชินีนาถ" + +#. Wedding of Charles and Diana. +msgid "Wedding of Charles and Diana" +msgstr "" +"พระราชพิธีอภิเษกสมรสระหว่างไดอาน่า สเปนเซอร์และเจ้าฟ้าชายชาร์ลส์ " +"เจ้าชายแห่งเวลส์" + +#. Millennium Celebrations. +msgid "Millennium Celebrations" +msgstr "วันเฉลิมฉลองสหัสวรรษ" + +#. Golden Jubilee of Elizabeth II. +msgid "Golden Jubilee of Elizabeth II" +msgstr "พระราชพิธีฉลองสิริราชสมบัติครบ 50 ปี สมเด็จพระราชินีนาถ" + +#. Wedding of William and Catherine. +msgid "Wedding of William and Catherine" +msgstr "พระราชพิธีเสกสมรสระหว่างเจ้าชายวิลเลียมกับแคเธอริน มิดเดิลตัน" + +#. Diamond Jubilee of Elizabeth II. +msgid "Diamond Jubilee of Elizabeth II" +msgstr "พระราชพิธีฉลองสิริราชสมบัติครบ 60 ปี สมเด็จพระราชินีนาถ" + +#. Platinum Jubilee of Elizabeth II. +msgid "Platinum Jubilee of Elizabeth II" +msgstr "พระราชพิธีฉลองสิริราชสมบัติครบ 70 ปี สมเด็จพระราชินีนาถ" + +#. State Funeral of Queen Elizabeth II. +msgid "State Funeral of Queen Elizabeth II" +msgstr "พระราชพิธีพระบรมศพของสมเด็จพระราชินีนาถเอลิซาเบธที่ 2" + +#. Coronation of Charles III. +msgid "Coronation of Charles III" +msgstr "พระราชพิธีราชาภิเษกของสมเด็จพระเจ้าชาลส์ที่ 3 แห่งสหราชอาณาจักร" diff --git a/holidays/locale/th/LC_MESSAGES/IM.po b/holidays/locale/th/LC_MESSAGES/IM.po new file mode 100644 index 000000000..1f89ea31a --- /dev/null +++ b/holidays/locale/th/LC_MESSAGES/IM.po @@ -0,0 +1,114 @@ +# holidays +# -------- +# A fast, efficient Python library for generating country, province and state +# specific sets of holidays on the fly. It aims to make determining whether a +# specific date is a holiday as fast and flexible as possible. +# +# Authors: Vacanza Team and individual contributors (see AUTHORS file) +# dr-prodigy (c) 2017-2023 +# ryanss (c) 2014-2017 +# Website: https://github.com/vacanza/holidays +# License: MIT (see LICENSE file) +# +# Isle of Man holidays th localization. +# +msgid "" +msgstr "" +"Project-Id-Version: Holidays 0.66\n" +"POT-Creation-Date: 2025-01-31 13:46+0700\n" +"PO-Revision-Date: 2025-01-31 13:54+0700\n" +"Last-Translator: PPsyrius \n" +"Language-Team: 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" +"Generated-By: Lingva 5.0.3\n" +"X-Generator: Poedit 3.5\n" + +#. %s (observed). +#, c-format +msgid "%s (observed)" +msgstr "ชดเชย%s" + +#. Good Friday. +msgid "Good Friday" +msgstr "วันศุกร์ประเสริฐ" + +#. May Day. +msgid "May Day" +msgstr "วันเมย์เดย์" + +#. Spring Bank Holiday. +msgid "Spring Bank Holiday" +msgstr "วันหยุดฤดูใบไม้ผลิของธนาคาร" + +#. New Year's Day. +msgid "New Year's Day" +msgstr "วันขึ้นปีใหม่" + +#. Christmas Day. +msgid "Christmas Day" +msgstr "วันคริสต์มาส" + +#. Boxing Day. +msgid "Boxing Day" +msgstr "วันเปิดกล่องของขวัญ" + +#. Easter Monday. +msgid "Easter Monday" +msgstr "วันจันทร์อีสเตอร์" + +#. Whit Monday. +msgid "Whit Monday" +msgstr "วันจันทร์หลังวันสมโภชพระจิตเจ้า" + +#. Late Summer Bank Holiday. +msgid "Late Summer Bank Holiday" +msgstr "วันหยุดช่วงปลายฤดูร้อนของธนาคาร" + +#. Silver Jubilee of Elizabeth II. +msgid "Silver Jubilee of Elizabeth II" +msgstr "พระราชพิธีฉลองสิริราชสมบัติครบ 25 ปี สมเด็จพระราชินีนาถ" + +#. Wedding of Charles and Diana. +msgid "Wedding of Charles and Diana" +msgstr "" +"พระราชพิธีอภิเษกสมรสระหว่างไดอาน่า สเปนเซอร์และเจ้าฟ้าชายชาร์ลส์ " +"เจ้าชายแห่งเวลส์" + +#. Millennium Celebrations. +msgid "Millennium Celebrations" +msgstr "วันเฉลิมฉลองสหัสวรรษ" + +#. Golden Jubilee of Elizabeth II. +msgid "Golden Jubilee of Elizabeth II" +msgstr "พระราชพิธีฉลองสิริราชสมบัติครบ 50 ปี สมเด็จพระราชินีนาถ" + +#. Wedding of William and Catherine. +msgid "Wedding of William and Catherine" +msgstr "พระราชพิธีเสกสมรสระหว่างเจ้าชายวิลเลียมกับแคเธอริน มิดเดิลตัน" + +#. Diamond Jubilee of Elizabeth II. +msgid "Diamond Jubilee of Elizabeth II" +msgstr "พระราชพิธีฉลองสิริราชสมบัติครบ 60 ปี สมเด็จพระราชินีนาถ" + +#. Platinum Jubilee of Elizabeth II. +msgid "Platinum Jubilee of Elizabeth II" +msgstr "พระราชพิธีฉลองสิริราชสมบัติครบ 70 ปี สมเด็จพระราชินีนาถ" + +#. State Funeral of Queen Elizabeth II. +msgid "State Funeral of Queen Elizabeth II" +msgstr "พระราชพิธีพระบรมศพของสมเด็จพระราชินีนาถเอลิซาเบธที่ 2" + +#. Coronation of Charles III. +msgid "Coronation of Charles III" +msgstr "พระราชพิธีราชาภิเษกของสมเด็จพระเจ้าชาลส์ที่ 3 แห่งสหราชอาณาจักร" + +#. TT Bank Holiday. +msgid "TT Bank Holiday" +msgstr "วันแข่งไอร์ออฟแมน ทีที" + +#. Tynwald Day. +msgid "Tynwald Day" +msgstr "วันไทน์วอลด์" diff --git a/tests/countries/test_isle_of_man.py b/tests/countries/test_isle_of_man.py index 81feae400..72cbe9994 100644 --- a/tests/countries/test_isle_of_man.py +++ b/tests/countries/test_isle_of_man.py @@ -76,3 +76,48 @@ def test_tynwald_day(self): "2025-07-05", "2026-07-05", ) + + def test_l10n_default(self): + # https://www.gov.im/categories/home-and-neighbourhood/bank-holidays/ + self.assertLocalizedHolidays( + ("2024-01-01", "New Year's Day"), + ("2024-03-29", "Good Friday"), + ("2024-04-01", "Easter Monday"), + ("2024-05-06", "May Day"), + ("2024-05-27", "Spring Bank Holiday"), + ("2024-06-07", "TT Bank Holiday"), + ("2024-07-05", "Tynwald Day"), + ("2024-08-26", "Late Summer Bank Holiday"), + ("2024-12-25", "Christmas Day"), + ("2024-12-26", "Boxing Day"), + ) + + def test_l10n_en_us(self): + self.assertLocalizedHolidays( + "en_US", + ("2024-01-01", "New Year's Day"), + ("2024-03-29", "Good Friday"), + ("2024-04-01", "Easter Monday"), + ("2024-05-06", "May Day"), + ("2024-05-27", "Spring Bank Holiday"), + ("2024-06-07", "TT Bank Holiday"), + ("2024-07-05", "Tynwald Day"), + ("2024-08-26", "Late Summer Bank Holiday"), + ("2024-12-25", "Christmas Day"), + ("2024-12-26", "Boxing Day"), + ) + + def test_l10n_th(self): + self.assertLocalizedHolidays( + "th", + ("2024-01-01", "วันขึ้นปีใหม่"), + ("2024-03-29", "วันศุกร์ประเสริฐ"), + ("2024-04-01", "วันจันทร์อีสเตอร์"), + ("2024-05-06", "วันเมย์เดย์"), + ("2024-05-27", "วันหยุดฤดูใบไม้ผลิของธนาคาร"), + ("2024-06-07", "วันแข่งไอร์ออฟแมน ทีที"), + ("2024-07-05", "วันไทน์วอลด์"), + ("2024-08-26", "วันหยุดช่วงปลายฤดูร้อนของธนาคาร"), + ("2024-12-25", "วันคริสต์มาส"), + ("2024-12-26", "วันเปิดกล่องของขวัญ"), + ) diff --git a/tests/countries/test_united_kingdom.py b/tests/countries/test_united_kingdom.py index 791eca12e..f1202a3eb 100644 --- a/tests/countries/test_united_kingdom.py +++ b/tests/countries/test_united_kingdom.py @@ -422,3 +422,63 @@ def test_all_holidays_present(self): "Boxing Day", } self.assertEqual(all_holidays, y_2015) + + def test_l10n_default(self): + # https://www.gov.uk/bank-holidays + self.assertLocalizedHolidays( + ("2024-01-01", "New Year's Day"), + ("2024-01-02", "New Year Holiday"), + ("2024-03-17", "Saint Patrick's Day"), + ("2024-03-18", "Saint Patrick's Day (observed)"), + ("2024-03-29", "Good Friday"), + ("2024-04-01", "Easter Monday"), + ("2024-05-06", "May Day"), + ("2024-05-27", "Spring Bank Holiday"), + ("2024-07-12", "Battle of the Boyne"), + ("2024-08-05", "Summer Bank Holiday"), + ("2024-08-26", "Late Summer Bank Holiday"), + ("2024-11-30", "Saint Andrew's Day"), + ("2024-12-02", "Saint Andrew's Day (observed)"), + ("2024-12-25", "Christmas Day"), + ("2024-12-26", "Boxing Day"), + ) + + def test_l10n_en_us(self): + self.assertLocalizedHolidays( + "en_US", + ("2024-01-01", "New Year's Day"), + ("2024-01-02", "New Year Holiday"), + ("2024-03-17", "Saint Patrick's Day"), + ("2024-03-18", "Saint Patrick's Day (observed)"), + ("2024-03-29", "Good Friday"), + ("2024-04-01", "Easter Monday"), + ("2024-05-06", "May Day"), + ("2024-05-27", "Spring Bank Holiday"), + ("2024-07-12", "Battle of the Boyne"), + ("2024-08-05", "Summer Bank Holiday"), + ("2024-08-26", "Late Summer Bank Holiday"), + ("2024-11-30", "Saint Andrew's Day"), + ("2024-12-02", "Saint Andrew's Day (observed)"), + ("2024-12-25", "Christmas Day"), + ("2024-12-26", "Boxing Day"), + ) + + def test_l10n_th(self): + self.assertLocalizedHolidays( + "th", + ("2024-01-01", "วันขึ้นปีใหม่"), + ("2024-01-02", "หยุดวันขึ้นปีใหม่"), + ("2024-03-17", "วันนักบุญแพทริก"), + ("2024-03-18", "ชดเชยวันนักบุญแพทริก"), + ("2024-03-29", "วันศุกร์ประเสริฐ"), + ("2024-04-01", "วันจันทร์อีสเตอร์"), + ("2024-05-06", "วันเมย์เดย์"), + ("2024-05-27", "วันหยุดฤดูใบไม้ผลิของธนาคาร"), + ("2024-07-12", "วันรำลึกยุทธการแม่น้ำบอยน์"), + ("2024-08-05", "วันหยุดฤดูร้อนของธนาคาร"), + ("2024-08-26", "วันหยุดช่วงปลายฤดูร้อนของธนาคาร"), + ("2024-11-30", "วันนักบุญแอนดรูว์"), + ("2024-12-02", "ชดเชยวันนักบุญแอนดรูว์"), + ("2024-12-25", "วันคริสต์มาส"), + ("2024-12-26", "วันเปิดกล่องของขวัญ"), + ) From 4ec51fd541a4eaf795aaf1c3d423ffe2e095b75b Mon Sep 17 00:00:00 2001 From: Arkadii Yakovets <2201626+arkid15r@users.noreply.github.com> Date: Fri, 31 Jan 2025 15:49:48 -0800 Subject: [PATCH 2/5] Update holidays/locale/en_US/LC_MESSAGES/IM.po Co-authored-by: ~Jhellico Signed-off-by: Arkadii Yakovets <2201626+arkid15r@users.noreply.github.com> --- holidays/locale/en_US/LC_MESSAGES/IM.po | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/holidays/locale/en_US/LC_MESSAGES/IM.po b/holidays/locale/en_US/LC_MESSAGES/IM.po index 868c7a36c..7be2635eb 100644 --- a/holidays/locale/en_US/LC_MESSAGES/IM.po +++ b/holidays/locale/en_US/LC_MESSAGES/IM.po @@ -10,7 +10,7 @@ # Website: https://github.com/vacanza/holidays # License: MIT (see LICENSE file) # -# Isle of Man holidays. +# Isle of Man holidays en_US localization. # msgid "" msgstr "" From 236dc06703aaa90f5a2597d6ee8ab1a6e0aece5b Mon Sep 17 00:00:00 2001 From: ~Jhellico Date: Tue, 4 Feb 2025 03:20:29 +0200 Subject: [PATCH 3/5] l10n inheritance from parent class (#10) --- holidays/holiday_base.py | 32 ++++++++---- holidays/locale/en_GB/LC_MESSAGES/IM.po | 65 ------------------------ holidays/locale/en_US/LC_MESSAGES/IM.po | 65 ------------------------ holidays/locale/th/LC_MESSAGES/IM.po | 67 ------------------------- 4 files changed, 23 insertions(+), 206 deletions(-) diff --git a/holidays/holiday_base.py b/holidays/holiday_base.py index 4cf888317..63f8617e6 100644 --- a/holidays/holiday_base.py +++ b/holidays/holiday_base.py @@ -364,16 +364,30 @@ def __init__( self.weekend_workdays = getattr(self, "weekend_workdays", set()) supported_languages = set(self.supported_languages) - self.tr = ( - translation( + if self._entity_code is not None: + fallback = language not in supported_languages + languages = [language] if language in supported_languages else None + localedir = str(Path(__file__).with_name("locale")) + main_translation = translation( self._entity_code, - fallback=language not in supported_languages, - languages=[language] if language in supported_languages else None, - localedir=str(Path(__file__).with_name("locale")), - ).gettext - if self._entity_code is not None - else gettext - ) + fallback=fallback, + languages=languages, + localedir=localedir, + ) + self.tr = main_translation.gettext + for base in self.__class__.__bases__: + if hasattr(base, "country") or hasattr(base, "market"): + super_entity_code = getattr(base, "country", getattr(base, "market", None)) + base_translation = translation( + super_entity_code, # type: ignore[arg-type] + fallback=fallback, + languages=languages, + localedir=localedir, + ) + main_translation.add_fallback(base_translation) + break + else: + self.tr = gettext self.years = _normalize_arguments(int, years) # Populate holidays. diff --git a/holidays/locale/en_GB/LC_MESSAGES/IM.po b/holidays/locale/en_GB/LC_MESSAGES/IM.po index 97ec728d5..e67983601 100644 --- a/holidays/locale/en_GB/LC_MESSAGES/IM.po +++ b/holidays/locale/en_GB/LC_MESSAGES/IM.po @@ -26,35 +26,6 @@ msgstr "" "Generated-By: Lingva 5.0.3\n" "X-Generator: Poedit 3.5\n" -#. %s (observed). -#, c-format -msgid "%s (observed)" -msgstr "" - -#. Good Friday. -msgid "Good Friday" -msgstr "" - -#. May Day. -msgid "May Day" -msgstr "" - -#. Spring Bank Holiday. -msgid "Spring Bank Holiday" -msgstr "" - -#. New Year's Day. -msgid "New Year's Day" -msgstr "" - -#. Christmas Day. -msgid "Christmas Day" -msgstr "" - -#. Boxing Day. -msgid "Boxing Day" -msgstr "" - #. Easter Monday. msgid "Easter Monday" msgstr "" @@ -67,42 +38,6 @@ msgstr "" msgid "Late Summer Bank Holiday" msgstr "" -#. Silver Jubilee of Elizabeth II. -msgid "Silver Jubilee of Elizabeth II" -msgstr "" - -#. Wedding of Charles and Diana. -msgid "Wedding of Charles and Diana" -msgstr "" - -#. Millennium Celebrations. -msgid "Millennium Celebrations" -msgstr "" - -#. Golden Jubilee of Elizabeth II. -msgid "Golden Jubilee of Elizabeth II" -msgstr "" - -#. Wedding of William and Catherine. -msgid "Wedding of William and Catherine" -msgstr "" - -#. Diamond Jubilee of Elizabeth II. -msgid "Diamond Jubilee of Elizabeth II" -msgstr "" - -#. Platinum Jubilee of Elizabeth II. -msgid "Platinum Jubilee of Elizabeth II" -msgstr "" - -#. State Funeral of Queen Elizabeth II. -msgid "State Funeral of Queen Elizabeth II" -msgstr "" - -#. Coronation of Charles III. -msgid "Coronation of Charles III" -msgstr "" - #. TT Bank Holiday. msgid "TT Bank Holiday" msgstr "" diff --git a/holidays/locale/en_US/LC_MESSAGES/IM.po b/holidays/locale/en_US/LC_MESSAGES/IM.po index 7be2635eb..5d5b8ffb4 100644 --- a/holidays/locale/en_US/LC_MESSAGES/IM.po +++ b/holidays/locale/en_US/LC_MESSAGES/IM.po @@ -26,35 +26,6 @@ msgstr "" "Generated-By: Lingva 5.0.3\n" "X-Generator: Poedit 3.5\n" -#. %s (observed). -#, c-format -msgid "%s (observed)" -msgstr "%s (observed)" - -#. Good Friday. -msgid "Good Friday" -msgstr "Good Friday" - -#. May Day. -msgid "May Day" -msgstr "May Day" - -#. Spring Bank Holiday. -msgid "Spring Bank Holiday" -msgstr "Spring Bank Holiday" - -#. New Year's Day. -msgid "New Year's Day" -msgstr "New Year's Day" - -#. Christmas Day. -msgid "Christmas Day" -msgstr "Christmas Day" - -#. Boxing Day. -msgid "Boxing Day" -msgstr "Boxing Day" - #. Easter Monday. msgid "Easter Monday" msgstr "Easter Monday" @@ -67,42 +38,6 @@ msgstr "Whit Monday" msgid "Late Summer Bank Holiday" msgstr "Late Summer Bank Holiday" -#. Silver Jubilee of Elizabeth II. -msgid "Silver Jubilee of Elizabeth II" -msgstr "Silver Jubilee of Elizabeth II" - -#. Wedding of Charles and Diana. -msgid "Wedding of Charles and Diana" -msgstr "Wedding of Charles and Diana" - -#. Millennium Celebrations. -msgid "Millennium Celebrations" -msgstr "Millennium Celebrations" - -#. Golden Jubilee of Elizabeth II. -msgid "Golden Jubilee of Elizabeth II" -msgstr "Golden Jubilee of Elizabeth II" - -#. Wedding of William and Catherine. -msgid "Wedding of William and Catherine" -msgstr "Wedding of William and Catherine" - -#. Diamond Jubilee of Elizabeth II. -msgid "Diamond Jubilee of Elizabeth II" -msgstr "Diamond Jubilee of Elizabeth II" - -#. Platinum Jubilee of Elizabeth II. -msgid "Platinum Jubilee of Elizabeth II" -msgstr "Platinum Jubilee of Elizabeth II" - -#. State Funeral of Queen Elizabeth II. -msgid "State Funeral of Queen Elizabeth II" -msgstr "State Funeral of Queen Elizabeth II" - -#. Coronation of Charles III. -msgid "Coronation of Charles III" -msgstr "Coronation of Charles III" - #. TT Bank Holiday. msgid "TT Bank Holiday" msgstr "TT Bank Holiday" diff --git a/holidays/locale/th/LC_MESSAGES/IM.po b/holidays/locale/th/LC_MESSAGES/IM.po index 1f89ea31a..ee72e5bb6 100644 --- a/holidays/locale/th/LC_MESSAGES/IM.po +++ b/holidays/locale/th/LC_MESSAGES/IM.po @@ -26,35 +26,6 @@ msgstr "" "Generated-By: Lingva 5.0.3\n" "X-Generator: Poedit 3.5\n" -#. %s (observed). -#, c-format -msgid "%s (observed)" -msgstr "ชดเชย%s" - -#. Good Friday. -msgid "Good Friday" -msgstr "วันศุกร์ประเสริฐ" - -#. May Day. -msgid "May Day" -msgstr "วันเมย์เดย์" - -#. Spring Bank Holiday. -msgid "Spring Bank Holiday" -msgstr "วันหยุดฤดูใบไม้ผลิของธนาคาร" - -#. New Year's Day. -msgid "New Year's Day" -msgstr "วันขึ้นปีใหม่" - -#. Christmas Day. -msgid "Christmas Day" -msgstr "วันคริสต์มาส" - -#. Boxing Day. -msgid "Boxing Day" -msgstr "วันเปิดกล่องของขวัญ" - #. Easter Monday. msgid "Easter Monday" msgstr "วันจันทร์อีสเตอร์" @@ -67,44 +38,6 @@ msgstr "วันจันทร์หลังวันสมโภชพระ msgid "Late Summer Bank Holiday" msgstr "วันหยุดช่วงปลายฤดูร้อนของธนาคาร" -#. Silver Jubilee of Elizabeth II. -msgid "Silver Jubilee of Elizabeth II" -msgstr "พระราชพิธีฉลองสิริราชสมบัติครบ 25 ปี สมเด็จพระราชินีนาถ" - -#. Wedding of Charles and Diana. -msgid "Wedding of Charles and Diana" -msgstr "" -"พระราชพิธีอภิเษกสมรสระหว่างไดอาน่า สเปนเซอร์และเจ้าฟ้าชายชาร์ลส์ " -"เจ้าชายแห่งเวลส์" - -#. Millennium Celebrations. -msgid "Millennium Celebrations" -msgstr "วันเฉลิมฉลองสหัสวรรษ" - -#. Golden Jubilee of Elizabeth II. -msgid "Golden Jubilee of Elizabeth II" -msgstr "พระราชพิธีฉลองสิริราชสมบัติครบ 50 ปี สมเด็จพระราชินีนาถ" - -#. Wedding of William and Catherine. -msgid "Wedding of William and Catherine" -msgstr "พระราชพิธีเสกสมรสระหว่างเจ้าชายวิลเลียมกับแคเธอริน มิดเดิลตัน" - -#. Diamond Jubilee of Elizabeth II. -msgid "Diamond Jubilee of Elizabeth II" -msgstr "พระราชพิธีฉลองสิริราชสมบัติครบ 60 ปี สมเด็จพระราชินีนาถ" - -#. Platinum Jubilee of Elizabeth II. -msgid "Platinum Jubilee of Elizabeth II" -msgstr "พระราชพิธีฉลองสิริราชสมบัติครบ 70 ปี สมเด็จพระราชินีนาถ" - -#. State Funeral of Queen Elizabeth II. -msgid "State Funeral of Queen Elizabeth II" -msgstr "พระราชพิธีพระบรมศพของสมเด็จพระราชินีนาถเอลิซาเบธที่ 2" - -#. Coronation of Charles III. -msgid "Coronation of Charles III" -msgstr "พระราชพิธีราชาภิเษกของสมเด็จพระเจ้าชาลส์ที่ 3 แห่งสหราชอาณาจักร" - #. TT Bank Holiday. msgid "TT Bank Holiday" msgstr "วันแข่งไอร์ออฟแมน ทีที" From 2dd892d1b1d187d74955211f4d6eb723f3dcf183 Mon Sep 17 00:00:00 2001 From: Arkadii Yakovets Date: Tue, 4 Feb 2025 11:05:53 -0800 Subject: [PATCH 4/5] Update code --- holidays/holiday_base.py | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/holidays/holiday_base.py b/holidays/holiday_base.py index 63f8617e6..1e09e841b 100644 --- a/holidays/holiday_base.py +++ b/holidays/holiday_base.py @@ -19,6 +19,7 @@ from datetime import date, datetime, timedelta, timezone from functools import cached_property from gettext import gettext, translation +from inspect import getmro from pathlib import Path from typing import Any, Dict, Optional, Union, cast @@ -367,27 +368,34 @@ def __init__( if self._entity_code is not None: fallback = language not in supported_languages languages = [language] if language in supported_languages else None - localedir = str(Path(__file__).with_name("locale")) - main_translation = translation( + locale_directory = str(Path(__file__).with_name("locale")) + + # Add entity native content translations. + entity_translation = translation( self._entity_code, fallback=fallback, languages=languages, - localedir=localedir, + localedir=locale_directory, ) - self.tr = main_translation.gettext - for base in self.__class__.__bases__: - if hasattr(base, "country") or hasattr(base, "market"): - super_entity_code = getattr(base, "country", getattr(base, "market", None)) - base_translation = translation( - super_entity_code, # type: ignore[arg-type] - fallback=fallback, - languages=languages, - localedir=localedir, + # Add a fallback if entity has parent translations. + for base_entity in getmro(self.__class__): + base_entity_code = getattr(base_entity, "country", None) or getattr( + base_entity, "market", None + ) + if base_entity_code and base_entity_code != self._entity_code: + entity_translation.add_fallback( + translation( + base_entity_code, + fallback=fallback, + languages=languages, + localedir=locale_directory, + ) ) - main_translation.add_fallback(base_translation) - break + break # Handles single parent entity cases only. + self.tr = entity_translation.gettext else: self.tr = gettext + self.years = _normalize_arguments(int, years) # Populate holidays. From f4a213345a62028fc4dedcb5cc7c183ce2a014cd Mon Sep 17 00:00:00 2001 From: Arkadii Yakovets Date: Sun, 9 Feb 2025 14:59:06 -0800 Subject: [PATCH 5/5] Update code --- holidays/countries/isle_of_man.py | 1 + holidays/holiday_base.py | 24 ++++++++++-------------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/holidays/countries/isle_of_man.py b/holidays/countries/isle_of_man.py index 35f7cafb6..748a1ee93 100644 --- a/holidays/countries/isle_of_man.py +++ b/holidays/countries/isle_of_man.py @@ -21,6 +21,7 @@ class IsleOfMan(UnitedKingdom): """Using existing code in UnitedKingdom for now.""" country = "IM" + parent_entity = UnitedKingdom subdivisions = () # Override UnitedKingdom subdivisions. subdivisions_aliases = {} # Override UnitedKingdom subdivisions aliases. diff --git a/holidays/holiday_base.py b/holidays/holiday_base.py index 1e09e841b..5c8ab0a60 100644 --- a/holidays/holiday_base.py +++ b/holidays/holiday_base.py @@ -19,7 +19,6 @@ from datetime import date, datetime, timedelta, timezone from functools import cached_property from gettext import gettext, translation -from inspect import getmro from pathlib import Path from typing import Any, Dict, Optional, Union, cast @@ -250,6 +249,8 @@ def _populate(self, year): """Start year of holidays presence for this entity.""" end_year: int = DEFAULT_END_YEAR """End year of holidays presence for this entity.""" + parent_entity: Optional[type["HolidayBase"]] = None + """Optional parent entity to reference as a base.""" def __init__( self, @@ -378,20 +379,15 @@ def __init__( localedir=locale_directory, ) # Add a fallback if entity has parent translations. - for base_entity in getmro(self.__class__): - base_entity_code = getattr(base_entity, "country", None) or getattr( - base_entity, "market", None - ) - if base_entity_code and base_entity_code != self._entity_code: - entity_translation.add_fallback( - translation( - base_entity_code, - fallback=fallback, - languages=languages, - localedir=locale_directory, - ) + if parent_entity := self.parent_entity: + entity_translation.add_fallback( + translation( + parent_entity.country or parent_entity.market, + fallback=fallback, + languages=languages, + localedir=locale_directory, ) - break # Handles single parent entity cases only. + ) self.tr = entity_translation.gettext else: self.tr = gettext