Skip to content

Localize tab context menu items (en/ja)#34

Open
anthhub wants to merge 2 commits intomanaflow-ai:mainfrom
anthhub:fix/localize-tab-context-menu
Open

Localize tab context menu items (en/ja)#34
anthhub wants to merge 2 commits intomanaflow-ai:mainfrom
anthhub:fix/localize-tab-context-menu

Conversation

@anthhub
Copy link

@anthhub anthhub commented Mar 23, 2026

Summary

  • Replace all hardcoded English strings in the tab context menu with localizedContextButton calls that load translations from Bundle.module
  • Add 16 new localization entries in en.lproj/Localizable.strings and ja.lproj/Localizable.strings
  • Covers: Rename Tab, Remove Custom Tab Name, Close Tabs to Left/Right, Close Other Tabs, Move Tab, New Terminal/Browser Tab to Right, Reload/Duplicate Tab, Zoom Pane/Exit Zoom, Pin/Unpin Tab, Mark Tab as Read/Unread

Test plan

  • Verify tab context menu displays correctly in English
  • Switch system language to Japanese and verify all menu items show Japanese translations
  • Verify keyboard shortcuts still appear next to menu items
  • Verify disabled states (e.g., Close Tabs to Left when tab is first) still work

🤖 Generated with Claude Code


Summary by cubic

Localized the tab context menu and added English, Japanese, and Chinese (Simplified/Traditional) translations. Shortcuts and disabled states are unchanged.

  • New Features
    • Replaced context menu labels with localizedContextButton via Bundle.module.
    • Added 16 keys to en.lproj and ja.lproj; added zh-Hans.lproj and zh-Hant.lproj with matching translations.
    • Covers: Rename/Remove name, Close to left/right/others, Move, New Terminal/Browser to right, Reload/Duplicate (browser), Zoom/Exit Zoom, Pin/Unpin, Mark as Read/Unread.

Written for commit b70ba50. Summary will update on new commits.

Summary by CodeRabbit

  • Localization
    • Tab context menu labels are now localized (English, Japanese, Simplified Chinese, Traditional Chinese).
    • Menu actions display in the user’s language for rename/remove custom name, close (left/right/others), move, new terminal/browser to right, reload, duplicate, zoom/exit zoom, pin/unpin, and mark read/unread.

All hardcoded English strings in the tab context menu are now
routed through Bundle.module localizedString, with corresponding
entries in en.lproj and ja.lproj Localizable.strings.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@coderabbitai
Copy link

coderabbitai bot commented Mar 23, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5044e986-29f2-49c6-ba8b-14885620c72f

📥 Commits

Reviewing files that changed from the base of the PR and between 9a1421d and b70ba50.

📒 Files selected for processing (2)
  • Sources/Bonsplit/Resources/zh-Hans.lproj/Localizable.strings
  • Sources/Bonsplit/Resources/zh-Hant.lproj/Localizable.strings
✅ Files skipped from review due to trivial changes (2)
  • Sources/Bonsplit/Resources/zh-Hans.lproj/Localizable.strings
  • Sources/Bonsplit/Resources/zh-Hant.lproj/Localizable.strings

📝 Walkthrough

Walkthrough

Replaced hard-coded tab context menu titles with localized key-based calls in TabItemView and added corresponding English, Japanese, Simplified Chinese, and Traditional Chinese localization entries. No public API changes.

Changes

