From fd04fccaec14ce1b7a8372624f6527e125a69fdf Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Fri, 17 Jun 2022 00:29:38 +0200 Subject: [PATCH] i18n: Validate value of supybot.language --- src/i18n.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/i18n.py b/src/i18n.py index 81a8a3a0e..37bfb355b 100644 --- a/src/i18n.py +++ b/src/i18n.py @@ -70,10 +70,12 @@ def import_conf(): """Imports the conf into this module""" global conf conf = __import__('supybot.conf').conf + class Languages(conf.registry.OnlySomeStrings): + validStrings = ['de', 'en', 'es', 'fi', 'fr', 'it'] conf.registerGlobalValue(conf.supybot, 'language', - conf.registry.String(currentLocale, """Determines the bot's default - language if translations exist. Currently supported are 'de', 'en', - 'es', 'fi', 'fr' and 'it'.""")) + Languages(currentLocale, """Determines the bot's default + language if translations exist. Currently supported are: %s""" + % ', '.join(Languages.validStrings))) conf.supybot.language.addCallback(reloadLocalesIfRequired) def getPluginDir(plugin_name):