1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-12-01 22:52:01 +02:00

type i18n

This commit is contained in:
Jesse Duffield
2020-10-04 11:00:48 +11:00
parent 7d9aa97f96
commit 37bb89dac3
104 changed files with 2049 additions and 15185 deletions

View File

@@ -38,7 +38,7 @@ func (gui *Gui) selectFile(alreadySelected bool) error {
return gui.refreshMainViews(refreshMainOpts{
main: &viewUpdateOpts{
title: "",
task: gui.createRenderStringTask(gui.Tr.SLocalize("NoChangedFiles")),
task: gui.createRenderStringTask(gui.Tr.NoChangedFiles),
},
})
}
@@ -61,7 +61,7 @@ func (gui *Gui) selectFile(alreadySelected bool) error {
cmd := gui.OSCommand.ExecutableFromString(cmdStr)
refreshOpts := refreshMainOpts{main: &viewUpdateOpts{
title: gui.Tr.SLocalize("UnstagedChanges"),
title: gui.Tr.UnstagedChanges,
task: gui.createRunPtyTask(cmd),
}}
@@ -70,11 +70,11 @@ func (gui *Gui) selectFile(alreadySelected bool) error {
cmd := gui.OSCommand.ExecutableFromString(cmdStr)
refreshOpts.secondary = &viewUpdateOpts{
title: gui.Tr.SLocalize("StagedChanges"),
title: gui.Tr.StagedChanges,
task: gui.createRunPtyTask(cmd),
}
} else if !file.HasUnstagedChanges {
refreshOpts.main.title = gui.Tr.SLocalize("StagedChanges")
refreshOpts.main.title = gui.Tr.StagedChanges
}
return gui.refreshMainViews(refreshOpts)
@@ -181,7 +181,7 @@ func (gui *Gui) enterFile(forceSecondaryFocused bool, selectedLineIdx int) error
return gui.handleSwitchToMerge()
}
if file.HasMergeConflicts {
return gui.createErrorPanel(gui.Tr.SLocalize("FileStagingRequirements"))
return gui.createErrorPanel(gui.Tr.FileStagingRequirements)
}
gui.switchContext(gui.Contexts.Staging.Context)
@@ -257,8 +257,8 @@ func (gui *Gui) handleIgnoreFile(g *gocui.Gui, v *gocui.View) error {
if file.Tracked {
return gui.ask(askOpts{
title: gui.Tr.SLocalize("IgnoreTracked"),
prompt: gui.Tr.SLocalize("IgnoreTrackedPrompt"),
title: gui.Tr.IgnoreTracked,
prompt: gui.Tr.IgnoreTrackedPrompt,
handleConfirm: func() error {
if err := gui.GitCommand.Ignore(file.Name); err != nil {
return err
@@ -281,7 +281,7 @@ func (gui *Gui) handleIgnoreFile(g *gocui.Gui, v *gocui.View) error {
func (gui *Gui) handleWIPCommitPress(g *gocui.Gui, filesView *gocui.View) error {
skipHookPreifx := gui.Config.GetUserConfig().Git.SkipHookPrefix
if skipHookPreifx == "" {
return gui.createErrorPanel(gui.Tr.SLocalize("SkipHookPrefixNotConfigured"))
return gui.createErrorPanel(gui.Tr.SkipHookPrefixNotConfigured)
}
gui.renderStringSync("commitMessage", skipHookPreifx)
@@ -315,7 +315,7 @@ func (gui *Gui) handleCommitPress() error {
prefixReplace := commitPrefixConfig.Replace
rgx, err := regexp.Compile(prefixPattern)
if err != nil {
return gui.createErrorPanel(fmt.Sprintf("%s: %s", gui.Tr.SLocalize("commitPrefixPatternError"), err.Error()))
return gui.createErrorPanel(fmt.Sprintf("%s: %s", gui.Tr.LcCommitPrefixPatternError, err.Error()))
}
prefix := rgx.ReplaceAllString(gui.getCheckedOutBranch().Name, prefixReplace)
gui.renderString("commitMessage", prefix)
@@ -337,8 +337,8 @@ func (gui *Gui) handleCommitPress() error {
func (gui *Gui) promptToStageAllAndRetry(retry func() error) error {
return gui.ask(askOpts{
title: gui.Tr.SLocalize("NoFilesStagedTitle"),
prompt: gui.Tr.SLocalize("NoFilesStagedPrompt"),
title: gui.Tr.NoFilesStagedTitle,
prompt: gui.Tr.NoFilesStagedPrompt,
handleConfirm: func() error {
if err := gui.GitCommand.StageAll(); err != nil {
return gui.surfaceError(err)
@@ -360,14 +360,14 @@ func (gui *Gui) handleAmendCommitPress() error {
}
if len(gui.State.Commits) == 0 {
return gui.createErrorPanel(gui.Tr.SLocalize("NoCommitToAmend"))
return gui.createErrorPanel(gui.Tr.NoCommitToAmend)
}
return gui.ask(askOpts{
title: strings.Title(gui.Tr.SLocalize("AmendLastCommit")),
prompt: gui.Tr.SLocalize("SureToAmend"),
title: strings.Title(gui.Tr.AmendLastCommit),
prompt: gui.Tr.SureToAmend,
handleConfirm: func() error {
return gui.WithWaitingStatus(gui.Tr.SLocalize("AmendingStatus"), func() error {
return gui.WithWaitingStatus(gui.Tr.AmendingStatus, func() error {
ok, err := gui.runSyncOrAsyncCommand(gui.GitCommand.AmendHead())
if err != nil {
return err
@@ -484,7 +484,7 @@ func (gui *Gui) handlePullFiles(g *gocui.Gui, v *gocui.View) error {
}
}
return gui.prompt(gui.Tr.SLocalize("EnterUpstream"), "origin/"+currentBranch.Name, func(upstream string) error {
return gui.prompt(gui.Tr.EnterUpstream, "origin/"+currentBranch.Name, func(upstream string) error {
if err := gui.GitCommand.SetUpstreamBranch(upstream); err != nil {
errorMessage := err.Error()
if strings.Contains(errorMessage, "does not exist") {
@@ -505,7 +505,7 @@ type PullFilesOptions struct {
}
func (gui *Gui) pullFiles(opts PullFilesOptions) error {
if err := gui.createLoaderPanel(gui.g.CurrentView(), gui.Tr.SLocalize("PullWait")); err != nil {
if err := gui.createLoaderPanel(gui.g.CurrentView(), gui.Tr.PullWait); err != nil {
return err
}
@@ -548,7 +548,7 @@ func (gui *Gui) pullWithMode(mode string, opts PullFilesOptions) error {
}
func (gui *Gui) pushWithForceFlag(v *gocui.View, force bool, upstream string, args string) error {
if err := gui.createLoaderPanel(v, gui.Tr.SLocalize("PushWait")); err != nil {
if err := gui.createLoaderPanel(v, gui.Tr.PushWait); err != nil {
return err
}
go func() {
@@ -557,12 +557,12 @@ func (gui *Gui) pushWithForceFlag(v *gocui.View, force bool, upstream string, ar
if err != nil && !force && strings.Contains(err.Error(), "Updates were rejected") {
forcePushDisabled := gui.Config.GetUserConfig().Git.DisableForcePushing
if forcePushDisabled {
gui.createErrorPanel(gui.Tr.SLocalize("UpdatesRejectedAndForcePushDisabled"))
gui.createErrorPanel(gui.Tr.UpdatesRejectedAndForcePushDisabled)
return
}
gui.ask(askOpts{
title: gui.Tr.SLocalize("ForcePush"),
prompt: gui.Tr.SLocalize("ForcePushPrompt"),
title: gui.Tr.ForcePush,
prompt: gui.Tr.ForcePushPrompt,
handleConfirm: func() error {
return gui.pushWithForceFlag(v, true, upstream, args)
},
@@ -598,7 +598,7 @@ func (gui *Gui) pushFiles(g *gocui.Gui, v *gocui.View) error {
if gui.GitCommand.PushToCurrent {
return gui.pushWithForceFlag(v, false, "", "--set-upstream")
} else {
return gui.prompt(gui.Tr.SLocalize("EnterUpstream"), "origin "+currentBranch.Name, func(response string) error {
return gui.prompt(gui.Tr.EnterUpstream, "origin "+currentBranch.Name, func(response string) error {
return gui.pushWithForceFlag(v, false, response, "")
})
}
@@ -608,12 +608,12 @@ func (gui *Gui) pushFiles(g *gocui.Gui, v *gocui.View) error {
forcePushDisabled := gui.Config.GetUserConfig().Git.DisableForcePushing
if forcePushDisabled {
return gui.createErrorPanel(gui.Tr.SLocalize("ForcePushDisabled"))
return gui.createErrorPanel(gui.Tr.ForcePushDisabled)
}
return gui.ask(askOpts{
title: gui.Tr.SLocalize("ForcePush"),
prompt: gui.Tr.SLocalize("ForcePushPrompt"),
title: gui.Tr.ForcePush,
prompt: gui.Tr.ForcePushPrompt,
handleConfirm: func() error {
return gui.pushWithForceFlag(v, true, "", "")
},
@@ -627,7 +627,7 @@ func (gui *Gui) handleSwitchToMerge() error {
}
if !file.HasInlineMergeConflicts {
return gui.createErrorPanel(gui.Tr.SLocalize("FileNoMergeCons"))
return gui.createErrorPanel(gui.Tr.FileNoMergeCons)
}
return gui.switchContext(gui.Contexts.Merging.Context)
@@ -650,7 +650,7 @@ func (gui *Gui) anyFilesWithMergeConflicts() bool {
}
func (gui *Gui) handleCustomCommand(g *gocui.Gui, v *gocui.View) error {
return gui.prompt(gui.Tr.SLocalize("CustomCommand"), "", func(command string) error {
return gui.prompt(gui.Tr.CustomCommand, "", func(command string) error {
gui.SubProcess = gui.OSCommand.RunCustomCommand(command)
return gui.Errors.ErrSubProcess
})
@@ -659,20 +659,20 @@ func (gui *Gui) handleCustomCommand(g *gocui.Gui, v *gocui.View) error {
func (gui *Gui) handleCreateStashMenu(g *gocui.Gui, v *gocui.View) error {
menuItems := []*menuItem{
{
displayString: gui.Tr.SLocalize("stashAllChanges"),
displayString: gui.Tr.LcStashAllChanges,
onPress: func() error {
return gui.handleStashSave(gui.GitCommand.StashSave)
},
},
{
displayString: gui.Tr.SLocalize("stashStagedChanges"),
displayString: gui.Tr.LcStashStagedChanges,
onPress: func() error {
return gui.handleStashSave(gui.GitCommand.StashSaveStagedChanges)
},
},
}
return gui.createMenu(gui.Tr.SLocalize("stashOptions"), menuItems, createMenuOptions{showCancel: true})
return gui.createMenu(gui.Tr.LcStashOptions, menuItems, createMenuOptions{showCancel: true})
}
func (gui *Gui) handleStashChanges(g *gocui.Gui, v *gocui.View) error {