Translate the "submodule" label in the files panel

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Stefan Haller
2026-10-15 09:13:12 +02:00
co-authored by Claude Opus 5.5
parent 2ddeebca72
commit 8b79e1dc1f
4 changed files with 9 additions and 4 deletions
+1 -1
View File
@@ -34,7 +34,7 @@ func NewWorkingTreeContext(c *ContextCommon) *WorkingTreeContext {
getDisplayStrings := func(_ int, _ int) [][]string {
showFileIcons := icons.IsIconEnabled() && c.UserConfig().Gui.ShowFileIcons
showNumstat := c.UserConfig().Gui.ShowNumstatInFilesView
lines := presentation.RenderFileTree(viewModel, c.Model().Submodules, showFileIcons, showNumstat, &c.UserConfig().Gui.CustomIcons, c.UserConfig().Gui.ShowRootItemInFileTree)
lines := presentation.RenderFileTree(viewModel, c.Model().Submodules, showFileIcons, showNumstat, &c.UserConfig().Gui.CustomIcons, c.UserConfig().Gui.ShowRootItemInFileTree, c.Tr)
return lo.Map(lines, func(line string, _ int) []string {
return []string{line}
})
+5 -2
View File
@@ -10,6 +10,7 @@ import (
"github.com/jesseduffield/lazygit/pkg/gui/filetree"
"github.com/jesseduffield/lazygit/pkg/gui/presentation/icons"
"github.com/jesseduffield/lazygit/pkg/gui/style"
"github.com/jesseduffield/lazygit/pkg/i18n"
"github.com/jesseduffield/lazygit/pkg/theme"
"github.com/jesseduffield/lazygit/pkg/utils"
)
@@ -26,12 +27,13 @@ func RenderFileTree(
showNumstat bool,
customIconsConfig *config.CustomIconsConfig,
showRootItem bool,
tr *i18n.TranslationSet,
) []string {
collapsedPaths := tree.CollapsedPaths()
return renderAux(tree.GetRoot().Raw(), collapsedPaths, -1, -1, func(node *filetree.Node[models.File], treeDepth int, visualDepth int, isCollapsed bool) string {
fileNode := filetree.NewFileNode(node)
return getFileLine(isCollapsed, fileNode.GetHasUnstagedChanges(), fileNode.GetHasStagedChanges(), treeDepth, visualDepth, showNumstat, showFileIcons, submoduleConfigs, node, customIconsConfig, showRootItem)
return getFileLine(isCollapsed, fileNode.GetHasUnstagedChanges(), fileNode.GetHasStagedChanges(), treeDepth, visualDepth, showNumstat, showFileIcons, submoduleConfigs, node, customIconsConfig, showRootItem, tr)
})
}
@@ -121,6 +123,7 @@ func getFileLine(
node *filetree.Node[models.File],
customIconsConfig *config.CustomIconsConfig,
showRootItem bool,
tr *i18n.TranslationSet,
) string {
name := fileNameAtDepth(node, treeDepth, showRootItem)
output := ""
@@ -169,7 +172,7 @@ func getFileLine(
output += nameColor.Sprint(utils.EscapeSpecialChars(name))
if isSubmodule {
output += theme.DefaultTextColor.Sprint(" (submodule)")
output += theme.DefaultTextColor.Sprint(" (" + tr.SubmoduleLabel + ")")
}
if file != nil && showNumstat {
+1 -1
View File
@@ -123,7 +123,7 @@ M file1
for _, path := range s.collapsedPaths {
viewModel.ToggleCollapsed(path)
}
result := RenderFileTree(viewModel, nil, false, s.showLineChanges, &config.CustomIconsConfig{}, s.showRootItem)
result := RenderFileTree(viewModel, nil, false, s.showLineChanges, &config.CustomIconsConfig{}, s.showRootItem, common.Tr)
assert.EqualValues(t, s.expected, result)
})
}
+2
View File
@@ -103,6 +103,7 @@ type TranslationSet struct {
MergeConflictTakeCurrentCommit string
MergeConflictTakeIncomingCommit string
SubmoduleMergeConflictDescription string
SubmoduleLabel string
StageConflictsRangeDisabled string
Checkout string
CheckoutTooltip string
@@ -1268,6 +1269,7 @@ func EnglishTranslationSet() *TranslationSet {
MergeConflictTakeCurrentCommit: "Take current commit",
MergeConflictTakeIncomingCommit: "Take incoming commit",
SubmoduleMergeConflictDescription: "Conflict: the submodule '{{.path}}' was set to a different commit in the current and the incoming changes. Pick which commit to keep.",
SubmoduleLabel: "submodule",
StageConflictsRangeDisabled: "Cannot stage a selection that includes files with merge conflicts; resolve them individually with {{.goIntoKey}} first.",
Checkout: "Checkout",
CheckoutTooltip: "Checkout selected item.",