Fix case of i18n.InternationalizedFunction.

This commit is contained in:
Valentin Lorentz 2014-01-22 11:04:08 +01:00
parent 9b365d1ed8
commit 121991eff9

View File

@ -125,12 +125,8 @@ def reloadLocales():
pluginClass.loadLocale() pluginClass.loadLocale()
for command in internationalizedCommands.values(): for command in internationalizedCommands.values():
internationalizeDocstring(command) internationalizeDocstring(command)
for function_ref in list(internationalizedFunctions): for function in internationalizedFunctions:
function = function_ref function.loadLocale()
if not function:
internationalizedFunctions.remove(function_ref)
else:
function.loadLocale()
def parse(translationFile): def parse(translationFile):
step = WAITING_FOR_MSGID step = WAITING_FOR_MSGID
@ -308,7 +304,7 @@ class _PluginInternationalization:
def localizeFunction(self, name): def localizeFunction(self, name):
"""Returns the localized version of the function. """Returns the localized version of the function.
Should be used only by the internationalizedFunction class""" Should be used only by the InternationalizedFunction class"""
if self.name != 'supybot': if self.name != 'supybot':
return return
if hasattr(self, '_l10nFunctions') and \ if hasattr(self, '_l10nFunctions') and \
@ -326,12 +322,12 @@ class _PluginInternationalization:
self._parent = parent self._parent = parent
self._name = name self._name = name
def __call__(self, obj): def __call__(self, obj):
obj = internationalizedFunction(self._parent, self._name, obj) obj = InternationalizedFunction(self._parent, self._name, obj)
obj.loadLocale() obj.loadLocale()
return obj return obj
return FunctionInternationalizer(self, name) return FunctionInternationalizer(self, name)
class internationalizedFunction: class InternationalizedFunction:
"""Proxy for functions that need to be fully localized. """Proxy for functions that need to be fully localized.
The localization code is in locales/LOCALE.py""" The localization code is in locales/LOCALE.py"""
@ -339,7 +335,7 @@ class internationalizedFunction:
self._internationalizer = internationalizer self._internationalizer = internationalizer
self._name = name self._name = name
self._origin = function self._origin = function
internationalizedFunctions.append(weakref.proxy(self)) internationalizedFunctions.append(self)
def loadLocale(self): def loadLocale(self):
self.__call__ = self._internationalizer.localizeFunction(self._name) self.__call__ = self._internationalizer.localizeFunction(self._name)
if self.__call__ == None: if self.__call__ == None: