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

Translated pkg/gui/stash_panel.go

This commit is contained in:
Mark Kopenga 2018-08-15 11:12:46 +02:00
parent 10c53162ca
commit 295093a432
2 changed files with 45 additions and 9 deletions

View File

@ -33,10 +33,10 @@ func (gui *Gui) getSelectedStashEntry(v *gocui.View) *commands.StashEntry {
func (gui *Gui) renderStashOptions(g *gocui.Gui) error {
return gui.renderOptionsMap(g, map[string]string{
"space": "apply",
"g": "pop",
"d": "drop",
"← → ↑ ↓": "navigate",
"space": gui.Tr.SLocalize("apply", "apply"),
"g": gui.Tr.SLocalize("pop", "pop"),
"d": gui.Tr.SLocalize("drop", "drop"),
"← → ↑ ↓": gui.Tr.SLocalize("navigate", "navigate"),
})
}
@ -47,7 +47,7 @@ func (gui *Gui) handleStashEntrySelect(g *gocui.Gui, v *gocui.View) error {
go func() {
stashEntry := gui.getSelectedStashEntry(v)
if stashEntry == nil {
gui.renderString(g, "main", "No stash entries")
gui.renderString(g, "main", gui.Tr.SLocalize("NoStashEntries", "No stash entries"))
return
}
diff, _ := gui.GitCommand.GetStashEntryDiff(stashEntry.Index)
@ -65,7 +65,9 @@ func (gui *Gui) handleStashPop(g *gocui.Gui, v *gocui.View) error {
}
func (gui *Gui) handleStashDrop(g *gocui.Gui, v *gocui.View) error {
return gui.createConfirmationPanel(g, v, "Stash drop", "Are you sure you want to drop this stash entry?", func(g *gocui.Gui, v *gocui.View) error {
title := gui.Tr.SLocalize("StashDrop", "Stash drop")
message := gui.Tr.SLocalize("SureDropStashEntry", "Are you sure you want to drop this stash entry?")
return gui.createConfirmationPanel(g, v, title, message, func(g *gocui.Gui, v *gocui.View) error {
return gui.stashDo(g, v, "drop")
}, nil)
}
@ -73,7 +75,14 @@ func (gui *Gui) handleStashDrop(g *gocui.Gui, v *gocui.View) error {
func (gui *Gui) stashDo(g *gocui.Gui, v *gocui.View, method string) error {
stashEntry := gui.getSelectedStashEntry(v)
if stashEntry == nil {
return gui.createErrorPanel(g, "No stash to "+method)
errorMessage := gui.Tr.TemplateLocalize(
"NoStashTo",
"No stash to {{.method}}",
map[string]interface{}{
"method": method,
},
)
return gui.createErrorPanel(g, errorMessage)
}
if err := gui.GitCommand.StashDo(stashEntry.Index, method); err != nil {
gui.createErrorPanel(g, err.Error())
@ -84,9 +93,9 @@ func (gui *Gui) stashDo(g *gocui.Gui, v *gocui.View, method string) error {
func (gui *Gui) handleStashSave(g *gocui.Gui, filesView *gocui.View) error {
if len(gui.trackedFiles()) == 0 && len(gui.stagedFiles()) == 0 {
return gui.createErrorPanel(g, "You have no tracked/staged files to stash")
return gui.createErrorPanel(g, gui.Tr.SLocalize("NoTrackedStagedFilesStash", "You have no tracked/staged files to stash"))
}
gui.createPromptPanel(g, filesView, "Stash changes", func(g *gocui.Gui, v *gocui.View) error {
gui.createPromptPanel(g, filesView, gui.Tr.SLocalize("StashChanges", "Stash changes"), func(g *gocui.Gui, v *gocui.View) error {
if err := gui.GitCommand.StashSave(gui.trimmedContent(v)); err != nil {
gui.createErrorPanel(g, err.Error())
}

View File

@ -238,6 +238,33 @@ func addDutch(i18nObject *i18n.Bundle) {
}, &i18n.Message{
ID: "undo",
Other: "ongedaan maken",
}, &i18n.Message{
ID: "pop",
Other: "pop",
}, &i18n.Message{
ID: "drop",
Other: "drop",
}, &i18n.Message{
ID: "apply",
Other: "toepassen",
}, &i18n.Message{
ID: "NoStashEntries",
Other: "Geen stash items",
}, &i18n.Message{
ID: "StashDrop",
Other: "Stash drop",
}, &i18n.Message{
ID: "SureDropStashEntry",
Other: "Weet je het zeker dat je deze stash entry wil laten vallen?",
}, &i18n.Message{
ID: "NoStashTo",
Other: "Geen stash voor {{.method}}",
}, &i18n.Message{
ID: "NoTrackedStagedFilesStash",
Other: "Je hebt geen tracked/staged bestanden om te laten stashen",
}, &i18n.Message{
ID: "StashChanges",
Other: "Stash veranderingen",
},
)
}