Skip to content

Localize tab context menu and alert strings#1998

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

Localize tab context menu and alert strings#1998
anthhub wants to merge 4 commits intomanaflow-ai:mainfrom
anthhub:fix/localize-tab-context-menu

Conversation

@anthhub
Copy link
Copy Markdown
Contributor

@anthhub anthhub commented Mar 23, 2026

Summary

Test plan

  • Open tab rename dialog — verify localized title, message, placeholder, buttons
  • Open tab move dialog — verify localized title, message, options, buttons
  • Switch system language to Japanese/Chinese and verify translations display correctly

🤖 Generated with Claude Code


Summary by cubic

Localized the tab rename and move dialogs and the move-failure alert in Workspace.swift. Users now see translated titles, messages, placeholders, options, and buttons across 18 languages.

  • New Features
    • Switched alert UI to String(localized:defaultValue:) with safe fallbacks.
    • Added 13 new alert.* keys in Localizable.xcstrings.
    • Localized move destinations (“New Workspace in Current Window”, “Selected Workspace in New Window”).
    • Reused shared alert.cancel and added alert.ok across dialogs.

Written for commit 1613eeb. Summary will update on new commits.

Summary by CodeRabbit

  • Localization
    • Tab rename and move dialogs now display localized titles, messages, input placeholder and action buttons in the user's language.
    • Static move-destination options and the “Move Failed” warning are localized; workspace names generated at runtime remain shown as-is.
    • Expanded translation coverage across many locales for these dialog strings.

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 23, 2026

@anthhub is attempting to deploy a commit to the Manaflow Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link
Copy Markdown

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: 2dfe22f8-b993-4f3a-bd48-953f6fd066d4

📥 Commits

Reviewing files that changed from the base of the PR and between 146f908 and 1613eeb.

📒 Files selected for processing (2)
  • Resources/Localizable.xcstrings
  • Sources/Workspace.swift
✅ Files skipped from review due to trivial changes (2)
  • Sources/Workspace.swift
  • Resources/Localizable.xcstrings

📝 Walkthrough

Walkthrough

The pull request localizes UI strings in the rename and move alert dialogs in Sources/Workspace.swift, replacing hardcoded English literals (titles, informative text, placeholder, button labels, and two static move-option labels) with String(localized:defaultValue:) lookups and adds the corresponding keys to Resources/Localizable.xcstrings.

Changes

Cohort / File(s) Summary
Dialog Localization
Sources/Workspace.swift
Replaced hardcoded English text for rename and move NSAlert dialogs with String(localized:defaultValue:) for messageText, informativeText, input placeholder, affirmative/cancel buttons, and the first two static move-destination option labels; dynamic workspace target labels remain unchanged.
Localization Resources
Resources/Localizable.xcstrings
Added new localized string entries (multiple locales) for keys used by the dialogs: alert.cancel, alert.ok, alert.moveTab.*, alert.moveTab.failed.*, and alert.renameTab.* (titles, messages, placeholder, and action labels).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

🐰 I hopped through code and found a tune,
Words once fixed now change by rune.
Rename and move in languages many,
Little alerts, bright as any.
Hop on—localize, sweet and sunny!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: localizing hardcoded English strings in tab context menu and alert dialogs.
Description check ✅ Passed The description covers the main change with a summary and test plan, but the Testing section uses checkboxes instead of describing actual testing performed.

✏️ 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
Copy Markdown

@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 2 files

Copy link
Copy Markdown

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
Sources/Workspace.swift (1)

9222-9224: ⚠️ Potential issue | 🟠 Major

Localize the move-failure alert strings in this same flow.

Line 9222–Line 9224 still use hardcoded UI literals, so this path remains partially unlocalized.

🌐 Suggested fix
-            failure.messageText = "Move Failed"
-            failure.informativeText = "cmux could not move this tab to the selected destination."
-            failure.addButton(withTitle: "OK")
+            failure.messageText = String(
+                localized: "alert.moveTab.failed.title",
+                defaultValue: "Move Failed"
+            )
+            failure.informativeText = String(
+                localized: "alert.moveTab.failed.message",
+                defaultValue: "cmux could not move this tab to the selected destination."
+            )
+            failure.addButton(withTitle: String(
+                localized: "alert.moveTab.failed.ok",
+                defaultValue: "OK"
+            ))

