Wrap now internationalizes docstrings.

This commit is contained in:
Valentin Lorentz 2013-05-20 17:52:41 +02:00
parent 66025cf7e4
commit c56f26b91d
2 changed files with 7 additions and 10 deletions

View File

@ -97,15 +97,12 @@ import supybot.ircutils as ircutils
import supybot.callbacks as callbacks
try:
from supybot.i18n import PluginInternationalization
from supybot.i18n import internationalizeDocstring
_ = PluginInter
_ = PluginInternationalization('%s')
except:
# These are useless functions that's allow to run the plugin on a bot
# without the i18n plugin
# Placeholder that allows to run the plugin on a bot
# without the i18n module
_ = lambda x:x
internationalizeDocstring = lambda x:xnationalization('%s')
@internationalizeDocstring
class %s(callbacks.Plugin):
"""Add the help for "@plugin help %s" here
This should describe *how* to use this plugin."""
@ -125,13 +122,11 @@ import supybot.conf as conf
import supybot.registry as registry
try:
from supybot.i18n import PluginInternationalization
from supybot.i18n import internationalizeDocstring
_ = PluginInternationalization('%s')
except:
# These are useless functions that's allow to run the plugin on a bot
# without the i18n plugin
# Placeholder that allows to run the plugin on a bot
# without the i18n module
_ = lambda x:x
internationalizeDocstring = lambda x:x
def configure(advanced):
# This will be called by supybot to configure this module. advanced is

View File

@ -1039,6 +1039,8 @@ class Spec(object):
return state
def _wrap(f, specList=[], name=None, **kw):
assert hasattr(f, '__doc__')
f = internationalizeDocstring(f)
name = name or f.func_name
spec = Spec(specList, **kw)
def newf(self, irc, msg, args, **kwargs):