Internationalize Herald, Internet, Karma, Lart, Later, Limiter, Math, and Misc

This commit is contained in:
Valentin Lorentz 2010-10-17 15:59:23 +02:00
parent 9917232d9a
commit 45de092652
3 changed files with 287 additions and 38 deletions

View File

@ -29,6 +29,8 @@
import supybot.conf as conf
import supybot.registry as registry
from supybot.i18n import PluginInternationalization, internationalizeDocstring
_ = PluginInternationalization('Misc')
def configure(advanced):
# This will be called by supybot to configure this module. advanced is
@ -40,24 +42,24 @@ def configure(advanced):
Misc = conf.registerPlugin('Misc')
conf.registerGlobalValue(Misc, 'listPrivatePlugins',
registry.Boolean(True, """Determines whether the bot will list private
registry.Boolean(True, _("""Determines whether the bot will list private
plugins with the list command if given the --private switch. If this is
disabled, non-owner users should be unable to see what private plugins
are loaded."""))
are loaded.""")))
conf.registerGlobalValue(Misc, 'timestampFormat',
registry.String('[%H:%M:%S]', """Determines the format string for
registry.String('[%H:%M:%S]', _("""Determines the format string for
timestamps in the Misc.last command. Refer to the Python documentation
for the time module to see what formats are accepted. If you set this
variable to the empty string, the timestamp will not be shown."""))
variable to the empty string, the timestamp will not be shown.""")))
conf.registerGroup(Misc, 'last')
conf.registerGroup(Misc.last, 'nested')
conf.registerChannelValue(Misc.last.nested,
'includeTimestamp', registry.Boolean(False, """Determines whether or not
'includeTimestamp', registry.Boolean(False, _("""Determines whether or not
the timestamp will be included in the output of last when it is part of a
nested command"""))
nested command""")))
conf.registerChannelValue(Misc.last.nested,
'includeNick', registry.Boolean(False, """Determines whether or not the
'includeNick', registry.Boolean(False, _("""Determines whether or not the
nick will be included in the output of last when it is part of a nested
command"""))
command""")))
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:

230
plugins/Misc/messages.pot Normal file
View File

