mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-04-13 11:50:28 +02:00
Add more i18n for worktrees
This commit is contained in:
parent
06be88aef7
commit
eecf07cd12
@ -216,9 +216,13 @@ func (self *BranchesController) worktreeForBranch(branch *models.Branch) (*model
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (self *BranchesController) promptToCheckoutWorktree(worktree *models.Worktree) error {
|
func (self *BranchesController) promptToCheckoutWorktree(worktree *models.Worktree) error {
|
||||||
|
prompt := utils.ResolvePlaceholderString(self.c.Tr.AlreadyCheckedOutByWorktree, map[string]string{
|
||||||
|
"worktreeName": worktree.Name,
|
||||||
|
})
|
||||||
|
|
||||||
return self.c.Confirm(types.ConfirmOpts{
|
return self.c.Confirm(types.ConfirmOpts{
|
||||||
Title: "Switch to worktree",
|
Title: self.c.Tr.SwitchToWorktree,
|
||||||
Prompt: fmt.Sprintf("This branch is checked out by worktree %s. Do you want to switch to that worktree?", worktree.Name),
|
Prompt: prompt,
|
||||||
HandleConfirm: func() error {
|
HandleConfirm: func() error {
|
||||||
return self.c.Helpers().Worktree.Switch(worktree, context.LOCAL_BRANCHES_CONTEXT_KEY)
|
return self.c.Helpers().Worktree.Switch(worktree, context.LOCAL_BRANCHES_CONTEXT_KEY)
|
||||||
},
|
},
|
||||||
@ -332,28 +336,33 @@ func (self *BranchesController) checkedOutByOtherWorktree(branch *models.Branch)
|
|||||||
func (self *BranchesController) promptWorktreeBranchDelete(selectedBranch *models.Branch) error {
|
func (self *BranchesController) promptWorktreeBranchDelete(selectedBranch *models.Branch) error {
|
||||||
worktree, ok := self.worktreeForBranch(selectedBranch)
|
worktree, ok := self.worktreeForBranch(selectedBranch)
|
||||||
if !ok {
|
if !ok {
|
||||||
self.c.Log.Error("CheckedOutByOtherWorktree out of sync with list of worktrees")
|
self.c.Log.Error("promptWorktreeBranchDelete out of sync with list of worktrees")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: i18n
|
||||||
|
title := utils.ResolvePlaceholderString(self.c.Tr.BranchCheckedOutByWorktree, map[string]string{
|
||||||
|
"worktreeName": worktree.Name,
|
||||||
|
"branchName": selectedBranch.Name,
|
||||||
|
})
|
||||||
return self.c.Menu(types.CreateMenuOptions{
|
return self.c.Menu(types.CreateMenuOptions{
|
||||||
Title: fmt.Sprintf("Branch %s is checked out by worktree %s", selectedBranch.Name, worktree.Name),
|
Title: title,
|
||||||
Items: []*types.MenuItem{
|
Items: []*types.MenuItem{
|
||||||
{
|
{
|
||||||
Label: "Switch to worktree",
|
Label: self.c.Tr.SwitchToWorktree,
|
||||||
OnPress: func() error {
|
OnPress: func() error {
|
||||||
return self.c.Helpers().Worktree.Switch(worktree, context.LOCAL_BRANCHES_CONTEXT_KEY)
|
return self.c.Helpers().Worktree.Switch(worktree, context.LOCAL_BRANCHES_CONTEXT_KEY)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Label: "Detach worktree",
|
Label: self.c.Tr.DetachWorktree,
|
||||||
Tooltip: "This will run `git checkout --detach` on the worktree so that it stops hogging the branch, but the worktree's working tree will be left alone",
|
Tooltip: self.c.Tr.DetachWorktreeTooltip,
|
||||||
OnPress: func() error {
|
OnPress: func() error {
|
||||||
return self.c.Helpers().Worktree.Detach(worktree)
|
return self.c.Helpers().Worktree.Detach(worktree)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Label: "Remove worktree",
|
Label: self.c.Tr.RemoveWorktree,
|
||||||
OnPress: func() error {
|
OnPress: func() error {
|
||||||
return self.c.Helpers().Worktree.Remove(worktree, false)
|
return self.c.Helpers().Worktree.Remove(worktree, false)
|
||||||
},
|
},
|
||||||
|
@ -151,7 +151,8 @@ func (self *ReposHelper) DispatchSwitchTo(path string, errMsg string, contextKey
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
self.c.LogCommand(fmt.Sprintf("Changing directory to %s", path), false)
|
msg := utils.ResolvePlaceholderString(self.c.Tr.ChangingDirectoryTo, map[string]string{"path": path})
|
||||||
|
self.c.LogCommand(msg, false)
|
||||||
|
|
||||||
if err := os.Chdir(path); err != nil {
|
if err := os.Chdir(path); err != nil {
|
||||||
if os.IsNotExist(err) {
|
if os.IsNotExist(err) {
|
||||||
|
@ -544,6 +544,9 @@ type TranslationSet struct {
|
|||||||
ExitSearchMode string
|
ExitSearchMode string
|
||||||
ExitTextFilterMode string
|
ExitTextFilterMode string
|
||||||
SwitchToWorktree string
|
SwitchToWorktree string
|
||||||
|
AlreadyCheckedOutByWorktree string
|
||||||
|
BranchCheckedOutByWorktree string
|
||||||
|
DetachWorktreeTooltip string
|
||||||
Switching string
|
Switching string
|
||||||
RemoveWorktree string
|
RemoveWorktree string
|
||||||
RemoveWorktreeTitle string
|
RemoveWorktreeTitle string
|
||||||
@ -571,6 +574,7 @@ type TranslationSet struct {
|
|||||||
CreateWorktreeFrom string
|
CreateWorktreeFrom string
|
||||||
CreateWorktreeFromDetached string
|
CreateWorktreeFromDetached string
|
||||||
LcWorktree string
|
LcWorktree string
|
||||||
|
ChangingDirectoryTo string
|
||||||
Name string
|
Name string
|
||||||
Branch string
|
Branch string
|
||||||
Path string
|
Path string
|
||||||
@ -1279,6 +1283,9 @@ func EnglishTranslationSet() TranslationSet {
|
|||||||
WorktreesTitle: "Worktrees",
|
WorktreesTitle: "Worktrees",
|
||||||
WorktreeTitle: "Worktree",
|
WorktreeTitle: "Worktree",
|
||||||
SwitchToWorktree: "Switch to worktree",
|
SwitchToWorktree: "Switch to worktree",
|
||||||
|
AlreadyCheckedOutByWorktree: "This branch is checked out by worktree {{.worktreeName}}. Do you want to switch to that worktree?",
|
||||||
|
BranchCheckedOutByWorktree: "Branch {{.branchName}} is checked out by worktree {{.worktreeName}}",
|
||||||
|
DetachWorktreeTooltip: "This will run `git checkout --detach` on the worktree so that it stops hogging the branch, but the worktree's working tree will be left alone",
|
||||||
Switching: "Switching",
|
Switching: "Switching",
|
||||||
RemoveWorktree: "Remove worktree",
|
RemoveWorktree: "Remove worktree",
|
||||||
RemoveWorktreeTitle: "Remove worktree",
|
RemoveWorktreeTitle: "Remove worktree",
|
||||||
@ -1304,6 +1311,7 @@ func EnglishTranslationSet() TranslationSet {
|
|||||||
CreateWorktreeFrom: "Create worktree from {{.ref}}",
|
CreateWorktreeFrom: "Create worktree from {{.ref}}",
|
||||||
CreateWorktreeFromDetached: "Create worktree from {{.ref}} (detached)",
|
CreateWorktreeFromDetached: "Create worktree from {{.ref}} (detached)",
|
||||||
LcWorktree: "worktree",
|
LcWorktree: "worktree",
|
||||||
|
ChangingDirectoryTo: "Changing directory to {{.path}}",
|
||||||
Name: "Name",
|
Name: "Name",
|
||||||
Branch: "Branch",
|
Branch: "Branch",
|
||||||
Path: "Path",
|
Path: "Path",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user