As per coding guidelines: “All user-facing strings must be localized using String(localized: "key.name", defaultValue: "English text") for every string shown in the UI.”

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@Sources/Workspace.swift` around lines 9222 - 9224, The alert uses hardcoded
UI strings; replace them with localized forms using
String(localized:defaultValue:). Update the assignments to failure.messageText
and failure.informativeText to use String(localized: "move.failed.title",
defaultValue: "Move Failed") and String(localized: "move.failed.message",
defaultValue: "cmux could not move this tab to the selected destination."), and
change failure.addButton(withTitle:) to use String(localized: "ok.button",
defaultValue: "OK"); keep the same unique symbols (failure.messageText,
failure.informativeText, failure.addButton(withTitle:)) so the strings are
localized per guidelines.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@Sources/Workspace.swift`:
- Around line 9222-9224: The alert uses hardcoded UI strings; replace them with
localized forms using String(localized:defaultValue:). Update the assignments to
failure.messageText and failure.informativeText to use String(localized:
"move.failed.title", defaultValue: "Move Failed") and String(localized:
"move.failed.message", defaultValue: "cmux could not move this tab to the
selected destination."), and change failure.addButton(withTitle:) to use
String(localized: "ok.button", defaultValue: "OK"); keep the same unique symbols
(failure.messageText, failure.informativeText, failure.addButton(withTitle:)) so
the strings are localized per guidelines.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: db95cc02-9bab-463e-9b4a-94c9605b24e7

📥 Commits

Reviewing files that changed from the base of the PR and between 2aeb101 and d180e9f.

📒 Files selected for processing (2)
  • Resources/Localizable.xcstrings
  • Sources/Workspace.swift

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 23, 2026

Greptile Summary

This PR localizes previously hardcoded English strings in the tab rename and move alert dialogs in Workspace.swift, adding 10 new localization keys to Localizable.xcstrings with full 18-language coverage. The xcstrings file is also broadly refactored to expand many existing en+ja-only entries to all 18 supported languages.

  • promptRenamePanel and promptMovePanel in Workspace.swift now use String(localized:defaultValue:) for all UI strings — title, message, placeholder, and buttons — in compliance with the CLAUDE.md localization policy.
  • 10 new keys added: alert.renameTab.{title,message,placeholder,rename}, alert.moveTab.{title,message,move,newWorkspaceInCurrentWindow,selectedWorkspaceInNewWindow}, and the shared alert.cancel.
  • All new keys carry translations for all 18 supported languages (en, ja, zh-Hans, zh-Hant, ko, de, es, fr, it, da, pl, ru, bs, ar, nb, pt-BR, th, tr).
  • Keys that appear deleted in the diff (e.g. applescript.error.*, debug.*, sidebar.help.*) are confirmed still present in the new file — they were simply reordered and expanded to 18 languages.
  • The companion bonsplit PR (#34) covers the context menu item labels (TabContextAction titles), which are generated in the submodule.

Confidence Score: 5/5

  • Safe to merge — all new localization keys are correctly defined and all removed-looking keys are confirmed present after the xcstrings reorganization.
  • All 10 new localization keys used in Workspace.swift are present in xcstrings with 18-language translations and correct default values. The String(localized:defaultValue:) pattern ensures graceful fallback even in edge cases. No keys used elsewhere in the codebase were actually removed. The changes are additive and non-breaking.
  • No files require special attention.

Important Files Changed

Filename Overview
Sources/Workspace.swift Replaces hardcoded English strings in promptRenamePanel and promptMovePanel with String(localized:defaultValue:) calls; all keys are verified present in xcstrings with 18-language coverage and correct default values.
Resources/Localizable.xcstrings Adds 10 new localization keys (alert.renameTab.*, alert.moveTab.*, alert.cancel) with complete 18-language translations; also expands many existing en+ja-only keys to all 18 supported languages as a broader refactor.

Sequence Diagram

sequenceDiagram
    actor User
    participant TabBar as Tab Context Menu
    participant Workspace as Workspace.swift
    participant L10n as Localizable.xcstrings

    User->>TabBar: Right-click tab → Rename
    TabBar->>Workspace: splitTabBar(_:didRequestTabContextAction:rename)
    Workspace->>L10n: String(localized: "alert.renameTab.title")
    Workspace->>L10n: String(localized: "alert.renameTab.message")
    Workspace->>L10n: String(localized: "alert.renameTab.placeholder")
    Workspace->>L10n: String(localized: "alert.renameTab.rename")
    Workspace->>L10n: String(localized: "alert.cancel")
    Workspace->>User: NSAlert (localized)
    User-->>Workspace: Confirm rename

    User->>TabBar: Right-click tab → Move
    TabBar->>Workspace: splitTabBar(_:didRequestTabContextAction:move)
    Workspace->>L10n: String(localized: "alert.moveTab.title")
    Workspace->>L10n: String(localized: "alert.moveTab.message")
    Workspace->>L10n: String(localized: "alert.moveTab.newWorkspaceInCurrentWindow")
    Workspace->>L10n: String(localized: "alert.moveTab.selectedWorkspaceInNewWindow")
    Workspace->>L10n: String(localized: "alert.moveTab.move")
    Workspace->>L10n: String(localized: "alert.cancel")
    Workspace->>User: NSAlert with NSPopUpButton (localized)
    User-->>Workspace: Confirm move destination
Loading

Reviews (1): Last reviewed commit: "Localize tab context menu and alert stri..." | Re-trigger Greptile

@anthhub
Copy link
Copy Markdown
Contributor Author

anthhub commented Mar 25, 2026

Hi, all review feedback has been addressed and CI is passing. All 18 language localizations are covered for the tab context menu and alert strings. Could you please take a look and merge when you get a chance? Thanks!

austinywang and others added 4 commits March 27, 2026 14:09
XCUIApplication.launch() blocks ~60s then fails on headless WarpBuild
runners because foreground activation requires a GUI login session.

Apply the same pre-launch strategy used for the display resolution test:
- CI shell launches the app with env vars before running xcodebuild
- Test detects pre-launched app via manifest, uses activate() instead of
  launch() to avoid killing and relaunching the app
- Falls back to clicking the window for focus via accessibility framework

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Replace hardcoded English strings in tab rename/move alert dialogs
with String(localized:defaultValue:) calls. Add 10 new localization
keys to Localizable.xcstrings with translations for all 18 supported
languages.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Address CodeRabbit review: localize remaining hardcoded strings
in the move-failure alert dialog (Move Failed, error message, OK button).

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@anthhub anthhub force-pushed the fix/localize-tab-context-menu branch from 146f908 to 1613eeb Compare March 27, 2026 06:15
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.

2 participants