Skip to content

Localize tab context menu and alert strings#2422

Merged
lawrencecchen merged 5 commits intomainfrom
fix/localize-tab-context-menu-resolved
Mar 31, 2026
Merged

Localize tab context menu and alert strings#2422
lawrencecchen merged 5 commits intomainfrom
fix/localize-tab-context-menu-resolved

Conversation

@lawrencecchen
Copy link
Copy Markdown
Contributor

@lawrencecchen lawrencecchen commented Mar 31, 2026

Resolves merge conflicts from #1998 by @anthhub and merges with current main.

Original PR: #1998

Localizes all tab context menu items (Close, Rename, Move to Workspace, Open in New Window) and move/rename alert strings. Adds 13 new localization keys with translations for 13+ languages.


Summary by cubic

Localized the tab context menu and tab rename/move dialogs by replacing hardcoded strings with String(localized:defaultValue:). Adds 13 new keys to Resources/Localizable.xcstrings with translations across all supported languages, including move-failure alerts and workspace destination options.

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

Summary by CodeRabbit

  • New Features
    • Added support for 18 languages including Japanese, Chinese, Korean, German, Spanish, French, Italian, Arabic, Polish, Russian, and more for alert dialogs and tab management features.

austinywang and others added 5 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 <noreply@anthropic.com>
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) <noreply@anthropic.com>
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) <noreply@anthropic.com>
…menu

# Conflicts:
#	Resources/Localizable.xcstrings
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 31, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
cmux Ready Ready Preview, Comment Mar 31, 2026 11:18am

@lawrencecchen lawrencecchen merged commit 02e5ef9 into main Mar 31, 2026
11 of 13 checks passed
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 31, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8ab26415-bbd3-4a0f-a664-979b3a2eae8b

📥 Commits

Reviewing files that changed from the base of the PR and between cfac18b and 5663642.

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

📝 Walkthrough

Walkthrough

This pull request adds comprehensive localization support for tab management UI alerts and related prompts across multiple languages, updating the Localizable.xcstrings file with new string keys and wiring those keys into Workspace.swift alert dialogs.

Changes

Cohort / File(s) Summary
Localization Strings
Resources/Localizable.xcstrings
Added 1,469 lines of new localized string entries for alert dialogs (alert.cancel, alert.moveTab.*, alert.renameTab.*) with translations across 18 languages including English, Japanese, Chinese (Simplified & Traditional), Korean, German, Spanish, French, Italian, and others.
Alert Dialog Localization
Sources/Workspace.swift
Updated tab rename and move alert dialogs to use localized string keys with fallback defaults instead of hardcoded English text; wired new localization keys to UI button labels and alert messages without altering control flow logic.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Poem

🐰 Strings now flutter in many tongues,
From English to Thai, the work is done,
Alerts dressed in silk of sixteen lands,
A world of words now in our hands!

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/localize-tab-context-menu-resolved

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

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 31, 2026

Greptile Summary

This PR resolves merge conflicts from #1998 and lands the alert-dialog localization for tab rename and tab move operations in Workspace.swift. Thirteen hard-coded English strings are replaced with String(localized:defaultValue:) calls, and 13 corresponding keys (with translations for 18 locales) are added to Localizable.xcstrings.

Key changes:

  • promptRenamePanel: title, message, placeholder, Rename button, and Cancel button are now localized.
  • promptMovePanel: title, message, destination option strings, Move button, and Cancel button are now localized; the failure alert is also localized.
  • Two shared utility keys (alert.cancel, alert.ok) are introduced for button labels reused across dialogs.
  • All 13 call-site keys have exact matches in Localizable.xcstrings and default values that match the English translations — no missing or mismatched keys.
  • One P2 style note: the new keys use an alert.* prefix while the adjacent confirmClosePanel dialog already uses a dialog.* prefix (e.g. dialog.closeTab.cancel), creating a mild namespace inconsistency worth harmonizing in a follow-up.

Confidence Score: 5/5

Safe to merge — all 13 localization keys are correctly wired between Workspace.swift and Localizable.xcstrings, no logic changes, no missing or mismatched keys.

