configpanels: auto add i18n help for an arg if present in locales

This commit is contained in:
axolotle 2022-10-04 19:27:04 +02:00
parent e4df838d9d
commit 6295374fdb

View file

@ -527,6 +527,7 @@ class ConfigPanel:
"filter", "filter",
"readonly", "readonly",
"enabled", "enabled",
# "confirm", # TODO: to ask confirmation before running an action
], ],
"defaults": {}, "defaults": {},
}, },
@ -669,6 +670,9 @@ class ConfigPanel:
for panel, section, option in self._iterate(): for panel, section, option in self._iterate():
if "ask" not in option: if "ask" not in option:
option["ask"] = m18n.n(self.config["i18n"] + "_" + option["id"]) option["ask"] = m18n.n(self.config["i18n"] + "_" + option["id"])
# auto add i18n help text if present in locales
if m18n.key_exists(self.config["i18n"] + "_" + option["id"] + '_help'):
option["help"] = m18n.n(self.config["i18n"] + "_" + option["id"] + '_help')
def display_header(message): def display_header(message):
"""CLI panel/section header display""" """CLI panel/section header display"""