8000 Update Bermuda holidays: add l10n support by kritibirda26 · Pull Request #2589 · vacanza/holidays · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Update Bermuda holidays: add l10n support #2589

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

Merged
merged 5 commits into from
Jun 8, 2025
Merged

Conversation

kritibirda26
Copy link
Collaborator

Proposed change

Localize Bermuda holidays.

#2412

Type of change

  • New country/market holidays support (thank you!)
  • 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

Copy link
Contributor
coderabbitai bot commented Jun 3, 2025

Summary by CodeRabbit

  • New Features
    • Added support for localized holiday names for Bermuda in both Bermuda English (en_BM) and US English (en_US).
  • Documentation
    • Updated the documentation to list supported languages for Bermuda.
  • Tests
    • Introduced new tests to verify correct localization of Bermuda holiday names in both supported languages.

Summary by CodeRabbit

  • New Features

    • Added localization support for Bermuda holidays, including support for "en_BM" and "en_US" languages.
    • Holiday names and labels for Bermuda are now available in both Bermuda English and US English.
  • Documentation

    • Updated the README to list supported languages for Bermuda in the "Available Countries" table.
  • Tests

    • Added tests to verify correct localization of Bermuda holiday names in both supported languages.

Walkthrough

This update introduces localization support for Bermuda holidays. It adds translation infrastructure, language metadata, and localized holiday name files for both Bermuda and US English. The Bermuda module is updated to use translation functions, and new tests verify correct localization in both supported languages.

Changes

Files/Paths Change Summary
README.md Added supported languages ("en_BM", "en_US") for Bermuda in the countries table.
holidays/countries/bermuda.py Enabled translation for holiday names, added language metadata, and updated observed label for l10n.
holidays/locale/en_BM/LC_MESSAGES/BM.po Added new localization file with message IDs for Bermuda holidays (translations currently empty).
holidays/locale/en_US/LC_MESSAGES/BM.po Added new localization file with US English translations for Bermuda holidays.
tests/countries/test_bermuda.py Added tests for default and en_US holiday name localization for Bermuda in 2024.

Possibly related PRs

  • Add Bermuda holidays #2571: Introduced Bermuda holiday definitions, which this PR extends by adding localization and language support.

Suggested reviewers

  • KJhellico
  • PPsyrius

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 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.

Copy link
codecov bot commented Jun 3, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (0fd7a13) to head (7f44e23).
Report is 2 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff            @@
##               dev     #2589   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          229       229           
  Lines        14568     14571    +3     
  Branches      2039      2039           
=========================================
+ Hits         14568     14571    +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor
@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3c97695 and 14ab74b.