@ -0,0 +1,230 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR ORGANIZATION
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2010-10-17 15:35+CEST\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: ENCODING\n"
"Generated-By: pygettext.py 1.5\n"
#: config.py:45
msgid ""
"Determines whether the bot will list private\n"
" plugins with the list command if given the --private switch. If this is\n"
" disabled, non-owner users should be unable to see what private plugins\n"
" are loaded."
msgstr ""
#: config.py:50
msgid ""
"Determines the format string for\n"
" timestamps in the Misc.last command. Refer to the Python documentation\n"
" for the time module to see what formats are accepted. If you set this\n"
" variable to the empty string, the timestamp will not be shown."
msgstr ""
#: config.py:57
msgid ""
"Determines whether or not\n"
" the timestamp will be included in the output of last when it is part of a\n"
" nested command"
msgstr ""
#: config.py:61
msgid ""
"Determines whether or not the\n"
" nick will be included in the output of last when it is part of a nested\n"
" command"
msgstr ""
#: plugin.py:81
msgid "You've given me %s invalid commands within the last minute; I'm now ignoring you for %s."
msgstr ""
#: plugin.py:93
msgid "The %q plugin is loaded, but there is no command named %q in it. Try \"list %s\" to see the commands in the %q plugin."
msgstr ""
#: plugin.py:119
#, docstring
msgid ""
"[--private] [<plugin>]\n"
"\n"
" Lists the commands available in the given plugin. If no plugin is\n"
" given, lists the public plugins available. If --private is given,\n"
" lists the private plugins.\n"
" "
msgstr ""
#: plugin.py:144
msgid "There are no private plugins."
msgstr ""
#: plugin.py:146
msgid "There are no public plugins."
msgstr ""
#: plugin.py:153
msgid "That plugin exists, but has no commands. This probably means that it has some configuration variables that can be changed in order to modify its behavior. Try \"config list supybot.plugins.%s\" to see what configuration variables it has."
msgstr ""
#: plugin.py:164
#, docstring
msgid ""
"<string>\n"
"\n"
" Searches for <string> in the commands currently offered by the bot,\n"
" returning a list of the commands containing that string.\n"
" "
msgstr ""
#: plugin.py:183
msgid "No appropriate commands were found."
msgstr ""
#: plugin.py:188
#, docstring
msgid ""
"[<plugin>] [<command>]\n"
"\n"
" This command gives a useful description of what <command> does.\n"
" <plugin> is only necessary if the command is in more than one plugin.\n"
" "
msgstr ""
#: plugin.py:198
msgid "That command exists in the %L plugins. Please specify exactly which plugin command you want help with."
msgstr ""
#: plugin.py:205
msgid "There is no command %q."
msgstr ""
#: plugin.py:211
#, docstring
msgid ""
"takes no arguments\n"
"\n"
" Returns the version of the current bot.\n"
" "
msgstr ""
#: plugin.py:217
msgid "The newest version available online is %s."
msgstr ""
#: plugin.py:221
msgid "I couldn't fetch the newest version from the Supybot website."
msgstr ""
#: plugin.py:223
msgid "The current (running) version of this Supybot is %s. %s"
msgstr ""
#: plugin.py:230
#, docstring
msgid ""
"takes no arguments\n"
"\n"
" Returns a URL saying where to get Supybot.\n"
" "
msgstr ""
#: plugin.py:234
msgid "My source is at http://supybot.com/"
msgstr ""
#: plugin.py:239
#, docstring
msgid ""
"[<nick>]\n"
"\n"
" If the last command was truncated due to IRC message length\n"
" limitations, returns the next chunk of the result of the last command.\n"
" If <nick> is given, it takes the continuation of the last command from\n"
" <nick> instead of the person sending this message.\n"
" "
msgstr ""
#: plugin.py:253
msgid "%s has no public mores."
msgstr ""
#: plugin.py:256
msgid "Sorry, I can't find any mores for %s"
msgstr ""
#: plugin.py:265
msgid "You haven't asked me a command; perhaps you want to see someone else's more. To do so, call this command with that person's nick."
msgstr ""
#: plugin.py:269
msgid "That's all, there is no more."
msgstr ""
#: plugin.py:279
#, docstring
msgid ""
"[--{from,in,on,with,without,regexp} <value>] [--nolimit]\n"
"\n"
" Returns the last message matching the given criteria. --from requires\n"
" a nick from whom the message came; --in requires a channel the message\n"
" was sent to; --on requires a network the message was sent on; --with\n"
" requires some string that had to be in the message; --regexp requires\n"
" a regular expression the message must match; --nolimit returns all\n"
" the messages that can be found. By default, the channel this command is\n"
" given in is searched.\n"
" "
msgstr ""
#: plugin.py:373
msgid "I couldn't find a message matching that criteria in my history of %s messages."
msgstr ""
#: plugin.py:388
#, docstring
msgid ""
"<nick> <text>\n"
"\n"
" Tells the <nick> whatever <text> is. Use nested commands to your\n"
" benefit here.\n"
" "
msgstr ""
#: plugin.py:396
msgid "Dude, just give the command. No need for the tell."
msgstr ""
#: plugin.py:401
msgid "You just told me, why should I tell myself?"
msgstr ""
#: plugin.py:406
msgid "I haven't seen %s, I'll let you do the telling."
msgstr ""
#: plugin.py:411
msgid "%s wants me to tell you: %s"
msgstr ""
#: plugin.py:417
#, docstring
msgid ""
"takes no arguments\n"
"\n"
" Checks to see if the bot is alive.\n"
" "
msgstr ""
#: plugin.py:421
msgid "pong"
msgstr ""

View File

