mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-23 11:12:47 +01:00
Wrap now internationalizes docstrings.
This commit is contained in:
parent
66025cf7e4
commit
c56f26b91d
@ -97,15 +97,12 @@ import supybot.ircutils as ircutils
|
|||||||
import supybot.callbacks as callbacks
|
import supybot.callbacks as callbacks
|
||||||
try:
|
try:
|
||||||
from supybot.i18n import PluginInternationalization
|
from supybot.i18n import PluginInternationalization
|
||||||
from supybot.i18n import internationalizeDocstring
|
_ = PluginInternationalization('%s')
|
||||||
_ = PluginInter
|
|
||||||
except:
|
except:
|
||||||
# These are useless functions that's allow to run the plugin on a bot
|
# Placeholder that allows to run the plugin on a bot
|
||||||
# without the i18n plugin
|
# without the i18n module
|
||||||
_ = lambda x:x
|
_ = lambda x:x
|
||||||
internationalizeDocstring = lambda x:xnationalization('%s')
|
|
||||||
|
|
||||||
@internationalizeDocstring
|
|
||||||
class %s(callbacks.Plugin):
|
class %s(callbacks.Plugin):
|
||||||
"""Add the help for "@plugin help %s" here
|
"""Add the help for "@plugin help %s" here
|
||||||
This should describe *how* to use this plugin."""
|
This should describe *how* to use this plugin."""
|
||||||
@ -125,13 +122,11 @@ import supybot.conf as conf
|
|||||||
import supybot.registry as registry
|
import supybot.registry as registry
|
||||||
try:
|
try:
|
||||||
from supybot.i18n import PluginInternationalization
|
from supybot.i18n import PluginInternationalization
|
||||||
from supybot.i18n import internationalizeDocstring
|
|
||||||
_ = PluginInternationalization('%s')
|
_ = PluginInternationalization('%s')
|
||||||
except:
|
except:
|
||||||
# These are useless functions that's allow to run the plugin on a bot
|
# Placeholder that allows to run the plugin on a bot
|
||||||
# without the i18n plugin
|
# without the i18n module
|
||||||
_ = lambda x:x
|
_ = lambda x:x
|
||||||
internationalizeDocstring = lambda x:x
|
|
||||||
|
|
||||||
def configure(advanced):
|
def configure(advanced):
|
||||||
# This will be called by supybot to configure this module. advanced is
|
# This will be called by supybot to configure this module. advanced is
|
||||||
|
@ -1039,6 +1039,8 @@ class Spec(object):
|
|||||||
return state
|
return state
|
||||||
|
|
||||||
def _wrap(f, specList=[], name=None, **kw):
|
def _wrap(f, specList=[], name=None, **kw):
|
||||||
|
assert hasattr(f, '__doc__')
|
||||||
|
f = internationalizeDocstring(f)
|
||||||
name = name or f.func_name
|
name = name or f.func_name
|
||||||
spec = Spec(specList, **kw)
|
spec = Spec(specList, **kw)
|
||||||
def newf(self, irc, msg, args, **kwargs):
|
def newf(self, irc, msg, args, **kwargs):
|
||||||
|
Loading…
Reference in New Issue
Block a user