diff options
Diffstat (limited to 'pkg/gui/commits_panel.go')
-rw-r--r-- | pkg/gui/commits_panel.go | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/pkg/gui/commits_panel.go b/pkg/gui/commits_panel.go index 4f5ae2afc..be1dc033a 100644 --- a/pkg/gui/commits_panel.go +++ b/pkg/gui/commits_panel.go @@ -39,7 +39,7 @@ func (gui *Gui) refreshCommits(g *gocui.Gui) error { } func (gui *Gui) handleResetToCommit(g *gocui.Gui, commitView *gocui.View) error { - return gui.createConfirmationPanel(g, commitView, "Reset To Commit", "Are you sure you want to reset to this commit?", func(g *gocui.Gui, v *gocui.View) error { + return gui.createConfirmationPanel(g, commitView, gui.Tr.SLocalize("ResetToCommit", "Reset To Commit"), gui.Tr.SLocalize("SureResetThisCommit", "Are you sure you want to reset to this commit?"), func(g *gocui.Gui, v *gocui.View) error { commit, err := gui.getSelectedCommit(g) if err != nil { panic(err) @@ -60,11 +60,11 @@ func (gui *Gui) handleResetToCommit(g *gocui.Gui, commitView *gocui.View) error func (gui *Gui) renderCommitsOptions(g *gocui.Gui) error { return gui.renderOptionsMap(g, map[string]string{ - "s": "squash down", - "r": "rename", - "g": "reset to this commit", - "f": "fixup commit", - "← → ↑ ↓": "navigate", + "s": gui.Tr.SLocalize("squashDown", "squash down"), + "r": gui.Tr.SLocalize("rename", "rename"), + "g": gui.Tr.SLocalize("resetToThisCommit", "reset to this commit"), + "f": gui.Tr.SLocalize("FixupCommit", "fixup commit"), + "← → ↑ ↓": gui.Tr.SLocalize("navigate", "navigate"), }) } @@ -74,10 +74,10 @@ func (gui *Gui) handleCommitSelect(g *gocui.Gui, v *gocui.View) error { } commit, err := gui.getSelectedCommit(g) if err != nil { - if err != errors.New("No commits for this branch") { + if err != errors.New(gui.Tr.SLocalize("NoCommitsThisBranch", "No commits for this branch")) { return err } - return gui.renderString(g, "main", "No commits for this branch") + return gui.renderString(g, "main", gui.Tr.SLocalize("NoCommitsThisBranch", "No commits for this branch")) } commitText := gui.GitCommand.Show(commit.Sha) return gui.renderString(g, "main", commitText) @@ -85,10 +85,10 @@ func (gui *Gui) handleCommitSelect(g *gocui.Gui, v *gocui.View) error { func (gui *Gui) handleCommitSquashDown(g *gocui.Gui, v *gocui.View) error { if gui.getItemPosition(v) != 0 { - return gui.createErrorPanel(g, "Can only squash topmost commit") + return gui.createErrorPanel(g, gui.Tr.SLocalize("OnlySquashTopmostCommit", "Can only squash topmost commit")) } if len(gui.State.Commits) == 1 { - return gui.createErrorPanel(g, "You have no commits to squash with") + return gui.createErrorPanel(g, gui.Tr.SLocalize("YouNoCommitsToSquash", "You have no commits to squash with")) } commit, err := gui.getSelectedCommit(g) if err != nil { @@ -116,17 +116,18 @@ func (gui *Gui) anyUnStagedChanges(files []commands.File) bool { func (gui *Gui) handleCommitFixup(g *gocui.Gui, v *gocui.View) error { if len(gui.State.Commits) == 1 { - return gui.createErrorPanel(g, "You have no commits to squash with") + return gui.createErrorPanel(g, gui.Tr.SLocalize("YouNoCommitsToSquash", "You have no commits to squash with")) } if gui.anyUnStagedChanges(gui.State.Files) { - return gui.createErrorPanel(g, "Can't fixup while there are unstaged changes") + return gui.createErrorPanel(g, gui.Tr.SLocalize("CantFixupWhileUnstagedChanges", "Can't fixup while there are unstaged changes")) } branch := gui.State.Branches[0] commit, err := gui.getSelectedCommit(g) if err != nil { return err } - gui.createConfirmationPanel(g, v, "Fixup", "Are you sure you want to fixup this commit? The commit beneath will be squashed up into this one", func(g *gocui.Gui, v *gocui.View) error { + message := gui.Tr.SLocalize("SureFixupThisCommit", "Are you sure you want to fixup this commit? The commit beneath will be squashed up into this one") + gui.createConfirmationPanel(g, v, gui.Tr.SLocalize("Fixup", "Fixup"), message, func(g *gocui.Gui, v *gocui.View) error { if err := gui.GitCommand.SquashFixupCommit(branch.Name, commit.Sha); err != nil { return gui.createErrorPanel(g, err.Error()) } @@ -140,9 +141,9 @@ func (gui *Gui) handleCommitFixup(g *gocui.Gui, v *gocui.View) error { func (gui *Gui) handleRenameCommit(g *gocui.Gui, v *gocui.View) error { if gui.getItemPosition(v) != 0 { - return gui.createErrorPanel(g, "Can only rename topmost commit") + return gui.createErrorPanel(g, gui.Tr.SLocalize("OnlyRenameTopCommit", "Can only rename topmost commit")) } - gui.createPromptPanel(g, v, "Rename Commit", func(g *gocui.Gui, v *gocui.View) error { + gui.createPromptPanel(g, v, gui.Tr.SLocalize("RenameCommit", "Rename Commit"), func(g *gocui.Gui, v *gocui.View) error { if err := gui.GitCommand.RenameCommit(v.Buffer()); err != nil { return gui.createErrorPanel(g, err.Error()) } @@ -160,11 +161,11 @@ func (gui *Gui) getSelectedCommit(g *gocui.Gui) (commands.Commit, error) { panic(err) } if len(gui.State.Commits) == 0 { - return commands.Commit{}, errors.New("No commits for this branch") + return commands.Commit{}, errors.New(gui.Tr.SLocalize("NoCommitsThisBranch", "No commits for this branch")) } lineNumber := gui.getItemPosition(v) if lineNumber > len(gui.State.Commits)-1 { - gui.Log.Info("potential error in getSelected Commit (mismatched ui and state)", gui.State.Commits, lineNumber) + gui.Log.Info(gui.Tr.SLocalize("PotentialErrInGetselectedCommit", "potential error in getSelected Commit (mismatched ui and state)"), gui.State.Commits, lineNumber) return gui.State.Commits[len(gui.State.Commits)-1], nil } return gui.State.Commits[lineNumber], nil |