📒 Files selected for processing (5)
  • README.md (1 hunks)
  • holidays/countries/bermuda.py (5 hunks)
  • holidays/locale/en_BM/LC_MESSAGES/BM.po (1 hunks)
  • holidays/locale/en_US/LC_MESSAGES/BM.po (1 hunks)
  • tests/countries/test_bermuda.py (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (2)
holidays/countries/bermuda.py (2)
holidays/groups/international.py (2)
  • _add_new_years_day (126-134)
  • _add_remembrance_day (166-174)
holidays/groups/christian.py (3)
  • _add_good_friday (308-317)
  • _add_christmas_day (208-216)
  • _add_christmas_day_two (218-226)
tests/countries/test_bermuda.py (1)
tests/common.py (1)
  • assertLocalizedHolidays (327-338)
🪛 Pylint (3.3.7)
tests/countries/test_bermuda.py

[convention] 241-241: Missing function or method docstring

(C0116)


[convention] 255-255: Missing function or method docstring

(C0116)

⏰ Context from checks skipped due to timeout of 300000ms (1)
  • GitHub Check: Test build on windows-latest
🔇 Additional comments (15)
README.md (1)

307-307: Looks good!

The documentation update correctly reflects the new localization support for Bermuda, with en_BM properly marked as the default language.

holidays/locale/en_BM/LC_MESSAGES/BM.po (1)

1-99: Well-structured localization file.

The en_BM locale file is properly formatted with appropriate empty translations since this is the default locale. The metadata headers are complete and all Bermuda holidays are included.

holidays/locale/en_US/LC_MESSAGES/BM.po (2)

70-72: Excellent localization of Labour Day.

The translation correctly adapts "Labour Day" to the US English spelling "Labor Day" - this is the key cultural difference between the two locales.


1-99: Complete and accurate US English localization.

The en_US locale file provides proper translations for all Bermuda holidays with appropriate US English conventions. The file structure and metadata are well-formatted.

holidays/countries/bermuda.py (11)

13-13: Clean i18n import implementation.

Good use of the standard gettext.gettext as tr pattern for internationalization.


39-42: Well-configured language support.

The choice of en_BM as default with en_US support makes perfect sense for Bermuda. The localized observed_label ensures complete translation coverage.


54-54: Proper localization of New Year's Day.

Clean application of translation function to the holiday name.


57-57: Consistent localization pattern applied.

Good Friday properly wrapped for translation.


60-60: Proper localization of country-specific holidays.

Both Bermuda Day and Queen's Birthday are correctly wrapped for translation while maintaining the year-based logic.

Also applies to: 71-71


78-78: Comprehensive localization of conditional holidays.

Excellent handling of the year-dependent holiday names - both "Cup Match Day" and "Emancipation Day" are properly wrapped for translation.

Also applies to: 86-86, 89-89


94-94: Proper handling of evolving holiday names.

Both "Somers Day" and "Mary Prince Day" are correctly localized for the year-based transition.

Also applies to: 97-97


101-101: Thoughtful localization of Labour Day.

Good choice using "Labour Day" (British spelling) as the source string - this enables proper localization to American spelling in en_US locale.


104-104: Proper Remembrance Day localization.

Translation function correctly applied.


107-109: Clean Christmas holidays localization.

Both Christmas Day and Boxing Day are properly wrapped for translation while maintaining readable code formatting.

Also applies to: 112-114


143-143: Complete localization of special holidays.

Excellent coverage - all special holidays including the recent additions like Flora Duffy Day and the King's Coronation are properly wrapped for translation.

Also applies to: 145-145, 147-147, 149-149

Copy link
Collaborator
@arkid15r arkid15r left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 👍

Copy link
Contributor
@coderabbitai coderabbitai bot left a 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

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 14ab74b and 3735335.

📒 Files selected for processing (3)
  • holidays/countries/bermuda.py (5 hunks)
  • holidays/locale/en_BM/LC_MESSAGES/BM.po (1 hunks)
  • holidays/locale/en_US/LC_MESSAGES/BM.po (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
holidays/locale/en_BM/LC_MESSAGES/BM.po (1)
Learnt from: PPsyrius
PR: vacanza/holidays#2437
File: holidays/locale/dz_BT/LC_MESSAGES/BT.po:0-0
Timestamp: 2025-04-06T14:52:35.679Z
Learning: When suggesting changes to .po files in the holidays project, follow the standardized header format:
- Default language format: "# [COUNTRY-NAME-NORMAL] holidays. #"
- Non-default language format: "# [COUNTRY-NAME-NORMAL] holidays [LANGUAGE-CODE] localization. #"
For example, for Bhutan in Dzongkha, use "# Bhutan holidays dz_BT localization. #"
🧬 Code Graph Analysis (1)
holidays/countries/bermuda.py (2)
holidays/groups/international.py (2)
  • _add_new_years_day (126-134)
  • _add_remembrance_day (166-174)
holidays/groups/christian.py (3)
  • _add_good_friday (308-317)
  • _add_christmas_day (208-216)
  • _add_christmas_day_two (218-226)
🔇 Additional comments (13)
holidays/locale/en_US/LC_MESSAGES/BM.po (1)

13-32: Localization file looks good.
The header follows the project’s PO file format, and the translations accurately reflect US English conventions (e.g., “Labor Day”).

holidays/countries/bermuda.py (12)

13-43: Correctly configured i18n attributes.
Importing gettext.gettext as tr, setting default_language = "en_BM" with supported_languages = ("en_BM", "en_US"), and wrapping the observed_label in tr() all align perfectly with the new localization framework.

🧰 Tools
🪛 Pylint (3.3.7)

[convention] 28-28: Line too long (167/100)

(C0301)


[convention] 29-29: Line too long (188/100)

(C0301)


[convention] 30-30: Line too long (188/100)

(C0301)


[convention] 31-31: Line too long (212/100)

(C0301)


[convention] 32-32: Line too long (188/100)

(C0301)


[convention] 33-33: Line too long (188/100)

(C0301)


[convention] 34-34: Line too long (112/100)

(C0301)


[convention] 35-35: Line too long (208/100)

(C0301)


54-58: Translate fixed-date Christian holidays.
The calls to tr("New Year's Day") and tr("Good Friday") ensure those entries are now localized without altering existing logic.


60-68: Translate Bermuda Day correctly.
Wrapping "Bermuda Day" in tr() preserves the multi-branch date logic and enables localization.


71-76: Translate Queen’s Birthday.
Applying tr("Queen's Birthday") maintains the original conditionals and hooks into the PO files for localization.


78-83: Translate National Heroes Day.
tr("National Heroes Day") is applied consistently across both branches, without impacting the date rules.


84-91: Localize Cup Match / Emancipation Day.
The inline conditional now uses tr("Cup Match Day") and tr("Emancipation Day"), enabling proper translation while retaining the 4-day offset logic.


92-99: Localize Somers Day / Mary Prince Day.
Your conditional expression correctly calls tr("Somers Day") or tr("Mary Prince Day") based on the year, with no logic changes.


100-102: Translate Labour Day.
Wrapping "Labour Day" in tr() slots seamlessly into the Portuguese-style spelling for the default locale.


103-105: Translate Remembrance Day.
tr("Remembrance Day") is correctly applied inside the observed wrapper, preserving the SAT/SUN rule.


106-110: Translate Christmas Day observed.
The tr("Christmas Day") call within _add_observed and the SAT_SUN_TO_NEXT_MON_TUE rule are both intact and localized.


112-116: Translate Boxing Day observed.
tr("Boxing Day") is correctly used alongside the second Christmas-Day function and the same observed-rule.


143-152: Localize special public holidays.
All entries in special_public_holidays now call tr(), including "Public Holiday", "Portuguese Welcome 170th Anniversary", "Flora Duffy Day", and the coronation holiday.

@KJhellico KJhellico changed the title Localize Bermuda holidays Update Bermuda holidays: add l10n support Jun 3, 2025
@kritibirda26 kritibirda26 deleted the bermuda branch June 8, 2025 08:20
@KJhellico
Copy link
Collaborator

Why did you remove the branch? 🙄

@kritibirda26
Copy link
Collaborator Author

Oh sorry, my bad. I deleted it by mistake.

@kritibirda26 kritibirda26 restored the bermuda branch June 8, 2025 14:37
@kritibirda26 kritibirda26 reopened this Jun 8, 2025
@KJhellico
Copy link
Collaborator

Then apply bot's suggestion, merge latest changes and all seems to be ready. :)

Copy link
sonarqubecloud bot commented Jun 8, 2025

Copy link
Contributor
@coderabbitai coderabbitai bot left a 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

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3735335 and 7f44e23.

📒 Files selected for processing (2)
  • README.md (1 hunks)
  • holidays/locale/en_BM/LC_MESSAGES/BM.po (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
holidays/locale/en_BM/LC_MESSAGES/BM.po (2)
Learnt from: PPsyrius
PR: vacanza/holidays#2437
File: holidays/locale/dz_BT/LC_MESSAGES/BT.po:0-0
Timestamp: 2025-04-06T14:52:35.679Z
Learning: When suggesting changes to .po files in the holidays project, follow the standardized header format:
- Default language format: "# [COUNTRY-NAME-NORMAL] holidays. #"
- Non-default language format: "# [COUNTRY-NAME-NORMAL] holidays [LANGUAGE-CODE] localization. #"
For example, for Bhutan in Dzongkha, use "# Bhutan holidays dz_BT localization. #"
Learnt from: PPsyrius
PR: vacanza/holidays#2437
File: holidays/locale/dz_BT/LC_MESSAGES/BT.po:12-12
Timestamp: 2025-04-06T14:44:59.785Z
Learning: Use standardized .po file headers for localization files in the holidays project:
- Default language format: "# [COUNTRY-NAME-NORMAL] holidays. #"
- Other languages format: "# [COUNTRY-NAME-NORMAL] holidays [LANGUAGE-CODE] localization. #"
⏰ Context from checks skipped due to timeout of 300000ms (8)
  • GitHub Check: Test Python 3.9 on ubuntu-latest
  • GitHub Check: Test Python 3.9 on windows-latest
  • GitHub Check: Test Python 3.13 on ubuntu-latest
  • GitHub Check: Test Python 3.12 on windows-latest
  • GitHub Check: Test Python 3.11 on windows-latest
  • GitHub Check: Test Python 3.10 on windows-latest
  • GitHub Check: Test Python 3.13 on windows-latest
  • GitHub Check: CodeQL
🔇 Additional comments (2)
holidays/locale/en_BM/LC_MESSAGES/BM.po (1)

1-14: PO header follows default-locale convention
The header correctly omits the language code for the default locale (en_BM), matching project guidelines.

README.md (1)

304-308: Supported languages row for Bermuda is correct
The table now lists the default (en_BM) in bold and the fallback (en_US), consistent with other entries.

Copy link
Collaborator
@KJhellico KJhellico left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 👍

@arkid15r arkid15r added this pull request to the merge queue Jun 8, 2025
Copy link
Collaborator
@arkid15r arkid15r left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kritibirda26 thanks for adding this!

Merged via the queue into vacanza:dev with commit e79dbba Jun 8, 2025
33 checks passed
@kritibirda26 kritibirda26 deleted the bermuda branch June 8, 2025 20:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0