1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-05-17 22:32:58 +02:00

Added more messages and text issue: #137

This commit is contained in:
Mark Kopenga 2018-08-13 22:00:44 +02:00
parent 65eb3780a0
commit f2dfcb6e12
2 changed files with 58 additions and 13 deletions

View File

@ -129,21 +129,21 @@ func handleIgnoreFile(g *gocui.Gui, v *gocui.View) error {
func renderfilesOptions(g *gocui.Gui, gitFile *GitFile) error { func renderfilesOptions(g *gocui.Gui, gitFile *GitFile) error {
optionsMap := map[string]string{ optionsMap := map[string]string{
"← → ↑ ↓": "navigate", "← → ↑ ↓": ShortLocalize("navigate", "navigate"),
"S": "stash files", "S": ShortLocalize("stashFiles", "stash files"),
"c": "commit changes", "c": ShortLocalize("commitChanges", "commit changes"),
"o": "open", "o": ShortLocalize("open", "open"),
"i": "ignore", "i": ShortLocalize("ignore", "ignore"),
"d": "delete", "d": ShortLocalize("delete", "delete"),
"space": "toggle staged", "space": ShortLocalize("toggleStaged", "toggle staged"),
"R": "refresh", "R": ShortLocalize("refresh", "refresh"),
"t": "add patch", "t": ShortLocalize("addPatch", "add patch"),
"e": "edit", "e": ShortLocalize("edit", "edit"),
"PgUp/PgDn": "scroll", "PgUp/PgDn": ShortLocalize("scroll", "scroll"),
} }
if state.HasMergeConflicts { if state.HasMergeConflicts {
optionsMap["a"] = "abort merge" optionsMap["a"] = ShortLocalize("abortMerge", "abort merge")
optionsMap["m"] = "resolve merge conflicts" optionsMap["m"] = ShortLocalize("resolveMergeConflicts", "resolve merge conflicts")
} }
if gitFile == nil { if gitFile == nil {
return renderOptionsMap(g, optionsMap) return renderOptionsMap(g, optionsMap)

45
i18n.go
View File

@ -14,6 +14,10 @@ func getlocalizer() *i18n.Localizer {
var i18nObject = &i18n.Bundle{DefaultLanguage: language.English} var i18nObject = &i18n.Bundle{DefaultLanguage: language.English}
i18nObject.RegisterUnmarshalFunc("toml", toml.Unmarshal) i18nObject.RegisterUnmarshalFunc("toml", toml.Unmarshal)
// To add more translations do:
// AddMessages(tag language.Tag, messages ...*Message)
// https://godoc.org/github.com/nicksnyder/go-i18n/v2/i18n#Bundle.AddMessages
// Dutch translation for some words // Dutch translation for some words
i18nObject.AddMessages(language.Dutch, i18nObject.AddMessages(language.Dutch,
&i18n.Message{ &i18n.Message{
@ -31,10 +35,51 @@ func getlocalizer() *i18n.Localizer {
}, &i18n.Message{ }, &i18n.Message{
ID: "CommitMessage", ID: "CommitMessage",
Other: "Commit Bericht", Other: "Commit Bericht",
}, &i18n.Message{
ID: "CommitChanges",
Other: "Commit Veranderingen",
}, &i18n.Message{ }, &i18n.Message{
ID: "StatusTitle", ID: "StatusTitle",
Other: "Status", Other: "Status",
}, &i18n.Message{
ID: "navigate",
Other: "navigeer",
}, &i18n.Message{
ID: "stashFiles",
Other: "stash-bestanden",
}, &i18n.Message{
ID: "open",
Other: "open",
}, &i18n.Message{
ID: "ignore",
Other: "negeren",
}, &i18n.Message{
ID: "delete",
Other: "verwijderen",
}, &i18n.Message{
ID: "toggleStaged",
Other: "toggle staged",
}, &i18n.Message{
ID: "refresh",
Other: "verversen",
}, &i18n.Message{
ID: "addPatch",
Other: "verandering toevoegen",
}, &i18n.Message{
ID: "edit",
Other: "veranderen",
}, &i18n.Message{
ID: "scroll",
Other: "scroll",
}, &i18n.Message{
ID: "abortMerge",
Other: "samenvoegen afbreken",
}, &i18n.Message{
ID: "resolveMergeConflicts",
Other: "verhelp samenvoegen fouten",
}, },
//
) )
return i18n.NewLocalizer(i18nObject) return i18n.NewLocalizer(i18nObject)