mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-03-05 15:15:49 +02:00
Added the translation to some words again
This commit is contained in:
parent
dfafb98871
commit
5ad97add08
@ -19,6 +19,7 @@ import (
|
|||||||
"github.com/golang-collections/collections/stack"
|
"github.com/golang-collections/collections/stack"
|
||||||
"github.com/jesseduffield/gocui"
|
"github.com/jesseduffield/gocui"
|
||||||
"github.com/jesseduffield/lazygit/pkg/commands"
|
"github.com/jesseduffield/lazygit/pkg/commands"
|
||||||
|
"github.com/jesseduffield/lazygit/pkg/i18n"
|
||||||
)
|
)
|
||||||
|
|
||||||
// OverlappingEdges determines if panel edges overlap
|
// OverlappingEdges determines if panel edges overlap
|
||||||
@ -133,7 +134,7 @@ func (gui *Gui) layout(g *gocui.Gui) error {
|
|||||||
if err != gocui.ErrUnknownView {
|
if err != gocui.ErrUnknownView {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
v.Title = "Not enough space to render panels"
|
v.Title = lang.SLocalize("NotEnoughSpace", "Not enough space to render panels")
|
||||||
v.Wrap = true
|
v.Wrap = true
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
@ -152,7 +153,7 @@ func (gui *Gui) layout(g *gocui.Gui) error {
|
|||||||
if err != gocui.ErrUnknownView {
|
if err != gocui.ErrUnknownView {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
v.Title = "Diff"
|
v.Title = lang.SLocalize("DiffTitle", "Diff")
|
||||||
v.Wrap = true
|
v.Wrap = true
|
||||||
v.FgColor = gocui.ColorWhite
|
v.FgColor = gocui.ColorWhite
|
||||||
}
|
}
|
||||||
@ -161,7 +162,7 @@ func (gui *Gui) layout(g *gocui.Gui) error {
|
|||||||
if err != gocui.ErrUnknownView {
|
if err != gocui.ErrUnknownView {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
v.Title = "Status"
|
v.Title = lang.SLocalize("StatusTitle", "Status")
|
||||||
v.FgColor = gocui.ColorWhite
|
v.FgColor = gocui.ColorWhite
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -171,7 +172,7 @@ func (gui *Gui) layout(g *gocui.Gui) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
filesView.Highlight = true
|
filesView.Highlight = true
|
||||||
filesView.Title = "Files"
|
filesView.Title = lang.SLocalize("FilesTitle", "Files")
|
||||||
v.FgColor = gocui.ColorWhite
|
v.FgColor = gocui.ColorWhite
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -179,7 +180,7 @@ func (gui *Gui) layout(g *gocui.Gui) error {
|
|||||||
if err != gocui.ErrUnknownView {
|
if err != gocui.ErrUnknownView {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
v.Title = "Branches"
|
v.Title = lang.SLocalize("BranchesTitle", "Branches")
|
||||||
v.FgColor = gocui.ColorWhite
|
v.FgColor = gocui.ColorWhite
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -187,7 +188,7 @@ func (gui *Gui) layout(g *gocui.Gui) error {
|
|||||||
if err != gocui.ErrUnknownView {
|
if err != gocui.ErrUnknownView {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
v.Title = "Commits"
|
v.Title = lang.SLocalize("CommitsTitle", "Commits")
|
||||||
v.FgColor = gocui.ColorWhite
|
v.FgColor = gocui.ColorWhite
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -195,7 +196,7 @@ func (gui *Gui) layout(g *gocui.Gui) error {
|
|||||||
if err != gocui.ErrUnknownView {
|
if err != gocui.ErrUnknownView {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
v.Title = "Stash"
|
v.Title = lang.SLocalize("StashTitle", "Stash")
|
||||||
v.FgColor = gocui.ColorWhite
|
v.FgColor = gocui.ColorWhite
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -214,7 +215,7 @@ func (gui *Gui) layout(g *gocui.Gui) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
g.SetViewOnBottom("commitMessage")
|
g.SetViewOnBottom("commitMessage")
|
||||||
commitMessageView.Title = "Commit message"
|
commitMessageView.Title = lang.SLocalize("CommitMessage", "Commit message")
|
||||||
commitMessageView.FgColor = gocui.ColorWhite
|
commitMessageView.FgColor = gocui.ColorWhite
|
||||||
commitMessageView.Editable = true
|
commitMessageView.Editable = true
|
||||||
}
|
}
|
||||||
|
76
pkg/i18n/dutch.go
Normal file
76
pkg/i18n/dutch.go
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
package lang
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/nicksnyder/go-i18n/v2/i18n"
|
||||||
|
"golang.org/x/text/language"
|
||||||
|
)
|
||||||
|
|
||||||
|
func addDutch(i18nObject *i18n.Bundle) *i18n.Bundle {
|
||||||
|
i18nObject.AddMessages(language.English,
|
||||||
|
&i18n.Message{
|
||||||
|
ID: "NotEnoughSpace",
|
||||||
|
Other: "Niet genoeg ruimte om de panelen te renderen",
|
||||||
|
}, &i18n.Message{
|
||||||
|
ID: "DiffTitle",
|
||||||
|
Other: "Diff",
|
||||||
|
}, &i18n.Message{
|
||||||
|
ID: "FilesTitle",
|
||||||
|
Other: "Bestanden",
|
||||||
|
}, &i18n.Message{
|
||||||
|
ID: "BranchesTitle",
|
||||||
|
Other: "Branches",
|
||||||
|
}, &i18n.Message{
|
||||||
|
ID: "CommitsTitle",
|
||||||
|
Other: "Commits",
|
||||||
|
}, &i18n.Message{
|
||||||
|
ID: "StashTitle",
|
||||||
|
Other: "Stash",
|
||||||
|
}, &i18n.Message{
|
||||||
|
ID: "CommitMessage",
|
||||||
|
Other: "Commit Bericht",
|
||||||
|
}, &i18n.Message{
|
||||||
|
ID: "CommitChanges",
|
||||||
|
Other: "Commit Veranderingen",
|
||||||
|
}, &i18n.Message{
|
||||||
|
ID: "StatusTitle",
|
||||||
|
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 i18nObject
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package main
|
package lang
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/BurntSushi/toml"
|
"github.com/BurntSushi/toml"
|
||||||
@ -11,76 +11,11 @@ func getlocalizer() *i18n.Localizer {
|
|||||||
|
|
||||||
// TODO: currently the system language issn't detected
|
// TODO: currently the system language issn't detected
|
||||||
// I'm not sure how to detect it
|
// I'm not sure how to detect it
|
||||||
var i18nObject = &i18n.Bundle{DefaultLanguage: language.English}
|
var i18nObject = &i18n.Bundle{DefaultLanguage: language.Dutch}
|
||||||
i18nObject.RegisterUnmarshalFunc("toml", toml.Unmarshal)
|
i18nObject.RegisterUnmarshalFunc("toml", toml.Unmarshal)
|
||||||
|
|
||||||
// To add more translations do:
|
// add translation file(s)
|
||||||
// AddMessages(tag language.Tag, messages ...*Message)
|
i18nObject = addDutch(i18nObject)
|
||||||
// https://godoc.org/github.com/nicksnyder/go-i18n/v2/i18n#Bundle.AddMessages
|
|
||||||
|
|
||||||
// Dutch translation for some words
|
|
||||||
i18nObject.AddMessages(language.Dutch,
|
|
||||||
&i18n.Message{
|
|
||||||
ID: "FilesTitle",
|
|
||||||
Other: "Bestanden",
|
|
||||||
}, &i18n.Message{
|
|
||||||
ID: "BranchesTitle",
|
|
||||||
Other: "Branches",
|
|
||||||
}, &i18n.Message{
|
|
||||||
ID: "CommitsTitle",
|
|
||||||
Other: "Commits",
|
|
||||||
}, &i18n.Message{
|
|
||||||
ID: "StashTitle",
|
|
||||||
Other: "Stash",
|
|
||||||
}, &i18n.Message{
|
|
||||||
ID: "CommitMessage",
|
|
||||||
Other: "Commit Bericht",
|
|
||||||
}, &i18n.Message{
|
|
||||||
ID: "CommitChanges",
|
|
||||||
Other: "Commit Veranderingen",
|
|
||||||
}, &i18n.Message{
|
|
||||||
ID: "StatusTitle",
|
|
||||||
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)
|
||||||
}
|
}
|
||||||
@ -88,18 +23,18 @@ func getlocalizer() *i18n.Localizer {
|
|||||||
// setup the localizer for later use
|
// setup the localizer for later use
|
||||||
var localizer = getlocalizer()
|
var localizer = getlocalizer()
|
||||||
|
|
||||||
// MustLocalize handels the translations
|
// Localize handels the translations
|
||||||
// expects i18n.LocalizeConfig as input: https://godoc.org/github.com/nicksnyder/go-i18n/v2/i18n#Localizer.MustLocalize
|
// expects i18n.LocalizeConfig as input: https://godoc.org/github.com/nicksnyder/go-i18n/v2/i18n#Localizer.MustLocalize
|
||||||
// output: translated string
|
// output: translated string
|
||||||
func MustLocalize(config *i18n.LocalizeConfig) string {
|
func Localize(config *i18n.LocalizeConfig) string {
|
||||||
return localizer.MustLocalize(config)
|
return localizer.MustLocalize(config)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ShortLocalize is for 1 line localizations
|
// SLocalize (short localize) is for 1 line localizations
|
||||||
// ID: The id that is used in the .toml translation files
|
// ID: The id that is used in the .toml translation files
|
||||||
// Other: the default message it needs to return if there is no translation found or the system is english
|
// Other: the default message it needs to return if there is no translation found or the system is english
|
||||||
func ShortLocalize(ID string, Other string) string {
|
func SLocalize(ID string, Other string) string {
|
||||||
return MustLocalize(&i18n.LocalizeConfig{
|
return Localize(&i18n.LocalizeConfig{
|
||||||
DefaultMessage: &i18n.Message{
|
DefaultMessage: &i18n.Message{
|
||||||
ID: ID,
|
ID: ID,
|
||||||
Other: Other,
|
Other: Other,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user