diff --git a/docs/keybindings/Keybindings_en.md b/docs/keybindings/Keybindings_en.md new file mode 100644 index 00000000..003a80e9 --- /dev/null +++ b/docs/keybindings/Keybindings_en.md @@ -0,0 +1,57 @@ +# Lazydocker menu + +## Status + +
+ e: edit config container + o: open config container + [: previous tab + ]: next tab + m: view logs ++ +## Containers + +
+ [: previous tab + ]: next tab + d: remove + s: stop + r: restart + a: attach + D: prune exited containers + m: view logs + c: run predefined custom command ++ +## Services + +
+ d: remove containers + s: stop + r: restart + a: attach + m: view logs + [: previous tab + ]: next tab + R: view restart options + c: run predefined custom command ++ +## Images + +
+ [: previous tab + ]: next tab + d: remove image + D: prune unused images ++ +## Volumes + +
+ [: previous tab + ]: next tab + d: remove volume + D: prune unused volumes +diff --git a/docs/keybindings/Keybindings_nl.md b/docs/keybindings/Keybindings_nl.md new file mode 100644 index 00000000..003a80e9 --- /dev/null +++ b/docs/keybindings/Keybindings_nl.md @@ -0,0 +1,57 @@ +# Lazydocker menu + +## Status + +
+ e: edit config container + o: open config container + [: previous tab + ]: next tab + m: view logs ++ +## Containers + +
+ [: previous tab + ]: next tab + d: remove + s: stop + r: restart + a: attach + D: prune exited containers + m: view logs + c: run predefined custom command ++ +## Services + +
+ d: remove containers + s: stop + r: restart + a: attach + m: view logs + [: previous tab + ]: next tab + R: view restart options + c: run predefined custom command ++ +## Images + +
+ [: previous tab + ]: next tab + d: remove image + D: prune unused images ++ +## Volumes + +
+ [: previous tab + ]: next tab + d: remove volume + D: prune unused volumes +diff --git a/docs/keybindings/Keybindings_pl.md b/docs/keybindings/Keybindings_pl.md new file mode 100644 index 00000000..003a80e9 --- /dev/null +++ b/docs/keybindings/Keybindings_pl.md @@ -0,0 +1,57 @@ +# Lazydocker menu + +## Status + +
+ e: edit config container + o: open config container + [: previous tab + ]: next tab + m: view logs ++ +## Containers + +
+ [: previous tab + ]: next tab + d: remove + s: stop + r: restart + a: attach + D: prune exited containers + m: view logs + c: run predefined custom command ++ +## Services + +
+ d: remove containers + s: stop + r: restart + a: attach + m: view logs + [: previous tab + ]: next tab + R: view restart options + c: run predefined custom command ++ +## Images + +
+ [: previous tab + ]: next tab + d: remove image + D: prune unused images ++ +## Volumes + +
+ [: previous tab + ]: next tab + d: remove volume + D: prune unused volumes +diff --git a/pkg/i18n/english.go b/pkg/i18n/english.go index 1db64eff..a3aab782 100644 --- a/pkg/i18n/english.go +++ b/pkg/i18n/english.go @@ -6,6 +6,8 @@ type TranslationSet struct { ErrorMessage string NotEnoughSpace string StatusTitle string + MainTitle string + GlobalTitle string Navigate string Menu string Execute string @@ -123,6 +125,8 @@ func englishSet() TranslationSet { AnonymousReportingTitle: "Help make lazydocker better", AnonymousReportingPrompt: "Would you like to enable anonymous reporting data to help improve lazydocker? (enter/esc)", + GlobalTitle: "Global", + MainTitle: "Main", StatusTitle: "Status", ServicesTitle: "Services", ContainersTitle: "Containers", diff --git a/scripts/generate_cheatsheet.go b/scripts/generate_cheatsheet.go index d4e834dd..f1e9d627 100644 --- a/scripts/generate_cheatsheet.go +++ b/scripts/generate_cheatsheet.go @@ -26,7 +26,10 @@ type bindingSection struct { func main() { langs := []string{"pl", "nl", "en"} - mConfig, _ := config.NewAppConfig("", "", "", "", "", true) + mConfig, err := config.NewAppConfig("lazydocker", "", "", "", "", true) + if err != nil { + panic(err) + } for _, lang := range langs { os.Setenv("LC_ALL", lang) @@ -49,12 +52,6 @@ func writeString(file *os.File, str string) { } } -func localisedTitle(mApp *app.App, str string) string { - return "" - // viewTitle := strings.Title(str) + "Title" - // return mApp.Tr.ViewTitle // FIXME: this used to be dynamic but we can't make this dynamic again without reflection since we're now using a struct of translation strings -} - func formatTitle(title string) string { return fmt.Sprintf("\n## %s\n\n", title) } @@ -66,7 +63,6 @@ func formatBinding(binding *gui.Binding) string { func getBindingSections(mApp *app.App) []*bindingSection { bindingSections := []*bindingSection{} - // TODO: add context-based keybindings for _, binding := range mApp.Gui.GetInitialKeybindings() { if binding.Description == "" { continue @@ -76,9 +72,18 @@ func getBindingSections(mApp *app.App) []*bindingSection { if viewName == "" { viewName = "global" } - title := localisedTitle(mApp, viewName) - bindingSections = addBinding(title, bindingSections, binding) + titleMap := map[string]string{ + "global": mApp.Tr.GlobalTitle, + "main": mApp.Tr.MainTitle, + "status": mApp.Tr.StatusTitle, + "services": mApp.Tr.ServicesTitle, + "containers": mApp.Tr.ContainersTitle, + "images": mApp.Tr.ImagesTitle, + "volumes": mApp.Tr.VolumesTitle, + } + + bindingSections = addBinding(titleMap[viewName], bindingSections, binding) } // for view, contexts := range mApp.Gui.GetContextMap() {