All call-site keys have exact matches in xcstrings with correct default values. No logic is changed; only string literals are replaced with localized lookups. The single finding is a P2 naming-convention inconsistency (alert.* vs the pre-existing dialog.* prefix) that has no runtime impact.

No files require special attention.

Important Files Changed

Filename Overview
Sources/Workspace.swift Replaces 13 hard-coded English alert-dialog strings (rename tab, move tab, move failed) with String(localized:defaultValue:) calls matching the newly added xcstrings keys; logic is unchanged.
Resources/Localizable.xcstrings Adds 13 new localization keys (alert.cancel, alert.ok, alert.moveTab., alert.renameTab.) with translations for 18 locales; all keys match the call sites in Workspace.swift.

Sequence Diagram

sequenceDiagram
    participant User
    participant ContextMenu as Tab Context Menu
    participant Workspace as Workspace.swift
    participant Localizable as Localizable.xcstrings

    User->>ContextMenu: Right-click tab → Rename
    ContextMenu->>Workspace: promptRenamePanel(tabId:)
    Workspace->>Localizable: String(localized: "alert.renameTab.title")
    Workspace->>Localizable: String(localized: "alert.renameTab.message")
    Workspace->>Localizable: String(localized: "alert.renameTab.placeholder")
    Workspace->>Localizable: String(localized: "alert.renameTab.rename")
    Workspace->>Localizable: String(localized: "alert.cancel")
    Workspace-->>User: NSAlert (localized)

    User->>ContextMenu: Right-click tab → Move to Workspace
    ContextMenu->>Workspace: promptMovePanel(tabId:)
    Workspace->>Localizable: String(localized: "alert.moveTab.title")
    Workspace->>Localizable: String(localized: "alert.moveTab.message")
    Workspace->>Localizable: String(localized: "alert.moveTab.newWorkspaceInCurrentWindow")
    Workspace->>Localizable: String(localized: "alert.moveTab.selectedWorkspaceInNewWindow")
    Workspace->>Localizable: String(localized: "alert.moveTab.move")
    Workspace->>Localizable: String(localized: "alert.cancel")
    Workspace-->>User: NSAlert with NSPopUpButton (localized)
    User->>Workspace: Confirm Move
    alt Move fails
        Workspace->>Localizable: String(localized: "alert.moveTab.failed.title")
        Workspace->>Localizable: String(localized: "alert.moveTab.failed.message")
        Workspace->>Localizable: String(localized: "alert.ok")
        Workspace-->>User: Failure NSAlert (localized)
    end
Loading

Reviews (1): Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." | Re-trigger Greptile

Comment on lines +9700 to +9708
alert.messageText = String(localized: "alert.renameTab.title", defaultValue: "Rename Tab")
alert.informativeText = String(localized: "alert.renameTab.message", defaultValue: "Enter a custom name for this tab.")
let currentTitle = panelCustomTitles[panelId] ?? panelTitles[panelId] ?? panel.displayTitle
let input = NSTextField(string: currentTitle)
input.placeholderString = "Tab name"
input.placeholderString = String(localized: "alert.renameTab.placeholder", defaultValue: "Tab name")
input.frame = NSRect(x: 0, y: 0, width: 240, height: 22)
alert.accessoryView = input
alert.addButton(withTitle: "Rename")
alert.addButton(withTitle: "Cancel")
alert.addButton(withTitle: String(localized: "alert.renameTab.rename", defaultValue: "Rename"))
alert.addButton(withTitle: String(localized: "alert.cancel", defaultValue: "Cancel"))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Inconsistent key prefix convention (alert.* vs dialog.*)

The adjacent confirmClosePanel dialog already uses the dialog.closeTab.* prefix (e.g. dialog.closeTab.cancel, dialog.closeTab.close). This PR introduces a parallel alert.* namespace for the rename/move dialogs. The two families now coexist and both translate "Cancel" (alert.cancel vs dialog.closeTab.cancel), which makes it harder for translators to know which key to update when UI copy changes.

Consider using the dialog.* prefix here as well (e.g. dialog.renameTab.*, dialog.moveTab.*) to keep the namespace consistent, or document the intended distinction between alert.* and dialog.* in a comment.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

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.

3 participants