-
-
Notifications
You must be signed in to change notification settings - Fork 557
Update Myanmar holidays: add th
l10n support
#2959
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Summary by CodeRabbit
WalkthroughAdds Thai (th) as a supported language for Myanmar: updates README, extends Myanmar.supported_languages, adds Thai PO translations for Myanmar, and introduces Thai l10n tests. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested labels
Suggested reviewers
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 Ruff (0.13.1)holidays/countries/myanmar.py�[1;31mruff failed�[0m tests/countries/test_myanmar.py�[1;31mruff failed�[0m Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #2959 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 300 300
Lines 17919 17919
Branches 2314 2314
=========================================
Hits 17919 17919 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
holidays/locale/th/LC_MESSAGES/MM.po (1)
115-123
: Align substituted holiday phrasing with Thai convention
Replace msgstr "วันหยุด (แทน %s)" with "ชดเชย%s" in holidays/locale/th/LC_MESSAGES/MM.po and update the related test expectations.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (4)
README.md
(1 hunks)holidays/countries/myanmar.py
(1 hunks)holidays/locale/th/LC_MESSAGES/MM.po
(1 hunks)tests/countries/test_myanmar.py
(2 hunks)
🧰 Additional context used
🧠 Learnings (22)
📚 Learning: 2025-09-03T14:05:10.592Z
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/countries/test_aruba.py:77-79
Timestamp: 2025-09-03T14:05:10.592Z
Learning: The assertNoHolidayName helper method in the vacanza/holidays test framework accepts both individual years (scalars) and iterables of years, making calls like assertNoHolidayName(name, AW.start_year, range(2023, 2050)) valid where AW.start_year is a single integer year.
Applied to files:
tests/countries/test_myanmar.py
📚 Learning: 2025-04-05T04:47:27.213Z
Learnt from: PPsyrius
PR: vacanza/holidays#2416
File: tests/countries/test_turkmenistan.py:52-64
Timestamp: 2025-04-05T04:47:27.213Z
Learning: For holiday tests in the vacanza/holidays project, structure tests by individual holidays rather than by years. Each test method should focus on a specific holiday and test it across multiple years (from start_year through 2050) using helper methods like `assertHolidayName`. For fixed holidays, use generators like `(f"{year}-01-01" for year in range(1991, 2051))`. For movable holidays, specify individual dates for specific years followed by a range check.
Applied to files:
tests/countries/test_myanmar.py
📚 Learning: 2025-09-17T09:07:56.459Z
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/countries/test_paraguay.py:134-139
Timestamp: 2025-09-17T09:07:56.459Z
Learning: In the vacanza/holidays project, when testing holidays that start from a specific year (not the country's start_year), the standard pattern is to use `range(specific_year, self.end_year)` for the holiday dates and `assertNoHolidayName(name, range(self.start_year, specific_year))` for the gap period. Using `self.full_range` with year conditions like `if year >= specific_year` is not the established pattern and would be inconsistent with the codebase.
Applied to files:
tests/countries/test_myanmar.py
📚 Learning: 2025-09-14T16:05:55.205Z
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/countries/test_iran.py:28-28
Timestamp: 2025-09-14T16:05:55.205Z
Learning: In tests/countries/test_iran.py, using years=(self.start_year - 1, 2102) in the no-holiday test is intentional because Iran uses the Persian Calendar which has specific supported year range constraints, and 2102 represents the upper limit of the Persian Calendar's supported range, not just an arbitrary far-future date.
Applied to files:
tests/countries/test_myanmar.py
📚 Learning: 2025-07-24T15:21:31.632Z
Learnt from: PPsyrius
PR: vacanza/holidays#2750
File: tests/countries/test_germany.py:46-46
Timestamp: 2025-07-24T15:21:31.632Z
Learning: In the holidays project test files, the standard method name for testing the absence of holidays is `test_no_holidays`, not more descriptive names like `test_no_holidays_before_1990`. This is a consistent naming convention across country test files like France and Germany.
Applied to files:
tests/countries/test_myanmar.py
📚 Learning: 2025-09-03T16:49:35.246Z
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/countries/test_argentina.py:375-375
Timestamp: 2025-09-03T16:49:35.246Z
Learning: In the holidays library, national holiday tests use self.full_range (or similar comprehensive year ranges) even when explicit test dates only show modern observance. This is intentional for correctness and comprehensive coverage, unlike subdivision-specific holidays which have explicit year boundaries based on known start dates.
Applied to files:
tests/countries/test_myanmar.py
📚 Learning: 2025-05-06T21:07:11.577Z
Learnt from: KJhellico
PR: vacanza/holidays#2530
File: tests/countries/test_andorra.py:23-28
Timestamp: 2025-05-06T21:07:11.577Z
Learning: In the holidays project, test methods for country holidays follow a standard form where year ranges are explicitly recreated in each test method rather than being stored as class variables, to maintain consistency across all country tests.
Applied to files:
tests/countries/test_myanmar.py
📚 Learning: 2025-09-10T13:46:06.329Z
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/countries/test_canada.py:745-747
Timestamp: 2025-09-10T13:46:06.329Z
Learning: In the vacanza/holidays test framework, assertion methods like assertNoSubdivNuOptionalHolidayName correctly accept multiple range objects as separate arguments, such as assertNoSubdivNuOptionalHolidayName(name, range(CA.start_year, 2000), range(2020, 2050)). This is the intended usage pattern and should not be "fixed" by splitting into separate calls.
Applied to files:
tests/countries/test_myanmar.py
📚 Learning: 2025-09-14T16:03:13.558Z
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/countries/test_barbados.py:21-23
Timestamp: 2025-09-14T16:03:13.558Z
Learning: In tests/countries/test_barbados.py, using years_non_observed=range(2000, 2024) is intentional because all observed holiday examples fall within 2001-2023, making this range appropriate for limiting testing to years where observed holidays actually exist in the test data.
Applied to files:
tests/countries/test_myanmar.py
📚 Learning: 2025-08-21T04:56:03.780Z
Learnt from: PPsyrius
PR: vacanza/holidays#2843
File: holidays/countries/burundi.py:63-101
Timestamp: 2025-08-21T04:56:03.780Z
Learning: In the holidays library, countries with localization support consistently use tr() wrappers around holiday names when calling _add_* methods (e.g., self._add_new_years_day(tr("Holiday Name"))). This is the established pattern across United States, Thailand, and other l10n-enabled countries, contrary to any suggestion that translation is handled internally by _add_* methods.
Applied to files:
tests/countries/test_myanmar.py
holidays/countries/myanmar.py
holidays/locale/th/LC_MESSAGES/MM.po
📚 Learning: 2025-08-12T17:16:54.497Z
Learnt from: PPsyrius
PR: vacanza/holidays#2794
File: tests/calendars/test_julian.py:35-36
Timestamp: 2025-08-12T17:16:54.497Z
Learning: In the vacanza/holidays project calendar tests (Thai, Ethiopian, Julian, etc.), the established testing pattern for validation methods is to use simple for loops like `for year in known_data_dict:` followed by `self.assertEqual(expected, actual)` without using unittest's subTest feature. This pattern is consistently maintained across all calendar test files.
Applied to files:
tests/countries/test_myanmar.py
📚 Learning: 2025-06-25T10:36:39.103Z
Learnt from: PPsyrius
PR: vacanza/holidays#2678
File: tests/countries/test_puerto_rico.py:84-108
Timestamp: 2025-06-25T10:36:39.103Z
Learning: In the holidays library, test methods (including localization test methods like test_l10n_th, test_l10n_default) follow a standard library-wide approach of not including docstrings. This is the established convention across the codebase.
Applied to files:
tests/countries/test_myanmar.py
📚 Learning: 2025-04-05T06:49:06.217Z
Learnt from: PPsyrius
PR: vacanza/holidays#2386
File: tests/countries/test_nepal.py:499-536
Timestamp: 2025-04-05T06:49:06.217Z
Learning: In the holidays project, test files follow a dual testing approach: individual methods test specific holidays across multiple years, while comprehensive year-specific tests (e.g., `test_2025`) verify all holidays for a specific year in a single assertion. Both approaches serve different testing purposes and complement each other.
Applied to files:
tests/countries/test_myanmar.py
📚 Learning: 2025-08-30T12:49:19.688Z
Learnt from: KJhellico
PR: vacanza/holidays#2834
File: tests/financial/test_national_stock_exchange_of_india.py:342-360
Timestamp: 2025-08-30T12:49:19.688Z
Learning: The assertLocalizedHolidays method in the vacanza/holidays project requires a complete list of all holidays for the specific year being tested, not just a subset. When testing localization, all holidays from that year must be included in the assertion.
Applied to files:
tests/countries/test_myanmar.py
📚 Learning: 2025-09-18T00:35:52.041Z
Learnt from: PPsyrius
PR: vacanza/holidays#2944
File: tests/countries/test_myanmar.py:29-31
Timestamp: 2025-09-18T00:35:52.041Z
Learning: For Myanmar in the holidays library, only the default PUBLIC category is used, so there's no need to specify categories=Myanmar.supported_categories in test_no_holidays methods, as it would be equivalent to the default behavior and Myanmar doesn't define additional supported_categories.
Applied to files:
holidays/countries/myanmar.py
📚 Learning: 2025-09-18T00:32:25.031Z
Learnt from: PPsyrius
PR: vacanza/holidays#2944
File: tests/countries/test_myanmar.py:32-39
Timestamp: 2025-09-18T00:32:25.031Z
Learning: Myanmar holidays implementation uses StaticHolidays with special_public_holidays for government-declared substitutions/bridging days, not ObservedHolidayBase for weekend-to-weekday shifting. Myanmar's substituted holidays are always present and don't have observed=False functionality.
Applied to files:
holidays/countries/myanmar.py
📚 Learning: 2025-08-28T02:34:11.657Z
Learnt from: PPsyrius
PR: vacanza/holidays#2860
File: holidays/groups/eastern.py:36-36
Timestamp: 2025-08-28T02:34:11.657Z
Learning: The default estimated_label change from "%s (estimated)" to "%s" in holidays/groups/eastern.py is intentional to remove English-only fallback text from localized holiday names. Countries that need estimated labels should define them properly with localization support rather than relying on the English fallback.
Applied to files:
holidays/countries/myanmar.py
📚 Learning: 2025-06-28T10:39:19.185Z
Learnt from: KJhellico
PR: vacanza/holidays#2684
File: holidays/locale/it/LC_MESSAGES/SM.po:13-13
Timestamp: 2025-06-28T10:39:19.185Z
Learning: In the holidays project, .po file header comments use the format "# [Country] holidays." for default language files (without trailing hash) and "# [Country] holidays [locale] localization." for non-default language files (also without trailing hash).
Applied to files:
holidays/locale/th/LC_MESSAGES/MM.po
📚 Learning: 2025-06-11T18:32:25.595Z
Learnt from: ankushhKapoor
PR: vacanza/holidays#2601
File: holidays/locale/en_MN/LC_MESSAGES/MN.po:13-14
Timestamp: 2025-06-11T18:32:25.595Z
Learning: For non-default locale `.po` files, the header comment format is:
`# <Country> holidays <locale> localization.` (no trailing hash).
Applied to files:
holidays/locale/th/LC_MESSAGES/MM.po
📚 Learning: 2025-06-26T13:20:10.172Z
Learnt from: PPsyrius
PR: vacanza/holidays#2678
File: holidays/locale/th/LC_MESSAGES/US.po:30-34
Timestamp: 2025-06-26T13:20:10.172Z
Learning: In the holidays library Thai localizations, the "observed" format consistently uses "ชดเชย%s" without spaces between the Thai word and placeholder across all .po files in the codebase.
Applied to files:
holidays/locale/th/LC_MESSAGES/MM.po
📚 Learning: 2025-03-30T18:25:07.087Z
Learnt from: KJhellico
PR: vacanza/holidays#2388
File: holidays/locale/en_CI/LC_MESSAGES/CI.po:88-88
Timestamp: 2025-03-30T18:25:07.087Z
Learning: In the holidays library, localization files have a specific structure: message comments are in standard English (en_US) describing the holiday, while actual translations (msgstr) should use the locale-specific terminology (e.g., en_CI for Ivory Coast English). For example, "Night of Power" in standard English is translated as "Lailatou-Kadr" in Ivory Coast English.
Applied to files:
holidays/locale/th/LC_MESSAGES/MM.po
📚 Learning: 2025-05-06T15:25:44.333Z
Learnt from: KJhellico
PR: vacanza/holidays#2530
File: holidays/locale/ca/LC_MESSAGES/AD.po:31-40
Timestamp: 2025-05-06T15:25:44.333Z
Learning: In the Holidays project, msgid fields in localization files contain strings in the entity's default language (as defined by default_language attribute), not English source strings as in standard gettext implementations.
Applied to files:
holidays/locale/th/LC_MESSAGES/MM.po
🧬 Code graph analysis (1)
tests/countries/test_myanmar.py (1)
tests/common.py (3)
assertHolidayName
(198-202)assertNoHolidayName
(305-307)assertLocalizedHolidays
(359-370)
⏰ Context from checks skipped due to timeout of 300000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Build distribution
- GitHub Check: Test docs build
🔇 Additional comments (5)
README.md (1)
1175-1176
: LGTM: Myanmar adds Thai to Supported Languages.Docs accurately reflect the new
th
l10n.holidays/locale/th/LC_MESSAGES/MM.po (2)
13-14
: Header format is correct.Conforms to established comment style for non-default locales.
30-34
: Estimated label translation looks good.Keeps semantics and formatting with c-format.
tests/countries/test_myanmar.py (1)
81-88
: Variable rename is clearer.The 1948/1955 split is explicit now.
holidays/countries/myanmar.py (1)
53-53
: Approve adding Thai ('th') locale
Locale file for 'th' confirmed and tests cover it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Proposed change
Add Thai (
th
) l10n support for Myanmar holidays.The final ASEAN country to be implemented now also has
th
l10n support. 🎉Type of change
holidays
functionality in general)Checklist
make check
locally; all checks and tests passed.