-
-
Notifications
You must be signed in to change notification settings - Fork 539
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
Conversation
Summary by CodeRabbit
Summary by CodeRabbit
WalkthroughThis 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
Possibly related PRs
Suggested reviewers
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed 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)
Other keywords and placeholders
Documentation and Community
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
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. 🚀 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: 2
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 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 withen_US
support makes perfect sense for Bermuda. The localizedobserved_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
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.
Looks good 👍
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
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 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.
Importinggettext.gettext
astr
, settingdefault_language = "en_BM"
withsupported_languages = ("en_BM", "en_US")
, and wrapping theobserved_label
intr()
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 totr("New Year's Day")
andtr("Good Friday")
ensure those entries are now localized without altering existing logic.
60-68
: Translate Bermuda Day correctly.
Wrapping"Bermuda Day"
intr()
preserves the multi-branch date logic and enables localization.
71-76
: Translate Queen’s Birthday.
Applyingtr("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 usestr("Cup Match Day")
andtr("Emancipation Day")
, enabling proper translation while retaining the 4-day offset logic.
92-99
: Localize Somers Day / Mary Prince Day.
Your conditional expression correctly callstr("Somers Day")
ortr("Mary Prince Day")
based on the year, with no logic changes.
100-102
: Translate Labour Day.
Wrapping"Labour Day"
intr()
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.
Thetr("Christmas Day")
call within_add_observed
and theSAT_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 inspecial_public_holidays
now calltr()
, including"Public Holiday"
,"Portuguese Welcome 170th Anniversary"
,"Flora Duffy Day"
, and the coronation holiday.
Why did you remove the branch? 🙄 |
Oh sorry, my bad. I deleted it by mistake. |
Then apply bot's suggestion, merge latest changes and all seems to be ready. :) |
|
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
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 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.
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.
@kritibirda26 thanks for adding this!
Proposed change
Localize Bermuda holidays.
#2412
Type of change
holidays
functionality in general)Checklist
make check
, all checks and tests are green