diff options
author | Mark Kopenga <mkopenga@gmail.com> | 2018-08-14 15:26:25 +0200 |
---|---|---|
committer | Mark Kopenga <mkopenga@gmail.com> | 2018-08-14 15:26:25 +0200 |
commit | 73a168254066278b6f5d38667564877a071b4376 (patch) | |
tree | 33fb41af7105616ebe63a9f7bf5e8fc3bd123277 /pkg | |
parent | 8e22d569a09a3ddd3a508bf2be382f2d0f2d17af (diff) |
fixed package naming and added tr object to file_panel.go
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/app/app.go | 2 | ||||
-rw-r--r-- | pkg/gui/files_panel.go | 13 | ||||
-rw-r--r-- | pkg/gui/gui.go | 4 | ||||
-rw-r--r-- | pkg/i18n/i18n.go | 5 |
4 files changed, 15 insertions, 9 deletions
diff --git a/pkg/app/app.go b/pkg/app/app.go index f07757f98..f4311bb03 100644 --- a/pkg/app/app.go +++ b/pkg/app/app.go @@ -9,7 +9,7 @@ import ( "github.com/jesseduffield/lazygit/pkg/commands" "github.com/jesseduffield/lazygit/pkg/config" "github.com/jesseduffield/lazygit/pkg/gui" - "github.com/mjarkk/lazygit/pkg/i18n" + "github.com/jesseduffield/lazygit/pkg/i18n" ) // App struct diff --git a/pkg/gui/files_panel.go b/pkg/gui/files_panel.go index 8c4c5cb6f..2bf8e754b 100644 --- a/pkg/gui/files_panel.go +++ b/pkg/gui/files_panel.go @@ -14,11 +14,14 @@ import ( "github.com/fatih/color" "github.com/jesseduffield/gocui" "github.com/jesseduffield/lazygit/pkg/commands" + "github.com/jesseduffield/lazygit/pkg/i18n" ) +var tr *i18n.Localizer + var ( - errNoFiles = errors.New(lang.SLocalize("NoChangedFiles", "No changed files")) - errNoUsername = errors.New(lang.SLocalize("NoUsernameSetErr", `No username set. Please do: git config --global user.name "Your Name"`)) + errNoFiles = errors.New(tr.SLocalize("NoChangedFiles", "No changed files")) + errNoUsername = errors.New(tr.SLocalize("NoUsernameSetErr", `No username set. Please do: git config --global user.name "Your Name"`)) ) func (gui *Gui) stagedFiles() []commands.File { @@ -86,10 +89,10 @@ func (gui *Gui) handleAddPatch(g *gocui.Gui, v *gocui.View) error { return err } if !file.HasUnstagedChanges { - return gui.createErrorPanel(g, lang.SLocalize("FileHasNoUnstagedChanges", "File has no unstaged changes to add")) + return gui.createErrorPanel(g, tr.SLocalize("FileHasNoUnstagedChanges", "File has no unstaged changes to add")) } if !file.Tracked { - return gui.createErrorPanel(g, lang.SLocalize("CannotGitAdd", "Cannot git add --patch untracked files")) + return gui.createErrorPanel(g, tr.SLocalize("CannotGitAdd", "Cannot git add --patch untracked files")) } sub, err := gui.GitCommand.AddPatch(file.Name) if err != nil { @@ -139,7 +142,7 @@ func (gui *Gui) handleIgnoreFile(g *gocui.Gui, v *gocui.View) error { return gui.createErrorPanel(g, err.Error()) } if file.Tracked { - return gui.createErrorPanel(g, lang.SLocalize("CantIgnoreTrackFiles", "Cannot ignore tracked files")) + return gui.createErrorPanel(g, tr.SLocalize("CantIgnoreTrackFiles", "Cannot ignore tracked files")) } gui.GitCommand.Ignore(file.Name) return gui.refreshFiles(g) diff --git a/pkg/gui/gui.go b/pkg/gui/gui.go index 237f78d31..f30e60137 100644 --- a/pkg/gui/gui.go +++ b/pkg/gui/gui.go @@ -19,7 +19,7 @@ import ( "github.com/golang-collections/collections/stack" "github.com/jesseduffield/gocui" "github.com/jesseduffield/lazygit/pkg/commands" - "github.com/mjarkk/lazygit/pkg/i18n" + "github.com/jesseduffield/lazygit/pkg/i18n" ) // OverlappingEdges determines if panel edges overlap @@ -59,7 +59,7 @@ type guiState struct { } // NewGui builds a new gui handler -func NewGui(log *logrus.Logger, gitCommand *commands.GitCommand, oSCommand *commands.OSCommand, tr *lang.Localizer, version string) (*Gui, error) { +func NewGui(log *logrus.Logger, gitCommand *commands.GitCommand, oSCommand *commands.OSCommand, tr *i18n.Localizer, version string) (*Gui, error) { initialState := guiState{ Files: make([]commands.File, 0), PreviousView: "files", diff --git a/pkg/i18n/i18n.go b/pkg/i18n/i18n.go index e58c05aec..f54cb9d80 100644 --- a/pkg/i18n/i18n.go +++ b/pkg/i18n/i18n.go @@ -18,7 +18,10 @@ type Localizer struct { func NewLocalizer(log *logrus.Logger) (*Localizer, error) { // detect the user's language - userLang, _ := jibber_jabber.DetectLanguage() + userLang, err := jibber_jabber.DetectLanguage() + if err != nil { + return nil, err + } log.Info("language: " + userLang) // create a i18n bundle that can be used to add translations and other things |