domains: add missing logic to inject translated 'help' keys in config panel like we do for global settings

This commit is contained in:
Alexandre Aubin 2023-02-05 18:31:36 +01:00
parent a035024666
commit 4dee434e71
3 changed files with 19 additions and 8 deletions

View file

@ -345,9 +345,11 @@
"domain_config_cert_summary_selfsigned": "WARNING: Current certificate is self-signed. Browsers will display a spooky warning to new visitors!",
"domain_config_cert_validity": "Validity",
"domain_config_default_app": "Default app",
"domain_config_default_app_help": "People will automatically be redirected to this app when opening this domain. If no app is specified, people are redirected to the user portal login form.",
"domain_config_mail_in": "Incoming emails",
"domain_config_mail_out": "Outgoing emails",
"domain_config_xmpp": "Instant messaging (XMPP)",
"domain_config_xmpp_help": "NB: some XMPP features will require that you update your DNS records and regenerate your Lets Encrypt certificate to be enabled",
"domain_created": "Domain created",
"domain_creation_failed": "Unable to create domain {domain}: {error}",
"domain_deleted": "Domain deleted",

View file

@ -9,8 +9,6 @@ name = "Features"
type = "app"
filter = "is_webapp"
default = "_none"
# FIXME: i18n
help = "People will automatically be redirected to this app when opening this domain. If no app is specified, people are redirected to the user portal login form."
[feature.mail]
@ -27,8 +25,6 @@ name = "Features"
[feature.xmpp.xmpp]
type = "boolean"
default = 0
# FIXME: i18n
help = "NB: some XMPP features will require that you update your DNS records and regenerate your Lets Encrypt certificate to be enabled"
[dns]
name = "DNS"
@ -67,7 +63,6 @@ name = "Certificate"
visible = "acme_eligible == false || acme_eligible == null"
[cert.cert.cert_no_checks]
ask = "Ignore diagnosis checks"
type = "boolean"
default = false
visible = "acme_eligible == false || acme_eligible == null"

View file

@ -624,14 +624,28 @@ class DomainConfigPanel(ConfigPanel):
f"domain_config_cert_summary_{status['summary']}"
)
# Other specific strings used in config panels
# i18n: domain_config_cert_renew_help
# FIXME: Ugly hack to save the cert status and reinject it in _load_current_values ...
self.cert_status = status
return toml
def get(self, key="", mode="classic"):
result = super().get(key=key, mode=mode)
if mode == "full":
for panel, section, option in self._iterate():
# This injects:
# i18n: domain_config_cert_renew_help
# i18n: domain_config_default_app_help
# i18n: domain_config_xmpp_help
if m18n.key_exists(self.config["i18n"] + "_" + option["id"] + "_help"):
option["help"] = m18n.n(
self.config["i18n"] + "_" + option["id"] + "_help"
)
return self.config
return result
def _load_current_values(self):
# TODO add mechanism to share some settings with other domains on the same zone
super()._load_current_values()