@ -44,6 +44,8 @@ import supybot.ircutils as ircutils
import supybot.callbacks as callbacks
from supybot.utils.iter import ifilter
from supybot.i18n import PluginInternationalization, internationalizeDocstring
_ = PluginInternationalization('Misc')
class Misc(callbacks.Plugin):
def __init__(self, irc):
@ -76,8 +78,8 @@ class Misc(callbacks.Plugin):
'permanently.')
ircdb.ignores.add(banmask, time.time() + punishment)
if conf.supybot.abuse.flood.command.invalid.notify():
irc.reply('You\'ve given me %s invalid commands within the last '
'minute; I\'m now ignoring you for %s.' %
irc.reply(_('You\'ve given me %s invalid commands within the last '
'minute; I\'m now ignoring you for %s.') %
(maximum,
utils.timeElapsed(punishment, seconds=False)))
return
@ -88,10 +90,10 @@ class Misc(callbacks.Plugin):
cb = irc.getCallback(tokens[0])
if cb:
plugin = cb.name()
irc.error(format('The %q plugin is loaded, but there is '
irc.error(format(_('The %q plugin is loaded, but there is '
'no command named %q in it. Try "list '
'%s" to see the commands in the %q '
'plugin.', plugin, tokens[1],
'plugin.'), plugin, tokens[1],
plugin, plugin))
else:
irc.errorInvalid('command', tokens[0], repr=False)
@ -112,6 +114,7 @@ class Misc(callbacks.Plugin):
else:
pass # Let's just do nothing, I can't think of better.
@internationalizeDocstring
def list(self, irc, msg, args, optlist, cb):
"""[--private] [<plugin>]
@ -138,24 +141,25 @@ class Misc(callbacks.Plugin):
irc.reply(format('%L', names))
else:
if private:
irc.reply('There are no private plugins.')
irc.reply(_('There are no private plugins.'))
else:
irc.reply('There are no public plugins.')
irc.reply(_('There are no public plugins.'))
else:
commands = cb.listCommands()
if commands:
commands.sort()
irc.reply(format('%L', commands))
else:
irc.reply(format('That plugin exists, but has no commands. '
irc.reply(format(_('That plugin exists, but has no commands. '
'This probably means that it has some '
'configuration variables that can be '
'changed in order to modify its behavior. '
'Try "config list supybot.plugins.%s" to see '
'what configuration variables it has.',
'what configuration variables it has.'),
cb.name()))
list = wrap(list, [getopts({'private':''}), additional('plugin')])
@internationalizeDocstring
def apropos(self, irc, msg, args, s):
"""<string>
@ -176,9 +180,10 @@ class Misc(callbacks.Plugin):
L.sort()
irc.reply(format('%L', L))
else:
irc.reply('No appropriate commands were found.')
irc.reply(_('No appropriate commands were found.'))
apropos = wrap(apropos, ['lowered'])
@internationalizeDocstring
def help(self, irc, msg, args, command):
"""[<plugin>] [<command>]
@ -190,17 +195,18 @@ class Misc(callbacks.Plugin):
if maxL == command:
if len(cbs) > 1:
names = sorted([cb.name() for cb in cbs])
irc.error(format('That command exists in the %L plugins. '
irc.error(format(_('That command exists in the %L plugins. '
'Please specify exactly which plugin command '
'you want help with.', names))
'you want help with.'), names))
else:
assert cbs, 'Odd, maxL == command, but no cbs.'
irc.reply(cbs[0].getCommandHelp(command, False))
else:
irc.error(format('There is no command %q.',
irc.error(format(_('There is no command %q.'),
callbacks.formatCommand(command)))
help = wrap(help, [many('something')])
@internationalizeDocstring
def version(self, irc, msg, args):
"""takes no arguments
@ -208,24 +214,27 @@ class Misc(callbacks.Plugin):
"""
try:
newest = utils.web.getUrl('http://supybot.sf.net/version.txt')
newest ='The newest version available online is %s.'%newest.strip()
newest = _('The newest version available online is %s.') % \
newest.strip()
except utils.web.Error, e:
self.log.info('Couldn\'t get website version: %s', e)
newest = 'I couldn\'t fetch the newest version ' \
'from the Supybot website.'
s = 'The current (running) version of this Supybot is %s. %s' % \
newest = _('I couldn\'t fetch the newest version '
'from the Supybot website.')
s = _('The current (running) version of this Supybot is %s. %s') % \
(conf.version, newest)
irc.reply(s)
version = wrap(thread(version))
@internationalizeDocstring
def source(self, irc, msg, args):
"""takes no arguments
Returns a URL saying where to get Supybot.
"""
irc.reply('My source is at http://supybot.com/')
irc.reply(_('My source is at http://supybot.com/'))
source = wrap(source)
@internationalizeDocstring
def more(self, irc, msg, args, nick):
"""[<nick>]
@ -241,23 +250,27 @@ class Misc(callbacks.Plugin):
if not private:
irc._mores[userHostmask] = L[:]
else:
irc.error('%s has no public mores.' % nick)
irc.error(_('%s has no public mores.') % nick)
return
except KeyError:
irc.error('Sorry, I can\'t find any mores for %s' % nick)
irc.error(_('Sorry, I can\'t find any mores for %s') % nick)
return
try:
L = irc._mores[userHostmask]
chunk = L.pop()
if L:
chunk += format(' \x02(%n)\x0F', (len(L), 'more', 'message'))
if len(L) < 2:
more = _('more message')
else:
more = _('more messages')
chunk += format(' \x02(%s)\x0F', more)
irc.reply(chunk, True)
except KeyError:
irc.error('You haven\'t asked me a command; perhaps you want '
irc.error(_('You haven\'t asked me a command; perhaps you want '
'to see someone else\'s more. To do so, call this '
'command with that person\'s nick.')
'command with that person\'s nick.'))
except IndexError:
irc.error('That\'s all, there is no more.')
irc.error(_('That\'s all, there is no more.'))
more = wrap(more, [additional('seenNick')])
def _validLastMsg(self, msg):
@ -265,6 +278,7 @@ class Misc(callbacks.Plugin):
msg.command == 'PRIVMSG' and \
ircutils.isChannel(msg.args[0])
@internationalizeDocstring
def last(self, irc, msg, args, optlist):
"""[--{from,in,on,with,without,regexp} <value>] [--nolimit]
@ -360,8 +374,8 @@ class Misc(callbacks.Plugin):
showNick=showNick))
return
if not resp:
irc.error('I couldn\'t find a message matching that criteria in '
'my history of %s messages.' % len(irc.state.history))
irc.error(_('I couldn\'t find a message matching that criteria in '
'my history of %s messages.') % len(irc.state.history))
else:
irc.reply(format('%L', resp))
last = wrap(last, [getopts({'nolimit': '',
@ -373,6 +387,7 @@ class Misc(callbacks.Plugin):
'regexp': 'regexpMatcher',})])
@internationalizeDocstring
def tell(self, irc, msg, args, target, text):
"""<nick> <text>
@ -382,30 +397,32 @@ class Misc(callbacks.Plugin):
if target.lower() == 'me':
target = msg.nick
if ircutils.isChannel(target):
irc.error('Dude, just give the command. No need for the tell.')
irc.error(_('Dude, just give the command. No need for the tell.'))
return
if not ircutils.isNick(target):
irc.errorInvalid('nick', target)
if ircutils.nickEqual(target, irc.nick):
irc.error('You just told me, why should I tell myself?',Raise=True)
irc.error(_('You just told me, why should I tell myself?'),
Raise=True)
if target not in irc.state.nicksToHostmasks and \
not ircdb.checkCapability(msg.prefix, 'owner'):
# We'll let owners do this.
s = 'I haven\'t seen %s, I\'ll let you do the telling.' % target
s = _('I haven\'t seen %s, I\'ll let you do the telling.') % target
irc.error(s, Raise=True)
if irc.action:
irc.action = False
text = '* %s %s' % (irc.nick, text)
s = '%s wants me to tell you: %s' % (msg.nick, text)
s = _('%s wants me to tell you: %s') % (msg.nick, text)
irc.reply(s, to=target, private=True)
tell = wrap(tell, ['something', 'text'])
@internationalizeDocstring
def ping(self, irc, msg, args):
"""takes no arguments
Checks to see if the bot is alive.
"""
irc.reply('pong', prefixNick=False)
irc.reply(_('pong'), prefixNick=False)
Class = Misc