chore(i18n): move InitialViewTabContextMap to gui package

This commit is contained in:
Ryooooooga 2022-05-18 21:09:48 +09:00
parent 5275161a88
commit bfefef92a6
No known key found for this signature in database
GPG key ID: 07CF200DFCC20C25
3 changed files with 42 additions and 43 deletions

View file

@ -343,7 +343,7 @@ func (gui *Gui) resetState(filterPath string, reuseState bool) {
Diffing: diffing.New(),
},
ViewContextMap: viewContextMap,
ViewTabContextMap: contextTree.InitialViewTabContextMap(gui.c.Tr),
ViewTabContextMap: gui.initialViewTabContextMap(contextTree),
ScreenMode: screenMode,
// TODO: put contexts in the context manager
ContextManager: NewContextManager(initialContext),
@ -466,6 +466,45 @@ func (gui *Gui) initGocui() (*gocui.Gui, error) {
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
func (gui *Gui) Run(filterPath string) error {
g, err := gui.initGocui()