Update United States holidays: add `th` l10n
Proposed change
Add th l10n for the United States (this should hopefully simplifies the process for adding other l10n for US later i.e. es)
Type of change
- [ ] New country/market holidays support (thank you!)
- [x] Supported country/market holidays update (calendar discrepancy fix, localization)
- [ ] Existing code/documentation/test/process quality improvement (best practice, cleanup, refactoring, optimization)
- [ ] Dependency update (version deprecation/pin/upgrade)
- [ ] Bugfix (non-breaking change which fixes an issue)
- [ ] Breaking change (a code change causing existing functionality to break)
- [ ] New feature (new
holidaysfunctionality in general)
Checklist
- [x] I've followed the contributing guidelines
- [x] I've successfully run
make check, all checks and tests are green
[!CAUTION]
Review failed
Failed to post review comments.
Summary by CodeRabbit
-
New Features
- Added full localization support for United States holidays and all US territories, including English (en_US) and Thai (th) translations for holiday names.
- Updated holiday modules for US territories to support new language options and improved consistency.
- Expanded supported language listings for US and territories in documentation.
-
Bug Fixes
- Adjusted observed holiday data for US states and territories, removing excess observed dates and ensuring correct observed Washington's Birthday entries.
-
Documentation
- Updated documentation to reflect supported languages for US territories.
-
Tests
- Enhanced and expanded test coverage for US and territory holidays, including comprehensive localization and alias tests.
Summary by CodeRabbit
-
New Features
- Added localization support for United States and territories holidays, enabling holiday names to be displayed in English (en_US) and Thai (th).
- Introduced translation files for US, American Samoa, Guam, Northern Mariana Islands, Puerto Rico, Minor Outlying Islands, and Virgin Islands in both English and Thai.
-
Documentation
- Updated the README to list supported languages (en_US, th) for United States and related territories.
-
Tests
- Added and expanded tests to verify correct holiday name localization in English and Thai for the United States and its territories.
Walkthrough
This update introduces localization support for United States and related territories' holidays, adding English and Thai translations. It modifies holiday classes to support internationalization, adds translation resource files, updates documentation to reflect supported languages, and expands tests to verify localized holiday names for both default and Thai locales.
Changes
| Files/Groups | Change Summary |
|---|---|
README.md |
Updated "Supported Languages" for US territories to explicitly list "en_US" and "th". |
holidays/countries/american_samoa.py, guam.py, northern_mariana_islands.py, puerto_rico.py, united_states_minor_outlying_islands.py, united_states_virgin_islands.py |
Changed base class from US to UnitedStates, added parent_entity and start_year attributes, rotated alias class names. |
holidays/countries/united_states.py |
Wrapped all holiday names in translation calls, added default_language and supported_languages attributes, introduced UnitedStatesStaticHolidays class, updated comments. |
holidays/locale/en_US/LC_MESSAGES/AS.po, GU.po, MP.po, PR.po, UM.po, VI.po |
Added new English (en_US) translation template files for US territories. |
holidays/locale/en_US/LC_MESSAGES/US.po |
Added comprehensive English translation template for US holidays. |
holidays/locale/th/LC_MESSAGES/AS.po, GU.po, MP.po, PR.po, UM.po, VI.po |
Added new Thai (th) translation template files for US territories. |
holidays/locale/th/LC_MESSAGES/US.po |
Added full Thai translation file for US holidays. |
tests/countries/test_american_samoa.py, test_guam.py, test_northern_mariana_islands.py, test_puerto_rico.py, test_united_states.py, test_united_states_minor_outlying_islands.py, test_united_states_virgin_islands.py |
Added tests for default and Thai localization of holiday names; extended year ranges; added alias and no-holiday year tests; reorganized some test methods. |
Possibly related PRs
- vacanza/holidays#2297: Related as both modify US and territories holiday modules, with this PR adding localization and the other adding government holiday categories and methods.
- vacanza/holidays#2520: Related due to changes in subdivision alias handling in US territories modules.
- vacanza/holidays#2649: Related concerning management of
default_languageandsupported_languagesattributes in holiday classes.
Suggested reviewers
- KJhellico
- arkid15r
✨ Finishing Touches
- [ ] 📝 Generate Docstrings
🧪 Generate Unit Tests
- [ ] Create PR with Unit Tests
- [ ] Post Copyable Unit Tests in Comment
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.
🪧 Tips
Chat
There are 3 ways to chat with CodeRabbit:
- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
-
I pushed a fix in commit <commit_id>, please review it. -
Explain this complex logic. -
Open a follow-up GitHub issue for this discussion.
-
- Files and specific lines of code (under the "Files changed" tab): Tag
@coderabbitaiin a new review comment at the desired location with your query. Examples:-
@coderabbitai explain this code block. -
@coderabbitai modularize this function.
-
- PR comments: Tag
@coderabbitaiin a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:-
@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase. -
@coderabbitai read src/utils.ts and explain its main purpose. -
@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format. -
@coderabbitai help me debug CodeRabbit configuration file.
-
Support
Need help? Create a ticket on our support page for assistance with any issues or questions.
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.
CodeRabbit Commands (Invoked using PR comments)
-
@coderabbitai pauseto pause the reviews on a PR. -
@coderabbitai resumeto resume the paused reviews. -
@coderabbitai reviewto trigger an incremental review. This is useful when automatic reviews are disabled for the repository. -
@coderabbitai full reviewto do a full review from scratch and review all the files again. -
@coderabbitai summaryto regenerate the summary of the PR. -
@coderabbitai generate docstringsto generate docstrings for this PR. -
@coderabbitai generate sequence diagramto generate a sequence diagram of the changes in this PR. -
@coderabbitai auto-generate unit teststo generate unit tests for this PR. -
@coderabbitai resolveresolve all the CodeRabbit review comments. -
@coderabbitai configurationto show the current CodeRabbit configuration for the repository. -
@coderabbitai helpto get help.
Other keywords and placeholders
- Add
@coderabbitai ignoreanywhere in the PR description to prevent this PR from being reviewed. - Add
@coderabbitai summaryto generate the high-level summary at a specific location in the PR description. - Add
@coderabbitaianywhere in the PR title to generate the title automatically.
Documentation and Community
- Visit our Documentation for detailed information on how to use CodeRabbit.
- Join our Discord Community to get help, request features, and share feedback.
- Follow us on X/Twitter for updates and announcements.
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 100.00%. Comparing base (
2a8c80d) to head (27fb8ee). Report is 2 commits behind head on dev.
Additional details and impacted files
@@ Coverage Diff @@
## dev #2678 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 251 251
Lines 15272 15305 +33
Branches 2092 2095 +3
=========================================
+ Hits 15272 15305 +33
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
Quality Gate passed
Issues
17 New issues
0 Accepted issues
Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code