From 6c1d2d45ef2d001e28ec31095826422ba7461664 Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Wed, 20 Feb 2019 22:52:17 +1100 Subject: some i18n and restricting rewording during interactive rebase --- pkg/git/commit_list_builder.go | 7 +++++-- pkg/gui/commits_panel.go | 10 +++++++++- pkg/i18n/english.go | 10 +++++++++- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/pkg/git/commit_list_builder.go b/pkg/git/commit_list_builder.go index df44908a7..78ba4b80f 100644 --- a/pkg/git/commit_list_builder.go +++ b/pkg/git/commit_list_builder.go @@ -10,6 +10,7 @@ import ( "github.com/fatih/color" "github.com/jesseduffield/lazygit/pkg/commands" + "github.com/jesseduffield/lazygit/pkg/i18n" "github.com/jesseduffield/lazygit/pkg/utils" "github.com/sirupsen/logrus" ) @@ -28,14 +29,16 @@ type CommitListBuilder struct { Log *logrus.Entry GitCommand *commands.GitCommand OSCommand *commands.OSCommand + Tr *i18n.Localizer } // NewCommitListBuilder builds a new commit list builder -func NewCommitListBuilder(log *logrus.Entry, gitCommand *commands.GitCommand, osCommand *commands.OSCommand) (*CommitListBuilder, error) { +func NewCommitListBuilder(log *logrus.Entry, gitCommand *commands.GitCommand, osCommand *commands.OSCommand, tr *i18n.Localizer) (*CommitListBuilder, error) { return &CommitListBuilder{ Log: log, GitCommand: gitCommand, OSCommand: osCommand, + Tr: tr, }, nil } @@ -77,7 +80,7 @@ func (c *CommitListBuilder) GetCommits() ([]*commands.Commit, error) { if rebaseMode != "" { currentCommit := commits[len(rebasingCommits)] blue := color.New(color.FgYellow) - youAreHere := blue.Sprint("<-- YOU ARE HERE ---") + youAreHere := blue.Sprintf("<-- %s ---", c.Tr.SLocalize("YouAreHere")) currentCommit.Name = fmt.Sprintf("%s %s", youAreHere, currentCommit.Name) } return c.setCommitMergedStatuses(commits) diff --git a/pkg/gui/commits_panel.go b/pkg/gui/commits_panel.go index 8189079c2..a2f3e858c 100644 --- a/pkg/gui/commits_panel.go +++ b/pkg/gui/commits_panel.go @@ -40,7 +40,7 @@ func (gui *Gui) handleCommitSelect(g *gocui.Gui, v *gocui.View) error { func (gui *Gui) refreshCommits(g *gocui.Gui) error { g.Update(func(*gocui.Gui) error { - builder, err := git.NewCommitListBuilder(gui.Log, gui.GitCommand, gui.OSCommand) + builder, err := git.NewCommitListBuilder(gui.Log, gui.GitCommand, gui.OSCommand, gui.Tr) if err != nil { return err } @@ -212,6 +212,14 @@ func (gui *Gui) handleRenameCommitEditor(g *gocui.Gui, v *gocui.View) error { // commit meaning you are trying to edit the todo file rather than actually // begin a rebase. It then updates the todo file with that action func (gui *Gui) handleMidRebaseCommand(action string) (bool, error) { + // for now we do not support setting 'reword' because it requires an editor + // and that means we either unconditionally wait around for the subprocess to ask for + // our input or we set a lazygit client as the EDITOR env variable and have it + // request us to edit the commit message when prompted. + if action == "reword" { + return true, gui.createErrorPanel(gui.g, gui.Tr.SLocalize("rewordNotSupported")) + } + selectedCommit := gui.State.Commits[gui.State.Panels.Commits.SelectedLine] if selectedCommit.Status != "rebasing" { return false, nil diff --git a/pkg/i18n/english.go b/pkg/i18n/english.go index e910d855b..ba137a3be 100644 --- a/pkg/i18n/english.go +++ b/pkg/i18n/english.go @@ -565,6 +565,14 @@ func addEnglish(i18nObject *i18n.Bundle) error { }, &i18n.Message{ ID: "NoRoom", Other: "Not enough room", - }, + }, &i18n.Message{ + ID: "YouAreHere", + Other: "YOU ARE HERE", + }, &i18n.Message{ + ID: "rewordNotSupported", + Other: "rewording commits while interactively rebasing is not currently supported", + }, + + ) } -- cgit v1.2.3