Skip to content

[PM-26293] tool: Add scripts to delete duplicate Localizable.strings entries#2412

Merged
KatherineInCode merged 17 commits intomainfrom
pm-26293/delete-unused-strings
Apr 9, 2026
Merged

[PM-26293] tool: Add scripts to delete duplicate Localizable.strings entries#2412
KatherineInCode merged 17 commits intomainfrom
pm-26293/delete-unused-strings

Conversation

@KatherineInCode
Copy link
Copy Markdown
Contributor

@KatherineInCode KatherineInCode commented Mar 6, 2026

🎟️ Tracking

https://bitwarden.atlassian.net/browse/PM-26293

📔 Objective

This is inspired by, and solves, the issue brought up in #2004, in addition to making it easier to avoid that same sort of issue in the future.

This introduces a modular python script that can be used to "fix" our Localizable.strings files; long-term, it may make sense to run this as a pre-commit hook as well. Currently, the one module introduced handles duplicate entries in the strings files; I intend in a future PR to include a module for unused entries, and then potentially a module for alphabetization, among other things. These all live under the Scripts/fix-localizable-strings directory.

As well, there is a Scripts/fix-localizable-strings.sh script that invokes the Python script against the various localizable files. As the modules expand, it can also handle doing those. This would be what the pre-commit hook would run.

Finally, there is a Scripts/test-fix-localizable-strings.sh that is an easy invocation of running the tests for the fix-localizable-strings Python script (which currently just tests the duplication work. In the future, we may consider adding the running of these to CI.

One last thing: one of the duplicated strings ("SendUpdated") had two different strings for the key. I ended up choosing the one that matches what I could find in Figma.

@KatherineInCode KatherineInCode added the ai-review Request a Claude code review label Mar 6, 2026
@github-actions github-actions bot added app:password-manager Bitwarden Password Manager app context app:authenticator Bitwarden Authenticator app context t:ci Change Type - Updates to automated workflows t:feature labels Mar 6, 2026
@claude
Copy link
Copy Markdown

claude bot commented Mar 6, 2026

Claude finished @KatherineInCode's task in 3m 8s —— View job


Re-review: PM-26293 Add scripts to delete duplicate localizable.strings entries

  • Scope to incremental changes since last review (276d137)
  • Verify prior findings are addressed
  • Check for new issues in changed code

Incremental Changes (commits d94fe47, 3d547b8, 43c2ae6, fdf096d)

These four commits address all prior review feedback:

Commit Change Assessment
43c2ae67f Block comment detection changed from "/*" in stripped to stripped.startswith("/*") Correctly fixes the prior WARNING finding. Entry lines always start with " after stripping, so startswith("/*") cleanly excludes them without needing the reorder approach originally suggested.
3d547b83b Added TestDeduplicateEntryValueContainingCommentSyntax with two tests Directly covers the edge case from the prior finding (/* in values, */ in later values).
fdf096db9 Docstrings to Google-style, type annotations on _pluralize/cmd_delete_duplicates, sys.exit(1) on missing subcommand All improvements: Python-conventional docstrings, better type safety, correct CLI exit behavior.
d94fe47e3 .gitignore comment clarifying source URL Documentation-only.

Prior Findings Status

Finding Status
WARNING: "/*" in stripped misidentifies entry values as block comments Resolved -- fixed via startswith("/*") with regression tests added

Verdict

No new issues found. All prior feedback has been addressed cleanly. The PR is in good shape.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 6, 2026

Logo
Checkmarx One – Scan Summary & Detailse6197ff4-bbce-4c50-bfa1-ad57b03a70b4

Great job! No new security vulnerabilities introduced in this pull request

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.95%. Comparing base (a83e8f1) to head (c7e36b6).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2412      +/-   ##
==========================================
- Coverage   87.08%   85.95%   -1.13%     
==========================================
  Files        1862     2092     +230     
  Lines      165404   180212   +14808     
==========================================
+ Hits       144040   154900   +10860     
- Misses      21364    25312    +3948     

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

@KatherineInCode KatherineInCode marked this pull request as ready for review March 6, 2026 18:44
@KatherineInCode KatherineInCode requested review from a team and matt-livefront as code owners March 6, 2026 18:44
@KatherineInCode KatherineInCode changed the title [PM-26293] tool: Add scripts to delete duplicate localizable.strings entries [PM-26293] chore: Add scripts to delete duplicate localizable.strings entries Mar 6, 2026
@KatherineInCode KatherineInCode added t:feature-tool Change Type - Internal tool feature or enhancement and removed t:ci Change Type - Updates to automated workflows t:feature labels Mar 6, 2026
@KatherineInCode KatherineInCode changed the title [PM-26293] chore: Add scripts to delete duplicate localizable.strings entries [PM-26293] tool: Add scripts to delete duplicate localizable.strings entries Mar 6, 2026
@KatherineInCode KatherineInCode changed the title [PM-26293] tool: Add scripts to delete duplicate localizable.strings entries [PM-26293] tool: Add scripts to delete duplicate Localizable.strings entries Mar 26, 2026
@KatherineInCode KatherineInCode added the innovation Feature work related to Innovation Sprint or BEEEP projects label Mar 31, 2026
Comment on lines +1 to +2
#!/usr/bin/env bash
set -euo pipefail
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

🎨 Is it worth documenting at the top of the file here what this script does? I've found that to be helpful when looking at other scripts that we have.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good call. Updated.

Comment on lines +1 to +2
#!/usr/bin/env bash
set -euo pipefail
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

🎨 Same thing here, worth documenting what this does?

@github-actions github-actions bot added t:ci Change Type - Updates to automated workflows t:feature and removed t:feature-tool Change Type - Internal tool feature or enhancement labels Apr 8, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 2026

Bitwarden Claude Code Review

Overall Assessment: APPROVE

This PR adds a modular Python script for removing duplicate entries from Localizable.strings files, shell wrappers for execution and testing, and applies the deduplication to the English Localizable.strings file (removing 5 duplicates and correcting the SendUpdated value to match Figma). The latest commits add header comments to the shell scripts, addressing reviewer feedback. Test coverage is thorough with 368 lines across 8 test classes.

Code Review Details

No findings. Prior review feedback has been fully addressed:

Prior Finding Status
WARNING: "/*" in stripped misidentifies entry values as block comments Resolved via startswith("/*") with regression tests added

@KatherineInCode KatherineInCode merged commit c342e82 into main Apr 9, 2026
19 of 20 checks passed
@KatherineInCode KatherineInCode deleted the pm-26293/delete-unused-strings branch April 9, 2026 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-review Request a Claude code review app:authenticator Bitwarden Authenticator app context app:password-manager Bitwarden Password Manager app context innovation Feature work related to Innovation Sprint or BEEEP projects t:ci Change Type - Updates to automated workflows t:feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants