mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-26 12:49:24 +01:00
wizard: Check language is supported
Otherwise it may raise InvalidRegistryValue on first start
This commit is contained in:
parent
8d1d4b84eb
commit
eb002a31e9
@ -50,6 +50,7 @@ MSGSTR = 'msgstr "'
|
||||
FUZZY = '#, fuzzy'
|
||||
|
||||
currentLocale = 'en'
|
||||
SUPPORTED_LANGUAGES = ['de', 'en', 'es', 'fi', 'fr', 'it']
|
||||
|
||||
class PluginNotFound(Exception):
|
||||
pass
|
||||
@ -71,7 +72,7 @@ def import_conf():
|
||||
global conf
|
||||
conf = __import__('supybot.conf').conf
|
||||
class Languages(conf.registry.OnlySomeStrings):
|
||||
validStrings = ['de', 'en', 'es', 'fi', 'fr', 'it']
|
||||
validStrings = SUPPORTED_LANGUAGES
|
||||
errormsg = 'Value should be a supported language (%s), not %%r' % (
|
||||
', '.join(validStrings))
|
||||
conf.registerGlobalValue(conf.supybot, 'language',
|
||||
|
@ -253,7 +253,8 @@ def _main():
|
||||
language. This can be changed at any time. You need to answer with a short
|
||||
id for the language, such as 'en', 'fr', 'it' (without the quotes). If
|
||||
you want to use English, just press enter.""")
|
||||
language = something('What language do you want to use?', default='en')
|
||||
language = expect('What language do you want to use?',
|
||||
i18n.SUPPORTED_LANGUAGES, default='en')
|
||||
|
||||
class Empty:
|
||||
"""This is a hack to allow the i18n to get the current language, before
|
||||
|
Loading…
Reference in New Issue
Block a user