python-holidays icon indicating copy to clipboard operation
python-holidays copied to clipboard

Update United States holidays: add `th` l10n

Open PPsyrius opened this issue 6 months ago • 3 comments

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 holidays functionality in general)

Checklist

  • [x] I've followed the contributing guidelines
  • [x] I've successfully run make check, all checks and tests are green

PPsyrius avatar Jun 25 '25 10:06 PPsyrius

[!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_language and supported_languages attributes 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.

❤️ Share
🪧 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 @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in 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 pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai auto-generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere 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.

coderabbitai[bot] avatar Jun 25 '25 10:06 coderabbitai[bot]

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.

codecov[bot] avatar Jun 25 '25 10:06 codecov[bot]