Describe the operation in progress with a translated phrase

The texts for aborting or continuing a merge, rebase, cherry-pick or
revert insert the git command name into the sentence, as in "Abort the
rebase". We are going to support "git am" next, and "Abort the am"
makes no sense.

Give each operation a translated phrase like "the rebase" instead, and
use it as a placeholder in these texts. Rename the texts too. The
existing translations still use %s, and this way lazygit ignores them
until they are updated.

This changes the wording of the abort confirmation slightly, from
"Abort rebase" to "Abort the rebase", and from "abort the current
rebase" to "abort the rebase".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Stefan Haller
2026-11-08 15:17:17 +01:00
co-authored by Claude Opus 5.5
parent f15055584f
commit 6a0ef0b750
4 changed files with 43 additions and 16 deletions
+11
View File
@@ -94,6 +94,17 @@ func (self WorkingTreeState) OptionsMapTitle(tr *i18n.TranslationSet) string {
}[self.Effective()]
}
// OperationName returns a phrase for the current operation that we can use in
// sentences like "Abort <operation>".
func (self WorkingTreeState) OperationName(tr *i18n.TranslationSet) string {
return map[EffectiveWorkingTreeState]string{
WORKING_TREE_STATE_REBASING: tr.RebaseOperationName,
WORKING_TREE_STATE_MERGING: tr.MergeOperationName,
WORKING_TREE_STATE_CHERRY_PICKING: tr.CherryPickOperationName,
WORKING_TREE_STATE_REVERTING: tr.RevertOperationName,
}[self.Effective()]
}
func (self WorkingTreeState) CommandName() string {
return map[EffectiveWorkingTreeState]string{
WORKING_TREE_STATE_REBASING: "rebase",
@@ -283,7 +283,7 @@ func (self *MergeAndRebaseHelper) CheckForConflicts(result error) error {
}
func (self *MergeAndRebaseHelper) PromptForConflictHandling() error {
mode := self.c.Git().Status.WorkingTreeState().CommandName()
operation := self.c.Git().Status.WorkingTreeState().OperationName(self.c.Tr)
return self.c.Menu(types.CreateMenuOptions{
Title: self.c.Tr.FoundConflictsTitle,
Items: []*types.MenuItem{
@@ -295,7 +295,8 @@ func (self *MergeAndRebaseHelper) PromptForConflictHandling() error {
},
},
{
Label: fmt.Sprintf(self.c.Tr.AbortMenuItem, mode),
Label: utils.ResolvePlaceholderString(self.c.Tr.AbortOperationMenuItem,
map[string]string{"operation": operation}),
OnPress: func() error {
return self.genericMergeCommand(REBASE_OPTION_ABORT)
},
@@ -308,10 +309,12 @@ func (self *MergeAndRebaseHelper) PromptForConflictHandling() error {
func (self *MergeAndRebaseHelper) AbortMergeOrRebaseWithConfirm() error {
// prompt user to confirm that they want to abort, then do it
mode := self.c.Git().Status.WorkingTreeState().CommandName()
placeholders := map[string]string{
"operation": self.c.Git().Status.WorkingTreeState().OperationName(self.c.Tr),
}
self.c.Confirm(types.ConfirmOpts{
Title: fmt.Sprintf(self.c.Tr.AbortTitle, mode),
Prompt: fmt.Sprintf(self.c.Tr.AbortPrompt, mode),
Title: utils.ResolvePlaceholderString(self.c.Tr.AbortOperationTitle, placeholders),
Prompt: utils.ResolvePlaceholderString(self.c.Tr.AbortOperationPrompt, placeholders),
HandleConfirm: func() error {
return self.genericMergeCommand(REBASE_OPTION_ABORT)
},
@@ -324,8 +327,10 @@ func (self *MergeAndRebaseHelper) AbortMergeOrRebaseWithConfirm() error {
func (self *MergeAndRebaseHelper) PromptToContinueRebase() {
self.continueRebasePromptShowing = true
self.c.Confirm(types.ConfirmOpts{
Title: self.c.Tr.Continue,
Prompt: fmt.Sprintf(self.c.Tr.ConflictsResolved, self.c.Git().Status.WorkingTreeState().CommandName()),
Title: self.c.Tr.Continue,
Prompt: utils.ResolvePlaceholderString(self.c.Tr.ContinueAfterConflictsResolved, map[string]string{
"operation": self.c.Git().Status.WorkingTreeState().OperationName(self.c.Tr),
}),
HandleClose: func() error {
self.continueRebasePromptShowing = false
return nil
+4 -1
View File
@@ -7,6 +7,7 @@ import (
"github.com/jesseduffield/lazygit/pkg/gocui"
"github.com/jesseduffield/lazygit/pkg/gui/style"
"github.com/jesseduffield/lazygit/pkg/gui/types"
"github.com/jesseduffield/lazygit/pkg/utils"
"github.com/samber/lo"
)
@@ -140,7 +141,9 @@ func (self *ModeHelper) Statuses() []ModeStatus {
)
},
CancelLabel: func() string {
return fmt.Sprintf(self.c.Tr.AbortTitle, self.c.Git().Status.WorkingTreeState().CommandName())
return utils.ResolvePlaceholderString(self.c.Tr.AbortOperationTitle, map[string]string{
"operation": self.c.Git().Status.WorkingTreeState().OperationName(self.c.Tr),
})
},
Reset: self.mergeAndRebaseHelper.AbortMergeOrRebaseWithConfirm,
},
+16 -8
View File
@@ -350,7 +350,7 @@ type TranslationSet struct {
FastForwarding string
FoundConflictsTitle string
ViewConflictsMenuItem string
AbortMenuItem string
AbortOperationMenuItem string
PickHunk string
PickBothHunks string
ViewMergeRebaseOptions string
@@ -386,7 +386,7 @@ type TranslationSet struct {
InformationTitle string
SecondaryTitle string
ReflogCommitsTitle string
ConflictsResolved string
ContinueAfterConflictsResolved string
Continue string
UnstagedFilesAfterConflictsResolved string
RebasingTitle string
@@ -475,6 +475,10 @@ type TranslationSet struct {
LowercaseMergingStatus string
LowercaseCherryPickingStatus string
LowercaseRevertingStatus string
RebaseOperationName string
MergeOperationName string
CherryPickOperationName string
RevertOperationName string
AmendingStatus string
CherryPickingStatus string
UndoingStatus string
@@ -878,8 +882,8 @@ type TranslationSet struct {
MustSpecifyOriginError string
GitOutput string
GitCommandFailed string
AbortTitle string
AbortPrompt string
AbortOperationTitle string
AbortOperationPrompt string
OpenLogMenu string
OpenLogMenuTooltip string
LogMenuTitle string
@@ -1571,7 +1575,7 @@ func EnglishTranslationSet() *TranslationSet {
FastForwarding: "Fast-forwarding",
FoundConflictsTitle: "Conflicts!",
ViewConflictsMenuItem: "View conflicts",
AbortMenuItem: "Abort the %s",
AbortOperationMenuItem: "Abort {{.operation}}",
ViewMergeRebaseOptions: "View merge/rebase options",
ViewMergeRebaseOptionsTooltip: "View options to abort/continue/skip the current merge/rebase.",
ViewMergeOptions: "View merge options",
@@ -1606,7 +1610,7 @@ func EnglishTranslationSet() *TranslationSet {
SecondaryTitle: "Secondary",
ReflogCommitsTitle: "Reflog",
GlobalTitle: "Global keybindings",
ConflictsResolved: "All merge conflicts resolved. Continue the %s?",
ContinueAfterConflictsResolved: "All merge conflicts resolved. Continue {{.operation}}?",
Continue: "Continue",
UnstagedFilesAfterConflictsResolved: "Files have been modified since conflicts were resolved. Auto-stage them and continue?",
Keybindings: "Keybindings",
@@ -1700,6 +1704,10 @@ func EnglishTranslationSet() *TranslationSet {
LowercaseMergingStatus: "merging", // lowercase because it shows up in parentheses
LowercaseCherryPickingStatus: "cherry-picking", // lowercase because it shows up in parentheses
LowercaseRevertingStatus: "reverting", // lowercase because it shows up in parentheses
RebaseOperationName: "the rebase",
MergeOperationName: "the merge",
CherryPickOperationName: "the cherry-pick",
RevertOperationName: "the revert",
AmendingStatus: "Amending",
CherryPickingStatus: "Cherry-picking",
UndoingStatus: "Undoing",
@@ -2100,8 +2108,8 @@ func EnglishTranslationSet() *TranslationSet {
MustSpecifyOriginError: "Must specify a remote if specifying a branch",
GitOutput: "Git output:",
GitCommandFailed: "Git command failed. Check command log for details (open with %s)",
AbortTitle: "Abort %s",
AbortPrompt: "Are you sure you want to abort the current %s?",
AbortOperationTitle: "Abort {{.operation}}",
AbortOperationPrompt: "Are you sure you want to abort {{.operation}}?",
OpenLogMenu: "View log options",
OpenLogMenuTooltip: "View options for commit log e.g. changing sort order, hiding the git graph, showing the whole git graph.",
LogMenuTitle: "Commit Log Options",