1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-03-19 21:28:28 +02:00

Merge pull request #1936 from Ryooooooga/feature/tab-i18n

This commit is contained in:
Jesse Duffield 2022-05-18 22:24:45 +10:00 committed by GitHub
commit 8fd9dea641
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 105 additions and 97 deletions

View File

@ -41,28 +41,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
<kbd>[</kbd>: previous tab <kbd>[</kbd>: previous tab
</pre> </pre>
## Branches
<pre>
<kbd>ctrl+o</kbd>: copy branch name to clipboard
<kbd>i</kbd>: show git-flow options
<kbd>space</kbd>: checkout
<kbd>n</kbd>: new branch
<kbd>o</kbd>: create pull request
<kbd>O</kbd>: create pull request options
<kbd>ctrl+y</kbd>: copy pull request URL to clipboard
<kbd>c</kbd>: checkout by name
<kbd>F</kbd>: force checkout
<kbd>d</kbd>: delete branch
<kbd>r</kbd>: rebase checked-out branch onto this branch
<kbd>M</kbd>: merge into currently checked out branch
<kbd>f</kbd>: fast-forward this branch from its upstream
<kbd>g</kbd>: view reset options
<kbd>R</kbd>: rename branch
<kbd>u</kbd>: set/unset upstream
<kbd>enter</kbd>: view commits
</pre>
## Commit Files ## Commit Files
<pre> <pre>
@ -137,6 +115,28 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
<kbd>f</kbd>: fetch <kbd>f</kbd>: fetch
</pre> </pre>
## Local Branches
<pre>
<kbd>ctrl+o</kbd>: copy branch name to clipboard
<kbd>i</kbd>: show git-flow options
<kbd>space</kbd>: checkout
<kbd>n</kbd>: new branch
<kbd>o</kbd>: create pull request
<kbd>O</kbd>: create pull request options
<kbd>ctrl+y</kbd>: copy pull request URL to clipboard
<kbd>c</kbd>: checkout by name
<kbd>F</kbd>: force checkout
<kbd>d</kbd>: delete branch
<kbd>r</kbd>: rebase checked-out branch onto this branch
<kbd>M</kbd>: merge into currently checked out branch
<kbd>f</kbd>: fast-forward this branch from its upstream
<kbd>g</kbd>: view reset options
<kbd>R</kbd>: rename branch
<kbd>u</kbd>: set/unset upstream
<kbd>enter</kbd>: view commits
</pre>
## Main Panel (Merging) ## Main Panel (Merging)
<pre> <pre>

View File

@ -194,10 +194,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
<kbd>R</kbd>: ブランチ名を変更 <kbd>R</kbd>: ブランチ名を変更
<kbd>u</kbd>: set/unset upstream <kbd>u</kbd>: set/unset upstream
<kbd>enter</kbd>: コミットを閲覧 <kbd>enter</kbd>: コミットを閲覧
<kbd>f</kbd>: リモートをfetch
<kbd>n</kbd>: リモートを新規追加
<kbd>d</kbd>: リモートを削除
<kbd>e</kbd>: リモートを編集
</pre> </pre>
## メインパネル (Merging) ## メインパネル (Merging)
@ -259,6 +255,15 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
<kbd>E</kbd>: edit hunk <kbd>E</kbd>: edit hunk
</pre> </pre>
## リモート
<pre>
<kbd>f</kbd>: リモートをfetch
<kbd>n</kbd>: リモートを新規追加
<kbd>d</kbd>: リモートを削除
<kbd>e</kbd>: リモートを編集
</pre>
## リモートブランチ ## リモートブランチ
<pre> <pre>

View File

@ -41,28 +41,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
<kbd>[</kbd>: previous tab <kbd>[</kbd>: previous tab
</pre> </pre>
## Branches
<pre>
<kbd>ctrl+o</kbd>: copy branch name to clipboard
<kbd>i</kbd>: show git-flow options
<kbd>space</kbd>: przełącz
<kbd>n</kbd>: nowa gałąź
<kbd>o</kbd>: utwórz żądanie pobrania
<kbd>O</kbd>: utwórz opcje żądania ściągnięcia
<kbd>ctrl+y</kbd>: skopiuj adres URL żądania pobrania do schowka
<kbd>c</kbd>: przełącz używając nazwy
<kbd>F</kbd>: wymuś przełączenie
<kbd>d</kbd>: usuń gałąź
<kbd>r</kbd>: zmiana bazy gałęzi
<kbd>M</kbd>: scal do obecnej gałęzi
<kbd>f</kbd>: fast-forward this branch from its upstream
<kbd>g</kbd>: wyświetl opcje resetu
<kbd>R</kbd>: rename branch
<kbd>u</kbd>: set/unset upstream
<kbd>enter</kbd>: view commits
</pre>
## Commity ## Commity
<pre> <pre>
@ -96,6 +74,28 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
<kbd>enter</kbd>: przeglądaj pliki commita <kbd>enter</kbd>: przeglądaj pliki commita
</pre> </pre>
## Local Branches
<pre>
<kbd>ctrl+o</kbd>: copy branch name to clipboard
<kbd>i</kbd>: show git-flow options
<kbd>space</kbd>: przełącz
<kbd>n</kbd>: nowa gałąź
<kbd>o</kbd>: utwórz żądanie pobrania
<kbd>O</kbd>: utwórz opcje żądania ściągnięcia
<kbd>ctrl+y</kbd>: skopiuj adres URL żądania pobrania do schowka
<kbd>c</kbd>: przełącz używając nazwy
<kbd>F</kbd>: wymuś przełączenie
<kbd>d</kbd>: usuń gałąź
<kbd>r</kbd>: zmiana bazy gałęzi
<kbd>M</kbd>: scal do obecnej gałęzi
<kbd>f</kbd>: fast-forward this branch from its upstream
<kbd>g</kbd>: wyświetl opcje resetu
<kbd>R</kbd>: rename branch
<kbd>u</kbd>: set/unset upstream
<kbd>enter</kbd>: view commits
</pre>
## Main Panel (Patch Building) ## Main Panel (Patch Building)
<pre> <pre>

View File

@ -13,7 +13,7 @@ func (gui *Gui) branchesRenderToMain() error {
return gui.refreshMainViews(refreshMainOpts{ return gui.refreshMainViews(refreshMainOpts{
main: &viewUpdateOpts{ main: &viewUpdateOpts{
title: "Log", title: gui.c.Tr.LogTitle,
task: task, task: task,
}, },
}) })

View File

@ -143,42 +143,3 @@ type TabContext struct {
Tab string Tab string
Context types.Context Context types.Context
} }
func (tree ContextTree) InitialViewTabContextMap() map[string][]TabContext {
return map[string][]TabContext{
"branches": {
{
Tab: "Local Branches",
Context: tree.Branches,
},
{
Tab: "Remotes",
Context: tree.Remotes,
},
{
Tab: "Tags",
Context: tree.Tags,
},
},
"commits": {
{
Tab: "Commits",
Context: tree.LocalCommits,
},
{
Tab: "Reflog",
Context: tree.ReflogCommits,
},
},
"files": {
{
Tab: "Files",
Context: tree.Files,
},
{
Tab: "Submodules",
Context: tree.Submodules,
},
},
}
}

View File

@ -343,7 +343,7 @@ func (gui *Gui) resetState(filterPath string, reuseState bool) {
Diffing: diffing.New(), Diffing: diffing.New(),
}, },
ViewContextMap: viewContextMap, ViewContextMap: viewContextMap,
ViewTabContextMap: contextTree.InitialViewTabContextMap(), ViewTabContextMap: gui.initialViewTabContextMap(contextTree),
ScreenMode: screenMode, ScreenMode: screenMode,
// TODO: put contexts in the context manager // TODO: put contexts in the context manager
ContextManager: NewContextManager(initialContext), ContextManager: NewContextManager(initialContext),
@ -466,6 +466,45 @@ func (gui *Gui) initGocui() (*gocui.Gui, error) {
return g, nil return g, nil
} }
func (gui *Gui) initialViewTabContextMap(contextTree *context.ContextTree) map[string][]context.TabContext {
return map[string][]context.TabContext{
"branches": {
{
Tab: gui.c.Tr.LocalBranchesTitle,
Context: contextTree.Branches,
},
{
Tab: gui.c.Tr.RemotesTitle,
Context: contextTree.Remotes,
},
{
Tab: gui.c.Tr.TagsTitle,
Context: contextTree.Tags,
},
},
"commits": {
{
Tab: gui.c.Tr.CommitsTitle,
Context: contextTree.LocalCommits,
},
{
Tab: gui.c.Tr.ReflogCommitsTitle,
Context: contextTree.ReflogCommits,
},
},
"files": {
{
Tab: gui.c.Tr.FilesTitle,
Context: contextTree.Files,
},
{
Tab: gui.c.Tr.SubmodulesTitle,
Context: contextTree.Submodules,
},
},
}
}
// Run: setup the gui with keybindings and start the mainloop // Run: setup the gui with keybindings and start the mainloop
func (gui *Gui) Run(filterPath string) error { func (gui *Gui) Run(filterPath string) error {
g, err := gui.initGocui() g, err := gui.initGocui()

View File

@ -868,7 +868,7 @@ func (self *Gui) GetInitialKeybindings() ([]*types.Binding, []*gocui.ViewMouseBi
} }
} }
for viewName := range self.State.Contexts.InitialViewTabContextMap() { for viewName := range self.initialViewTabContextMap(self.State.Contexts) {
bindings = append(bindings, []*types.Binding{ bindings = append(bindings, []*types.Binding{
{ {
ViewName: viewName, ViewName: viewName,
@ -914,7 +914,7 @@ func (gui *Gui) resetKeybindings() error {
} }
} }
for viewName := range gui.State.Contexts.InitialViewTabContextMap() { for viewName := range gui.initialViewTabContextMap(gui.State.Contexts) {
viewName := viewName viewName := viewName
tabClickCallback := func(tabIndex int) error { return gui.onViewTabClick(viewName, tabIndex) } tabClickCallback := func(tabIndex int) error { return gui.onViewTabClick(viewName, tabIndex) }

View File

@ -39,7 +39,7 @@ func (gui *Gui) handleShowAllBranchLogs() error {
return gui.refreshMainViews(refreshMainOpts{ return gui.refreshMainViews(refreshMainOpts{
main: &viewUpdateOpts{ main: &viewUpdateOpts{
title: "Log", title: gui.c.Tr.LogTitle,
task: task, task: task,
}, },
}) })

View File

@ -24,6 +24,7 @@ type TranslationSet struct {
MergingTitle string MergingTitle string
MergeConfirmTitle string MergeConfirmTitle string
NormalTitle string NormalTitle string
LogTitle string
CommitMessage string CommitMessage string
CredentialsUsername string CredentialsUsername string
CredentialsPassword string CredentialsPassword string
@ -647,6 +648,7 @@ func EnglishTranslationSet() TranslationSet {
StagingTitle: "Main Panel (Staging)", StagingTitle: "Main Panel (Staging)",
MergingTitle: "Main Panel (Merging)", MergingTitle: "Main Panel (Merging)",
NormalTitle: "Main Panel (Normal)", NormalTitle: "Main Panel (Normal)",
LogTitle: "Log",
CommitMessage: "Commit message", CommitMessage: "Commit message",
CredentialsUsername: "Username", CredentialsUsername: "Username",
CredentialsPassword: "Password", CredentialsPassword: "Password",
@ -809,7 +811,7 @@ func EnglishTranslationSet() TranslationSet {
MergeOptionsTitle: "Merge Options", MergeOptionsTitle: "Merge Options",
RebaseOptionsTitle: "Rebase Options", RebaseOptionsTitle: "Rebase Options",
CommitMessageTitle: "Commit Message", CommitMessageTitle: "Commit Message",
LocalBranchesTitle: "Branches", LocalBranchesTitle: "Local Branches",
SearchTitle: "Search", SearchTitle: "Search",
TagsTitle: "Tags", TagsTitle: "Tags",
MenuTitle: "Menu", MenuTitle: "Menu",

View File

@ -33,6 +33,7 @@ func japaneseTranslationSet() TranslationSet {
StagingTitle: "メインパネル (Staging)", StagingTitle: "メインパネル (Staging)",
MergingTitle: "メインパネル (Merging)", MergingTitle: "メインパネル (Merging)",
NormalTitle: "メインパネル (Normal)", NormalTitle: "メインパネル (Normal)",
LogTitle: "ログ",
CommitMessage: "コミットメッセージ", CommitMessage: "コミットメッセージ",
CredentialsUsername: "ユーザ名", CredentialsUsername: "ユーザ名",
CredentialsPassword: "パスワード", CredentialsPassword: "パスワード",
@ -193,7 +194,7 @@ func japaneseTranslationSet() TranslationSet {
SearchTitle: "検索", SearchTitle: "検索",
TagsTitle: "タグ", TagsTitle: "タグ",
MenuTitle: "メニュー", MenuTitle: "メニュー",
RemotesTitle: "ブランチ", RemotesTitle: "リモート",
RemoteBranchesTitle: "リモートブランチ", RemoteBranchesTitle: "リモートブランチ",
PatchBuildingTitle: "メインパネル (Patch Building)", PatchBuildingTitle: "メインパネル (Patch Building)",
InformationTitle: "Information", InformationTitle: "Information",
@ -248,9 +249,9 @@ func japaneseTranslationSet() TranslationSet {
// CheckingOutStatus: "checking out", // CheckingOutStatus: "checking out",
// CommittingStatus: "committing", // CommittingStatus: "committing",
CommitFiles: "Commit files", CommitFiles: "Commit files",
SubCommitsDynamicTitle: "Commits (%s)", SubCommitsDynamicTitle: "コミット (%s)",
CommitFilesDynamicTitle: "Diff files (%s)", CommitFilesDynamicTitle: "Diff files (%s)",
RemoteBranchesDynamicTitle: "Remote branches (%s)", RemoteBranchesDynamicTitle: "リモートブランチ (%s)",
// LcViewItemFiles: "view selected item's files", // LcViewItemFiles: "view selected item's files",
CommitFilesTitle: "コミットファイル", CommitFilesTitle: "コミットファイル",
// LcCheckoutCommitFile: "checkout file", // LcCheckoutCommitFile: "checkout file",
@ -461,7 +462,7 @@ func japaneseTranslationSet() TranslationSet {
ShowingWhitespaceInDiffView: "空白文字の変更は差分画面に表示されます", ShowingWhitespaceInDiffView: "空白文字の変更は差分画面に表示されます",
// IncreaseContextInDiffView: "Increase the size of the context shown around changes in the diff view", // IncreaseContextInDiffView: "Increase the size of the context shown around changes in the diff view",
// DecreaseContextInDiffView: "Decrease the size of the context shown around changes in the diff view", // DecreaseContextInDiffView: "Decrease the size of the context shown around changes in the diff view",
CreatePullRequest: "pull requestを作成s", CreatePullRequest: "pull requestを作成",
// CreatePullRequestOptions: "Create pull request options", // CreatePullRequestOptions: "Create pull request options",
// LcCreatePullRequestOptions: "create pull request options", // LcCreatePullRequestOptions: "create pull request options",
LcDefaultBranch: "デフォルトブランチ", LcDefaultBranch: "デフォルトブランチ",