Reload translation of command helps when language changes.

This commit is contained in:
Valentin Lorentz 2012-12-21 20:08:34 +01:00
parent 989c674c58
commit d58ad0c86f

View File

@ -68,6 +68,7 @@ def import_conf():
conf.registerGlobalValue(conf.supybot, 'language', conf.registerGlobalValue(conf.supybot, 'language',
conf.registry.String(currentLocale, """Determines the bot's default conf.registry.String(currentLocale, """Determines the bot's default
language. Valid values are things like en, fr, de, etc.""")) language. Valid values are things like en, fr, de, etc."""))
conf.supybot.language.addCallback(reloadLocalesIfRequired)
def getPluginDir(plugin_name): def getPluginDir(plugin_name):
"""Gets the directory of the given plugin""" """Gets the directory of the given plugin"""
@ -118,8 +119,8 @@ def reloadLocalesIfRequired():
def reloadLocales(): def reloadLocales():
for pluginName in i18nClasses: for pluginName in i18nClasses:
i18nClasses[pluginName].loadLocale() i18nClasses[pluginName].loadLocale()
for commandHash in internationalizedCommands: for command in internationalizedCommands.values():
internationalizeDocstring(internationalizedCommands[commandHash]) internationalizeDocstring(command)
for function in internationalizedFunctions: for function in internationalizedFunctions:
function.loadLocale() function.loadLocale()