Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a view basic translation functions and translation file #137

Merged
merged 36 commits into from
Aug 16, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
62fc831
Added a view basic translation functions + tranlation file
mjarkk Aug 13, 2018
d9959eb
fixed @jesseduffield comment #137
mjarkk Aug 13, 2018
65eb378
fixed typo
mjarkk Aug 13, 2018
f2dfcb6
Added more messages and text issue: #137
mjarkk Aug 13, 2018
dfafb98
tried to update to latest master
mjarkk Aug 14, 2018
17dcfbc
Merge pull request #1 from jesseduffield/master
mjarkk Aug 14, 2018
5ad97ad
Added the translation to some words again
mjarkk Aug 14, 2018
f792f74
Merge remote-tracking branch 'origin/master'
mjarkk Aug 14, 2018
dd7e93a
Added all the missing translations from dutch.go
mjarkk Aug 14, 2018
0c39347
Added auto detection for the system language
mjarkk Aug 14, 2018
6e51814
added some commands
mjarkk Aug 14, 2018
0568b32
Added more translations
mjarkk Aug 14, 2018
5cbacb0
make local i18n package confirm to project structure
jesseduffield Aug 14, 2018
4d0702f
Merge branch 'master' of https://github.com/mjarkk/lazygit
jesseduffield Aug 14, 2018
8e22d56
Merge pull request #2 from jesseduffield/master
mjarkk Aug 14, 2018
73a1682
fixed package naming and added tr object to file_panel.go
mjarkk Aug 14, 2018
ba2b6fb
pull errors out of package scope and store sentinel errors on the gui…
jesseduffield Aug 14, 2018
d923796
Merge branch 'master' of https://github.com/mjarkk/lazygit
jesseduffield Aug 14, 2018
883f436
can't go any further because of an error
mjarkk Aug 14, 2018
9c97b75
Merge remote-tracking branch 'origin/master'
mjarkk Aug 14, 2018
38a1a00
Fixed comment from myself on issue: 137
mjarkk Aug 14, 2018
be3f584
Added more translations
mjarkk Aug 14, 2018
3dba246
Added translations for files_panel.go and fixed some typos
mjarkk Aug 14, 2018
8418fa1
Fully translated pkg/gui/commit_message_panel.go
mjarkk Aug 15, 2018
d12cc5a
Fully translated pkg/gui/commits_panel.go
mjarkk Aug 15, 2018
7e926cf
Added translation for pkg/gui/ confirmation_panel.go gui.go merge_pan…
mjarkk Aug 15, 2018
10c5316
Merge pull request #3 from jesseduffield/master
mjarkk Aug 15, 2018
295093a
Translated pkg/gui/stash_panel.go
mjarkk Aug 15, 2018
50b41bf
Translated pkg/gui/view_helpers.go
mjarkk Aug 15, 2018
d00c46a
Added all english translations to a file and fixed some typos
mjarkk Aug 15, 2018
9112278
Merge pull request #4 from jesseduffield/master
mjarkk Aug 15, 2018
9abbfe5
Fully translated pkg/gui/confirmation_panel.go
mjarkk Aug 15, 2018
88e1a81
Fixed comment on issue #137 from @jesseduffield
mjarkk Aug 16, 2018
9074650
Fixed comments from jesseduffield on issue #137
mjarkk Aug 16, 2018
faf218f
Fixed comments from jesseduffield on issue #137
mjarkk Aug 16, 2018
fcf616b
Fixed it
mjarkk Aug 16, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pkg/gui/branches_panel.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func (gui *Gui) handleNewBranch(g *gocui.Gui, v *gocui.View) error {
branch := gui.State.Branches[0]
message := gui.Tr.TemplateLocalize(
"NewBranchNameBranchOff",
map[string]interface{}{
Teml{
"branchName": branch.Name,
},
)
Expand All @@ -69,7 +69,7 @@ func (gui *Gui) handleDeleteBranch(g *gocui.Gui, v *gocui.View) error {
}
message := gui.Tr.TemplateLocalize(
"DeleteBranchMessage",
map[string]interface{}{
Teml{
"selectedBranchName": selectedBranch.Name,
},
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/gui/commit_message_panel.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func (gui *Gui) handleNewlineCommitMessage(g *gocui.Gui, v *gocui.View) error {
func (gui *Gui) handleCommitFocused(g *gocui.Gui, v *gocui.View) error {
message := gui.Tr.TemplateLocalize(
"CloseConfirm",
map[string]interface{}{
Teml{
"keyBindClose": "esc",
"keyBindConfirm": "enter",
},
Expand Down
4 changes: 2 additions & 2 deletions pkg/gui/confirmation_panel.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func (gui *Gui) createConfirmationPanel(g *gocui.Gui, currentView *gocui.View, t
if err := gui.closeConfirmationPrompt(g); err != nil {
errMessage := gui.Tr.TemplateLocalize(
"CantCloseConfirmationPrompt",
map[string]interface{}{
Teml{
"error": err.Error(),
},
)
Expand Down Expand Up @@ -125,7 +125,7 @@ func (gui *Gui) handleNewline(g *gocui.Gui, v *gocui.View) error {
func (gui *Gui) setKeyBindings(g *gocui.Gui, handleConfirm, handleClose func(*gocui.Gui, *gocui.View) error) error {
actions := gui.Tr.TemplateLocalize(
"CloseConfirm",
map[string]interface{}{
Teml{
"keyBindClose": "esc",
"keyBindConfirm": "enter",
},
Expand Down
8 changes: 4 additions & 4 deletions pkg/gui/files_panel.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func (gui *Gui) handleAddPatch(g *gocui.Gui, v *gocui.View) error {
return err
}
gui.SubProcess = sub
return nil
return gui.Errors.ErrSubProcess
}

func (gui *Gui) getSelectedFile(g *gocui.Gui) (commands.File, error) {
Expand Down Expand Up @@ -121,7 +121,7 @@ func (gui *Gui) handleFileRemove(g *gocui.Gui, v *gocui.View) error {
}
message := gui.Tr.TemplateLocalize(
"SureTo",
map[string]interface{}{
Teml{
"deleteVerb": deleteVerb,
"fileName": file.Name,
},
Expand Down Expand Up @@ -223,7 +223,7 @@ func (gui *Gui) PrepareSubProcess(g *gocui.Gui, commands ...string) error {
}
gui.SubProcess = sub
g.Update(func(g *gocui.Gui) error {
return nil
return gui.Errors.ErrSubProcess
})
return nil
}
Expand All @@ -242,7 +242,7 @@ func (gui *Gui) genericFileOpen(g *gocui.Gui, v *gocui.View, open func(string) (
}
if sub != nil {
gui.SubProcess = sub
return nil
return gui.Errors.ErrSubProcess
}
return nil
}
Expand Down
3 changes: 3 additions & 0 deletions pkg/gui/gui.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ func (gui *Gui) GenerateSentinelErrors() {
}
}

// Teml is short for template used to make the required map[string]interface{} shorter when using gui.Tr.SLocalize and gui.Tr.TemplateLocalize
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we put this in the i18n package and then call it as i18n.Temp, just incase we need to call it from another package as well

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we move this to the i18n package and then call it like i18n.Teml so that we can can access it from any package, not just gui?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed it

type Teml map[string]interface{}

// Gui wraps the gocui Gui object which handles rendering and events
type Gui struct {
g *gocui.Gui
Expand Down