Cohort / File(s) Summary
Tab View Localization
Sources/Bonsplit/Internal/Views/TabItemView.swift
Replaced contextButton("…", action:…) usage with localizedContextButton(titleKey:defaultValue:action:) for tab context menu items (rename/remove custom name, close left/right/others, move, new terminal/browser to right, reload, duplicate, zoom/exit zoom, pin/unpin, mark as read/unread).
Localization — English
Sources/Bonsplit/Resources/en.lproj/Localizable.strings
Added new English keys and default values for the updated tab context menu titles.
Localization — Japanese
Sources/Bonsplit/Resources/ja.lproj/Localizable.strings
Added Japanese translations for the new tab context menu keys.
Localization — Chinese (Simplified)
Sources/Bonsplit/Resources/zh-Hans.lproj/Localizable.strings
Added Simplified Chinese translations for the new tab context menu keys.
Localization — Chinese (Traditional)
Sources/Bonsplit/Resources/zh-Hant.lproj/Localizable.strings
Added Traditional Chinese translations for the new tab context menu keys.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 I hopped through menus, keys in paw,

Replaced the English, now all can saw,
日本語 and 中文 join the cheer,
Context menus sing far and near,
A tiny jump for better UX here.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: localizing tab context menu items. However, it only mentions en/ja languages despite the PR also adding zh-Hans and zh-Hant localizations.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 3 files

@greptile-apps
Copy link

greptile-apps bot commented Mar 23, 2026

Greptile Summary

This PR completes the localization of the tab context menu by replacing every hardcoded English string with localizedContextButton calls that resolve translations from Bundle.module, and adds the corresponding 16 key/value pairs to both en.lproj/Localizable.strings and ja.lproj/Localizable.strings. The approach is idiomatic for a Swift Package (where Bundle.module is required instead of Bundle.main) and is consistent with the pre-existing localizedContextButton helper already used for the "Move to pane" entries.

  • All 16 new localization keys are used in TabItemView.swift, defined in en.lproj, and translated in ja.lproj — there are no missing or orphaned keys.
  • The dynamic ternary patterns (isZoomed ? "tab.contextMenu.exitZoom" : "tab.contextMenu.zoomPane") correctly pair each branch with both the right key and the right defaultValue fallback.
  • The contextButton helper takes a resolved String (not a LocalizedStringKey), so SwiftUI will not attempt a second localization pass through Bundle.main — the translation chain is correct.
  • Japanese translations are accurate and natural; no concerns with meaning or character set.

Confidence Score: 5/5

  • Safe to merge — all 16 new keys are consistent across Swift code and both locale files, and the localization plumbing is correct for a Swift Package.
  • The change is mechanical (hardcoded strings → localizedContextButton) and follows an established in-codebase pattern. Key parity is complete, fallback default values are provided for every call, and the bundle usage is correct. No logic changes were made to menu item visibility, disabled states, or keyboard shortcuts.
  • No files require special attention.

Important Files Changed

Filename Overview
Sources/Bonsplit/Internal/Views/TabItemView.swift Replaces 16 hardcoded contextButton calls with localizedContextButton calls that fetch translations from Bundle.module; the helper already existed for the "Move to pane" items so the pattern is consistent throughout.
Sources/Bonsplit/Resources/en.lproj/Localizable.strings Adds 16 new tab.contextMenu.* keys matching every key referenced in the Swift code; existing command.move* entries are unchanged and now have a descriptive comment header.
Sources/Bonsplit/Resources/ja.lproj/Localizable.strings Mirrors the English file with accurate Japanese translations for all 16 new keys; key set and ordering match en.lproj exactly.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["contextMenuContent (SwiftUI ViewBuilder)"] --> B["localizedContextButton(key, defaultValue, action)"]
    B --> C["Bundle.module.localizedString(forKey: key, value: defaultValue, table: nil)"]
    C -->|"key found in Localizable.strings"| D["Localized String\n(e.g. 'タブ名を変更…' / 'Rename Tab…')"]
    C -->|"key missing"| E["defaultValue fallback\n(e.g. 'Rename Tab…')"]
    D --> F["contextButton(resolvedTitle, action)"]
    E --> F
    F --> G{"shortcuts[action] set?"}
    G -->|"yes"| H["Button(title).keyboardShortcut(shortcut)"]
    G -->|"no"| I["Button(title)"]
Loading

Reviews (1): Last reviewed commit: "Localize tab context menu items with en/..." | Re-trigger Greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant