Repository navigation
Conversation
Context menus chose each entry's colour, and for some entries its icon, by reading the English label: "Delete" was red, "Push" green, "Discard" amber. A translated label would lose all of that, and a branch, remote or path whose name happened to contain such a word was coloured as if it were a command. The colour now comes from the entry's icon, or from its action where the two differ (force push, discards, pushing tags or LFS objects, creating a worktree, the explorer's Trash). The repository tab menu's Close keeps its neutral colour through a per-entry tone on the menu model. The icon comes from the entry's icon alone. Every entry the UI test suite builds looks the same as before. The branch, repository and remote pickers no longer colour their rows from branch names, paths and remote names. Extension entries keep their label-based colours until the extension API can carry a tone. Part of the translation plan, item GC-5. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EyikHLk97MikZ7pMjMWX8i
|
|
1 similar comment
|
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Sampo · project thread
Translation plan item GC-5: menus stop working out colours and icons from English labels.
What changes
view/menu_presentation.rsused to colour every context menu entry by reading its label. "Delete", "Drop" and "Remove" were red, "Push" and "Stage" green, "Pull", "Discard" and "Force" amber. Entries without an icon could also get one from words such as "Open", "Copy" or "Tag". A translated label would lose all of this.Now:
icon_tone: bin and tab-close are red, warning, down arrow and minus are amber, up arrow and plus are green). Where an action's colour differs from its icon,action_tonenames that action: force push and force-drop are red; discarding a file, folder, hunk or lines is amber; pushing tags, pushing LFS objects and creating a worktree are green; the explorer's Trash stays neutral.iconalone.ContextMenuModel::entry_tones, the same pattern asentry_tooltips. The repository picker's "Close repository" uses the same action and stays red.Behaviour changes, on purpose
remove-old-api, a repository under a folder namedPush, or a remote nameddelete-meturned red or green.extension_label_toneandextension_label_icon, and can go when the extension API carries a tone, which fits with making extension labels translatable (GC-7). Pro's menus are unaffected by this PR.How I checked nothing else moved
Before deleting the old functions I added a temporary hook (not in this diff) to
ContextMenuModel::newandcontext_menu_model. It compared the old and new presentation of every entry built while the wholegitcomet-ui-gpuilib suite ran: 52,746 entries. The first run found 398 differences across 13 labels, and I added theaction_tonearms above for them. On the final run, the only differences were the tab menu's "Close", which the renderer overrides throughentry_tones, and a test entry labelled "Action" whose action opens the worktree prompt.Verification
cargo fmt --all --checkcargo clippy --locked -p gitcomet-ui-gpui --lib --tests -- -D warningscargo test -p gitcomet-ui-gpui --lib: 4,434 passed, 25 ignored (Linux x86_64, no display). Two source-scanning tests fail when the binary is run from the repository root instead of the crate directory; both pass from the crate directory.clippy --lockedcommands in CONTRIBUTING.md (this diff only touchesgitcomet-ui-gpui), the Windows and macOS suites, and a visual check of the menus.a_host_entry_looks_the_same_whatever_its_label_says(the plan's "done when": a host entry's colour and icon don't change when its label becomes "حذف", "Löschen", "削除" or "Удалить"),actions_whose_colour_is_not_their_icons_say_so,icons_imply_their_tones, andclosing_a_tab_is_not_painted_as_destructive. The first fails if label inference comes back.AI disclosure
Written with Claude Code (Claude Opus 5.5) at the maintainer's request, as part of the translation plan. Per
AI_POLICY.md, this needs a human review before merging.Generated by Claude Code