1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-06-08 23:56:15 +02:00

Added translation for pkg/gui/ confirmation_panel.go gui.go merge_panel.go

This commit is contained in:
Mark Kopenga 2018-08-15 10:53:05 +02:00
parent d12cc5a74e
commit 7e926cf41d
4 changed files with 42 additions and 10 deletions

View File

@ -113,7 +113,15 @@ 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 { func (gui *Gui) setKeyBindings(g *gocui.Gui, handleConfirm, handleClose func(*gocui.Gui, *gocui.View) error) error {
gui.renderString(g, "options", "esc: close, enter: confirm") actions := gui.Tr.TemplateLocalize(
"CloseConfirm",
"{{.keyBindClose}}: close, {{.keyBindConfirm}}: confirm",
map[string]interface{}{
"keyBindClose": "esc",
"keyBindConfirm": "enter",
},
)
gui.renderString(g, "options", actions)
if err := g.SetKeybinding("confirmation", gocui.KeyEnter, gocui.ModNone, gui.wrappedConfirmationFunction(handleConfirm)); err != nil { if err := g.SetKeybinding("confirmation", gocui.KeyEnter, gocui.ModNone, gui.wrappedConfirmationFunction(handleConfirm)); err != nil {
return err return err
} }
@ -131,7 +139,7 @@ func (gui *Gui) createErrorPanel(g *gocui.Gui, message string) error {
currentView := g.CurrentView() currentView := g.CurrentView()
colorFunction := color.New(color.FgRed).SprintFunc() colorFunction := color.New(color.FgRed).SprintFunc()
coloredMessage := colorFunction(strings.TrimSpace(message)) coloredMessage := colorFunction(strings.TrimSpace(message))
return gui.createConfirmationPanel(g, currentView, "Error", coloredMessage, nil, nil) return gui.createConfirmationPanel(g, currentView, gui.Tr.SLocalize("Error", "Error"), coloredMessage, nil, nil)
} }
func (gui *Gui) resizePopupPanel(g *gocui.Gui, v *gocui.View) error { func (gui *Gui) resizePopupPanel(g *gocui.Gui, v *gocui.View) error {
@ -143,7 +151,7 @@ func (gui *Gui) resizePopupPanel(g *gocui.Gui, v *gocui.View) error {
if vx0 == x0 && vy0 == y0 && vx1 == x1 && vy1 == y1 { if vx0 == x0 && vy0 == y0 && vx1 == x1 && vy1 == y1 {
return nil return nil
} }
gui.Log.Info("resizing popup panel") gui.Log.Info(gui.Tr.SLocalize("resizingPopupPanel", "resizing popup panel"))
_, err := g.SetView(v.Name(), x0, y0, x1, y1, 0) _, err := g.SetView(v.Name(), x0, y0, x1, y1, 0)
return err return err
} }

View File

@ -44,7 +44,7 @@ type SentinelErrors struct {
// localising things in the code. // localising things in the code.
func (gui *Gui) GenerateSentinelErrors() { func (gui *Gui) GenerateSentinelErrors() {
gui.Errors = SentinelErrors{ gui.Errors = SentinelErrors{
ErrSubProcess: errors.New("running subprocess"), ErrSubProcess: errors.New(gui.Tr.SLocalize("RunningSubprocess", "running subprocess")),
ErrNoFiles: errors.New(gui.Tr.SLocalize("NoChangedFiles", "No changed files")), ErrNoFiles: errors.New(gui.Tr.SLocalize("NoChangedFiles", "No changed files")),
} }
} }

View File

@ -232,11 +232,11 @@ func (gui *Gui) switchToMerging(g *gocui.Gui) error {
func (gui *Gui) renderMergeOptions(g *gocui.Gui) error { func (gui *Gui) renderMergeOptions(g *gocui.Gui) error {
return gui.renderOptionsMap(g, map[string]string{ return gui.renderOptionsMap(g, map[string]string{
"↑ ↓": "select hunk", "↑ ↓": gui.Tr.SLocalize("selectHunk", "select hunk"),
"← →": "navigate conflicts", "← →": gui.Tr.SLocalize("navigateConflicts", "navigate conflicts"),
"space": "pick hunk", "space": gui.Tr.SLocalize("pickHunk", "pick hunk"),
"b": "pick both hunks", "b": gui.Tr.SLocalize("pickBothHunks", "pick both hunks"),
"z": "undo", "z": gui.Tr.SLocalize("undo", "undo"),
}) })
} }

View File

@ -141,7 +141,7 @@ func addDutch(i18nObject *i18n.Bundle) {
Other: "Je kan niet een branch in zichzelf mergen", Other: "Je kan niet een branch in zichzelf mergen",
}, &i18n.Message{ }, &i18n.Message{
ID: "forceCheckout", ID: "forceCheckout",
Other: "forceren checkout", Other: "forceer checkout",
}, &i18n.Message{ }, &i18n.Message{
ID: "merge", ID: "merge",
Other: "merge", Other: "merge",
@ -214,6 +214,30 @@ func addDutch(i18nObject *i18n.Bundle) {
}, &i18n.Message{ }, &i18n.Message{
ID: "NoCommitsThisBranch", ID: "NoCommitsThisBranch",
Other: "Geen commits voor deze branch", Other: "Geen commits voor deze branch",
}, &i18n.Message{
ID: "Error",
Other: "Error",
}, &i18n.Message{
ID: "resizingPopupPanel",
Other: "resizen popup paneel",
}, &i18n.Message{
ID: "RunningSubprocess",
Other: "subprocess lopend",
}, &i18n.Message{
ID: "selectHunk",
Other: "selecteer Hunk",
}, &i18n.Message{
ID: "navigateConflicts",
Other: "navigeer conflicts",
}, &i18n.Message{
ID: "pickHunk",
Other: "kies Hunk",
}, &i18n.Message{
ID: "pickBothHunks",
Other: "kies bijde hunks",
}, &i18n.Message{
ID: "undo",
Other: "ongedaan maken",
}, },
) )
} }