mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-03-05 15:15:49 +02:00
Put all worktree i18n strings together
Use tabwriter to align worktree panel contents
This commit is contained in:
parent
54708233ac
commit
35e6e6347a
@ -2,6 +2,8 @@ package controllers
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"text/tabwriter"
|
||||
|
||||
"github.com/jesseduffield/lazygit/pkg/commands/models"
|
||||
"github.com/jesseduffield/lazygit/pkg/gui/context"
|
||||
@ -53,27 +55,32 @@ func (self *WorktreesController) GetOnRenderToMain() func() error {
|
||||
var task types.UpdateTask
|
||||
worktree := self.context().GetSelected()
|
||||
if worktree == nil {
|
||||
task = types.NewRenderStringTask("No worktrees")
|
||||
task = types.NewRenderStringTask(self.c.Tr.NoWorktreesThisRepo)
|
||||
} else {
|
||||
main := ""
|
||||
if worktree.Main() {
|
||||
main = style.FgDefault.Sprintf(" %s", self.c.Tr.MainWorktree)
|
||||
}
|
||||
|
||||
missing := ""
|
||||
if worktree.Missing() {
|
||||
missing = style.FgRed.Sprint(" (missing)")
|
||||
missing = style.FgRed.Sprintf(" %s", self.c.Tr.MissingWorktree)
|
||||
}
|
||||
task = types.NewRenderStringTask(
|
||||
fmt.Sprintf(
|
||||
"Name: %s\nBranch: %s\nPath: %s%s\n",
|
||||
style.FgGreen.Sprint(worktree.Name()),
|
||||
style.FgYellow.Sprint(worktree.Branch),
|
||||
style.FgCyan.Sprint(worktree.Path),
|
||||
missing,
|
||||
),
|
||||
)
|
||||
|
||||
var builder strings.Builder
|
||||
w := tabwriter.NewWriter(&builder, 0, 0, 2, ' ', 0)
|
||||
_, _ = fmt.Fprintf(w, "%s:\t%s%s\n", self.c.Tr.Name, style.FgGreen.Sprint(worktree.Name()), main)
|
||||
_, _ = fmt.Fprintf(w, "%s:\t%s\n", self.c.Tr.Branch, style.FgYellow.Sprint(worktree.Branch))
|
||||
_, _ = fmt.Fprintf(w, "%s:\t%s%s\n", self.c.Tr.Path, style.FgCyan.Sprint(worktree.Path), missing)
|
||||
_ = w.Flush()
|
||||
|
||||
task = types.NewRenderStringTask(builder.String())
|
||||
}
|
||||
|
||||
return self.c.RenderToMainViews(types.RefreshMainOpts{
|
||||
Pair: self.c.MainViewPairs().Normal,
|
||||
Main: &types.ViewUpdateOpts{
|
||||
Title: "Worktree",
|
||||
Title: self.c.Tr.WorktreeTitle,
|
||||
Task: task,
|
||||
},
|
||||
})
|
||||
|
@ -200,7 +200,6 @@ type TranslationSet struct {
|
||||
TagsTitle string
|
||||
MenuTitle string
|
||||
RemotesTitle string
|
||||
WorktreesTitle string
|
||||
RemoteBranchesTitle string
|
||||
PatchBuildingTitle string
|
||||
InformationTitle string
|
||||
@ -546,10 +545,18 @@ type TranslationSet struct {
|
||||
EnterWorktree string
|
||||
DeleteWorktree string
|
||||
DeleteWorktreeTitle string
|
||||
WorktreesTitle string
|
||||
WorktreeTitle string
|
||||
DeleteWorktreePrompt string
|
||||
ForceDeleteWorktreePrompt string
|
||||
CantDeleteCurrentWorktree string
|
||||
CantDeleteMainWorktree string
|
||||
NoWorktreesThisRepo string
|
||||
MissingWorktree string
|
||||
MainWorktree string
|
||||
Name string
|
||||
Branch string
|
||||
Path string
|
||||
Actions Actions
|
||||
Bisect Bisect
|
||||
}
|
||||
@ -907,7 +914,6 @@ func EnglishTranslationSet() TranslationSet {
|
||||
TagsTitle: "Tags",
|
||||
MenuTitle: "Menu",
|
||||
RemotesTitle: "Remotes",
|
||||
WorktreesTitle: "Worktrees",
|
||||
RemoteBranchesTitle: "Remote branches",
|
||||
PatchBuildingTitle: "Main panel (patch building)",
|
||||
InformationTitle: "Information",
|
||||
@ -1251,6 +1257,8 @@ func EnglishTranslationSet() TranslationSet {
|
||||
SearchKeybindings: "%s: Next match, %s: Previous match, %s: Exit search mode",
|
||||
SearchPrefix: "Search: ",
|
||||
FilterPrefix: "Filter: ",
|
||||
WorktreesTitle: "Worktrees",
|
||||
WorktreeTitle: "Worktree",
|
||||
EnterWorktree: "Enter worktree",
|
||||
DeleteWorktree: "Delete worktree",
|
||||
DeleteWorktreeTitle: "Delete worktree",
|
||||
@ -1258,6 +1266,12 @@ func EnglishTranslationSet() TranslationSet {
|
||||
ForceDeleteWorktreePrompt: "'{{.worktreeName}}' is not fully merged. Are you sure you want to delete it?",
|
||||
CantDeleteCurrentWorktree: "You cannot delete the current worktree!",
|
||||
CantDeleteMainWorktree: "You cannot delete the main worktree!",
|
||||
NoWorktreesThisRepo: "No worktrees",
|
||||
MissingWorktree: "(missing)",
|
||||
MainWorktree: "(main)",
|
||||
Name: "Name",
|
||||
Branch: "Branch",
|
||||
Path: "Path",
|
||||
Actions: Actions{
|
||||
// TODO: combine this with the original keybinding descriptions (those are all in lowercase atm)
|
||||
CheckoutCommit: "Checkout commit",
|
||||
|
Loading…
x
Reference in New Issue
Block a user