Merge branch 'i18n' of github.com:ProgVal/Supybot-fr into i18n

This commit is contained in:
Valentin Lorentz 2010-10-17 16:00:13 +02:00
commit 7cf5bb7242
21 changed files with 849 additions and 99 deletions

View File

@ -29,6 +29,8 @@
import supybot.conf as conf
import supybot.registry as registry
from supybot.i18n import PluginInternationalization, internationalizeDocstring
_ = PluginInternationalization('Heral')
def configure(advanced):
# This will be called by supybot to configure this module. advanced is
@ -41,31 +43,31 @@ def configure(advanced):
Herald = conf.registerPlugin('Herald')
conf.registerChannelValue(Herald, 'heralding',
registry.Boolean(True, """Determines whether messages will be sent to the
registry.Boolean(True, _("""Determines whether messages will be sent to the
channel when a recognized user joins; basically enables or disables the
plugin."""))
plugin.""")))
conf.registerGlobalValue(Herald, 'requireCapability',
registry.String('', """Determines what capability (if any) is required to
add/change/remove the herald of another user."""))
registry.String('', _("""Determines what capability (if any) is required to
add/change/remove the herald of another user.""")))
conf.registerChannelValue(Herald, 'throttle',
registry.PositiveInteger(600, """Determines the minimum number of seconds
between heralds."""))
registry.PositiveInteger(600, _("""Determines the minimum number of seconds
between heralds.""")))
conf.registerChannelValue(Herald.throttle, 'afterPart',
registry.NonNegativeInteger(0, """Determines the minimum number of seconds
registry.NonNegativeInteger(0, _("""Determines the minimum number of seconds
after parting that the bot will not herald the person when he or she
rejoins."""))
rejoins.""")))
conf.registerChannelValue(Herald.throttle, 'afterSplit',
registry.NonNegativeInteger(60, """Determines the minimum number of seconds
after a netsplit that the bot will not herald the users that split."""))
registry.NonNegativeInteger(60, _("""Determines the minimum number of seconds
after a netsplit that the bot will not herald the users that split.""")))
conf.registerChannelValue(Herald, 'default',
registry.String('', """Sets the default herald to use. If a user has a
registry.String('', _("""Sets the default herald to use. If a user has a
personal herald specified, that will be used instead. If set to the empty
string, the default herald will be disabled."""))
string, the default herald will be disabled.""")))
conf.registerChannelValue(Herald.default, 'notice',
registry.Boolean(True, """Determines whether the default herald will be
sent as a NOTICE instead of a PRIVMSG."""))
registry.Boolean(True, _("""Determines whether the default herald will be
sent as a NOTICE instead of a PRIVMSG.""")))
conf.registerChannelValue(Herald.default, 'public',
registry.Boolean(False, """Determines whether the default herald will be
sent publicly."""))
registry.Boolean(False, _("""Determines whether the default herald will be
sent publicly.""")))
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:

140
plugins/Herald/messages.pot Normal file
View File

@ -0,0 +1,140 @@
# 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:21+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:46
msgid ""
"Determines whether messages will be sent to the\n"
" channel when a recognized user joins; basically enables or disables the\n"
" plugin."
msgstr ""
#: config.py:50
msgid ""
"Determines what capability (if any) is required to\n"
" add/change/remove the herald of another user."
msgstr ""
#: config.py:53
msgid ""
"Determines the minimum number of seconds\n"
" between heralds."
msgstr ""
#: config.py:56
msgid ""
"Determines the minimum number of seconds\n"
" after parting that the bot will not herald the person when he or she\n"
" rejoins."
msgstr ""
#: config.py:60
msgid ""
"Determines the minimum number of seconds\n"
" after a netsplit that the bot will not herald the users that split."
msgstr ""
#: config.py:63
msgid ""
"Sets the default herald to use. If a user has a\n"
" personal herald specified, that will be used instead. If set to the empty\n"
" string, the default herald will be disabled."
msgstr ""
#: config.py:67
msgid ""
"Determines whether the default herald will be\n"
" sent as a NOTICE instead of a PRIVMSG."
msgstr ""
#: config.py:70
msgid ""
"Determines whether the default herald will be\n"
" sent publicly."
msgstr ""
#: plugin.py:143
#, docstring
msgid ""
"[<channel>] [--remove|<msg>]\n"
"\n"
" If <msg> is given, sets the default herald to <msg>. A <msg> of \"\"\n"
" will remove the default herald. If <msg> is not given, returns the\n"
" current default herald. <channel> is only necessary if the message\n"
" isn't sent in the channel itself.\n"
" "
msgstr ""
#: plugin.py:162
msgid "I do not have a default herald set for %s."
msgstr ""
#: plugin.py:170
#, docstring
msgid ""
"[<channel>] [<user|nick>]\n"
"\n"
" Returns the current herald message for <user> (or the user\n"
" <nick|hostmask> is currently identified or recognized as). If <user>\n"
" is not given, defaults to the user giving the command. <channel>\n"
" is only necessary if the message isn't sent in the channel itself.\n"
" "
msgstr ""
#: plugin.py:181
msgid "I have no herald for %s."
msgstr ""
#: plugin.py:201
#, docstring
msgid ""
"[<channel>] <user|nick> <msg>\n"
"\n"
" Sets the herald message for <user> (or the user <nick|hostmask> is\n"
" currently identified or recognized as) to <msg>. <channel> is only\n"
" necessary if the message isn't sent in the channel itself.\n"
" "
msgstr ""
#: plugin.py:214
#, docstring
msgid ""
"[<channel>] [<user|nick>]\n"
"\n"
" Removes the herald message set for <user>, or the user\n"
" <nick|hostmask> is currently identified or recognized as. If <user>\n"
" is not given, defaults to the user giving the command.\n"
" <channel> is only necessary if the message isn't sent in the channel\n"
" itself.\n"
" "
msgstr ""
#: plugin.py:227
msgid "I have no herald for that user."
msgstr ""
#: plugin.py:232
#, docstring
msgid ""
"[<channel>] [<user|nick>] <regexp>\n"
"\n"
" Changes the herald message for <user>, or the user <nick|hostmask> is\n"
" currently identified or recognized as, according to <regexp>. If\n"
" <user> is not given, defaults to the calling user. <channel> is only\n"
" necessary if the message isn't sent in the channel itself.\n"
" "
msgstr ""

View File

@ -40,6 +40,8 @@ import supybot.plugins as plugins
import supybot.ircutils as ircutils
import supybot.callbacks as callbacks
from supybot.utils.structures import TimeoutQueue
from supybot.i18n import PluginInternationalization, internationalizeDocstring
_ = PluginInternationalization('Heral')
filename = conf.supybot.directories.data.dirize('Herald.db')
@ -136,6 +138,7 @@ class Herald(callbacks.Plugin):
raise KeyError
return id
@internationalizeDocstring
def default(self, irc, msg, args, channel, optlist, text):
"""[<channel>] [--remove|<msg>]
@ -156,12 +159,13 @@ class Herald(callbacks.Plugin):
irc.replySuccess()
else:
resp = self.registryValue('default', channel) or \
'I do not have a default herald set for %s.' % channel
_('I do not have a default herald set for %s.') % channel
irc.reply(resp)
default = wrap(default, ['channel',
getopts({'remove': ''}),
additional('text')])
@internationalizeDocstring
def get(self, irc, msg, args, channel, user):
"""[<channel>] [<user|nick>]
@ -174,7 +178,7 @@ class Herald(callbacks.Plugin):
herald = self.db[channel, user.id]
irc.reply(herald)
except KeyError:
irc.error('I have no herald for %s.' % user.name)
irc.error(_('I have no herald for %s.') % user.name)
get = wrap(get, ['channel', first('otherUser', 'user')])
def _preCheck(self, irc, msg, user):
@ -192,6 +196,7 @@ class Herald(callbacks.Plugin):
# I chose not to make <user|nick> optional in this command because
# if it's not a valid username (e.g., if the user tyops and misspells a
# username), it may be nice not to clobber the user's herald.
@internationalizeDocstring
def add(self, irc, msg, args, channel, user, herald):
"""[<channel>] <user|nick> <msg>
@ -204,6 +209,7 @@ class Herald(callbacks.Plugin):
irc.replySuccess()
add = wrap(add, ['channel', 'otherUser', 'text'])
@internationalizeDocstring
def remove(self, irc, msg, args, channel, user):
"""[<channel>] [<user|nick>]
@ -218,9 +224,10 @@ class Herald(callbacks.Plugin):
del self.db[channel, user.id]
irc.replySuccess()
except KeyError:
irc.error('I have no herald for that user.')
irc.error(_('I have no herald for that user.'))
remove = wrap(remove, ['channel', first('otherUser', 'user')])
@internationalizeDocstring
def change(self, irc, msg, args, channel, user, changer):
"""[<channel>] [<user|nick>] <regexp>

View File

@ -29,6 +29,8 @@
import supybot.conf as conf
import supybot.registry as registry
from supybot.i18n import PluginInternationalization, internationalizeDocstring
_ = PluginInternationalization('Internet')
def configure(advanced):
# This will be called by supybot to configure this module. advanced is
@ -42,7 +44,7 @@ def configure(advanced):
Internet = conf.registerPlugin('Internet')
# This is where your configuration variables (if any) should go. For example:
# conf.registerGlobalValue(Internet, 'someConfigVariableName',
# registry.Boolean(False, """Help for someConfigVariableName."""))
# registry.Boolean(False, _("""Help for someConfigVariableName.""")))
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:

View File

@ -0,0 +1,85 @@
# 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:20+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"
#: plugin.py:43
#, docstring
msgid "Add the help for \"@help Internet\" here."
msgstr ""
#: plugin.py:47
#, docstring
msgid ""
"<host|ip>\n"
"\n"
" Returns the ip of <host> or the reverse DNS hostname of <ip>.\n"
" "
msgstr ""
#: plugin.py:54 plugin.py:61 plugin.py:65
msgid "Host not found."
msgstr ""
#: plugin.py:77
#, docstring
msgid ""
"<domain>\n"
"\n"
" Returns WHOIS information on the registration of <domain>.\n"
" "
msgstr ""
#: plugin.py:83
msgid "domain"
msgstr ""
#: plugin.py:112
msgid "updated %s"
msgstr ""
#: plugin.py:115
msgid "registered %s"
msgstr ""
#: plugin.py:118
msgid "expires %s"
msgstr ""
#: plugin.py:138
msgid " <registered at %s>"
msgstr ""
#: plugin.py:140
msgid " <registered by %s>"
msgstr ""
#: plugin.py:145
msgid "%s%s is %L."
msgstr ""
#: plugin.py:148
msgid "I couldn't find such a domain."
msgstr ""
#: plugin.py:153
#, docstring
msgid ""
"<ip>\n"
"\n"
" Returns the hexadecimal IP for that IP.\n"
" "
msgstr ""

View File

@ -35,11 +35,14 @@ import supybot.utils as utils
from supybot.commands import *
from supybot.utils.iter import any
import supybot.callbacks as callbacks
from supybot.i18n import PluginInternationalization, internationalizeDocstring
_ = PluginInternationalization('Internet')
@internationalizeDocstring
class Internet(callbacks.Plugin):
"""Add the help for "@help Internet" here."""
threaded = True
@internationalizeDocstring
def dns(self, irc, msg, args, host):
"""<host|ip>
@ -48,18 +51,18 @@ class Internet(callbacks.Plugin):
if utils.net.isIP(host):
hostname = socket.getfqdn(host)
if hostname == host:
irc.reply('Host not found.')
irc.reply(_('Host not found.'))
else:
irc.reply(hostname)
else:
try:
ip = socket.gethostbyname(host)
if ip == '64.94.110.11': # Verisign sucks!
irc.reply('Host not found.')
irc.reply(_('Host not found.'))
else:
irc.reply(ip)
except socket.error:
irc.reply('Host not found.')
irc.reply(_('Host not found.'))
dns = wrap(dns, ['something'])
_domain = ['Domain Name', 'Server Name', 'domain']
@ -69,6 +72,7 @@ class Internet(callbacks.Plugin):
_created = ['Created On', 'Domain Registration Date', 'Creation Date']
_expires = ['Expiration Date', 'Domain Expiration Date']
_status = ['Status', 'Domain Status', 'status']
@internationalizeDocstring
def whois(self, irc, msg, args, domain):
"""<domain>
@ -76,7 +80,7 @@ class Internet(callbacks.Plugin):
"""
usertld = domain.split('.')[-1]
if '.' not in domain:
irc.errorInvalid('domain')
irc.errorInvalid(_('domain'))
return
try:
t = telnetlib.Telnet('%s.whois-servers.net' % usertld, 43)
@ -105,13 +109,13 @@ class Internet(callbacks.Plugin):
registrar = ':'.join(line.split(':')[1:]).strip()
elif not updated and any(line.startswith, self._updated):
s = ':'.join(line.split(':')[1:]).strip()
updated = 'updated %s' % s
updated = _('updated %s') % s
elif not created and any(line.startswith, self._created):
s = ':'.join(line.split(':')[1:]).strip()
created = 'registered %s' % s
created = _('registered %s') % s
elif not expires and any(line.startswith, self._expires):
s = ':'.join(line.split(':')[1:]).strip()
expires = 'expires %s' % s
expires = _('expires %s') % s
elif not status and any(line.startswith, self._status):
status = ':'.join(line.split(':')[1:]).strip().lower()
if not status:
@ -131,19 +135,20 @@ class Internet(callbacks.Plugin):
if not line:
continue
if line.startswith('Email'):
url = ' <registered at %s>' % line.split('@')[-1]
url = _(' <registered at %s>') % line.split('@')[-1]
elif line.startswith('Registrar Organization:'):
url = ' <registered by %s>' % line.split(':')[1].strip()
url = _(' <registered by %s>') % line.split(':')[1].strip()
elif line == 'Not a valid ID pattern':
url = ''
if server and status:
info = filter(None, [status, created, updated, expires])
s = format('%s%s is %L.', server, url, info)
s = format(_('%s%s is %L.'), server, url, info)
irc.reply(s)
else:
irc.error('I couldn\'t find such a domain.')
irc.error(_('I couldn\'t find such a domain.'))
whois = wrap(whois, ['lowered'])
@internationalizeDocstring
def hexip(self, irc, msg, args, ip):
"""<ip>

View File

@ -29,6 +29,8 @@
import supybot.conf as conf
import supybot.registry as registry
from supybot.i18n import PluginInternationalization, internationalizeDocstring
_ = PluginInternationalization('Karma')
def configure(advanced):
# This will be called by supybot to configure this module. advanced is
@ -41,22 +43,22 @@ def configure(advanced):
conf.registerPlugin('Karma')
conf.registerChannelValue(conf.supybot.plugins.Karma, 'simpleOutput',
registry.Boolean(False, """Determines whether the bot will output shorter
versions of the karma output when requesting a single thing's karma."""))
registry.Boolean(False, _("""Determines whether the bot will output shorter
versions of the karma output when requesting a single thing's karma.""")))
conf.registerChannelValue(conf.supybot.plugins.Karma, 'response',
registry.Boolean(False, """Determines whether the bot will reply with a
success message when something's karma is increased or decreased."""))
registry.Boolean(False, _("""Determines whether the bot will reply with a
success message when something's karma is increased or decreased.""")))
conf.registerChannelValue(conf.supybot.plugins.Karma, 'rankingDisplay',
registry.Integer(3, """Determines how many highest/lowest karma things are
shown when karma is called with no arguments."""))
registry.Integer(3, _("""Determines how many highest/lowest karma things
are shown when karma is called with no arguments.""")))
conf.registerChannelValue(conf.supybot.plugins.Karma, 'mostDisplay',
registry.Integer(25, """Determines how many karma things are shown when
the most command is called.'"""))
registry.Integer(25, _("""Determines how many karma things are shown when
the most command is called.'""")))
conf.registerChannelValue(conf.supybot.plugins.Karma, 'allowSelfRating',
registry.Boolean(False, """Determines whether users can adjust the karma
of their nick."""))
registry.Boolean(False, _("""Determines whether users can adjust the karma
of their nick.""")))
conf.registerChannelValue(conf.supybot.plugins.Karma, 'allowUnaddressedKarma',
registry.Boolean(False, """Determines whether the bot will
increase/decrease karma without being addressed."""))
registry.Boolean(False, _("""Determines whether the bot will
increase/decrease karma without being addressed.""")))
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:

137
plugins/Karma/messages.pot Normal file
View File

@ -0,0 +1,137 @@
# 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:21+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:46
msgid ""
"Determines whether the bot will output shorter\n"
" versions of the karma output when requesting a single thing's karma."
msgstr ""
#: config.py:49
msgid ""
"Determines whether the bot will reply with a\n"
" success message when something's karma is increased or decreased."
msgstr ""
#: config.py:52
msgid ""
"Determines how many highest/lowest karma things\n"
" are shown when karma is called with no arguments."
msgstr ""
#: config.py:55
msgid ""
"Determines how many karma things are shown when\n"
" the most command is called.'"
msgstr ""
#: config.py:58
msgid ""
"Determines whether users can adjust the karma\n"
" of their nick."
msgstr ""
#: config.py:61
msgid ""
"Determines whether the bot will\n"
" increase/decrease karma without being addressed."
msgstr ""
#: plugin.py:243 plugin.py:251
msgid "You're not allowed to adjust your own karma."
msgstr ""
#: plugin.py:280
#, docstring
msgid ""
"[<channel>] [<thing> ...]\n"
"\n"
" Returns the karma of <thing>. If <thing> is not given, returns the top\n"
" N karmas, where N is determined by the config variable\n"
" supybot.plugins.Karma.rankingDisplay. If one <thing> is given, returns\n"
" the details of its karma; if more than one <thing> is given, returns\n"
" the total karma of each of the the things. <channel> is only necessary\n"
" if the message isn't sent on the channel itself.\n"
" "
msgstr ""
#: plugin.py:293
msgid "%s has neutral karma."
msgstr ""
#: plugin.py:300
msgid "Karma for %q has been increased %n and decreased %n for a total karma of %s."
msgstr ""
#: plugin.py:315
msgid "I didn't know the karma for any of those things."
msgstr ""
#: plugin.py:325 plugin.py:354
msgid "I have no karma for this channel."
msgstr ""
#: plugin.py:330
msgid " You (%s) are ranked %i out of %i."
msgstr ""
#: plugin.py:334
msgid "Highest karma: %L. Lowest karma: %L.%s"
msgstr ""
#: plugin.py:342
#, docstring
msgid ""
"[<channel>] {increased,decreased,active}\n"
"\n"
" Returns the most increased, the most decreased, or the most active\n"
" (the sum of increased and decreased) karma things. <channel> is only\n"
" necessary if the message isn't sent in the channel itself.\n"
" "
msgstr ""
#: plugin.py:360
#, docstring
msgid ""
"[<channel>] <name>\n"
"\n"
" Resets the karma of <name> to 0.\n"
" "
msgstr ""
#: plugin.py:370
#, docstring
msgid ""
"[<channel>] <filename>\n"
"\n"
" Dumps the Karma database for <channel> to <filename> in the bot's\n"
" data directory. <channel> is only necessary if the message isn't sent\n"
" in the channel itself.\n"
" "
msgstr ""
#: plugin.py:382
#, docstring
msgid ""
"[<channel>] <filename>\n"
"\n"
" Loads the Karma database for <channel> from <filename> in the bot's\n"
" data directory. <channel> is only necessary if the message isn't sent\n"
" in the channel itself.\n"
" "
msgstr ""

View File

@ -38,6 +38,8 @@ import supybot.plugins as plugins
import supybot.ircmsgs as ircmsgs
import supybot.ircutils as ircutils
import supybot.callbacks as callbacks
from supybot.i18n import PluginInternationalization, internationalizeDocstring
_ = PluginInternationalization('Karma')
class SqliteKarmaDB(object):
def __init__(self, filename):
@ -238,7 +240,7 @@ class Karma(callbacks.Plugin):
thing = thing[:-2]
if ircutils.strEqual(thing, irc.msg.nick) and \
not self.registryValue('allowSelfRating', channel):
irc.error('You\'re not allowed to adjust your own karma.')
irc.error(_('You\'re not allowed to adjust your own karma.'))
elif thing:
self.db.increment(channel, self._normalizeThing(thing))
self._respond(irc, channel)
@ -246,7 +248,7 @@ class Karma(callbacks.Plugin):
thing = thing[:-2]
if ircutils.strEqual(thing, irc.msg.nick) and \
not self.registryValue('allowSelfRating', channel):
irc.error('You\'re not allowed to adjust your own karma.')
irc.error(_('You\'re not allowed to adjust your own karma.'))
elif thing:
self.db.decrement(channel, self._normalizeThing(thing))
self._respond(irc, channel)
@ -273,6 +275,7 @@ class Karma(callbacks.Plugin):
if thing[-2:] in ('++', '--'):
self._doKarma(irc, channel, thing)
@internationalizeDocstring
def karma(self, irc, msg, args, channel, things):
"""[<channel>] [<thing> ...]
@ -287,15 +290,15 @@ class Karma(callbacks.Plugin):
name = things[0]
t = self.db.get(channel, name)
if t is None:
irc.reply(format('%s has neutral karma.', name))
irc.reply(format(_('%s has neutral karma.'), name))
else:
(added, subtracted) = t
total = added - subtracted
if self.registryValue('simpleOutput', channel):
s = format('%s: %i', name, total)
else:
s = format('Karma for %q has been increased %n and '
'decreased %n for a total karma of %s.',
s = format(_('Karma for %q has been increased %n and '
'decreased %n for a total karma of %s.'),
name, (added, 'time'), (subtracted, 'time'),
total)
irc.reply(s)
@ -309,7 +312,8 @@ class Karma(callbacks.Plugin):
s += neutral
irc.reply(s + '.')
else:
irc.reply('I didn\'t know the karma for any of those things.')
irc.reply(_('I didn\'t know the karma for any of those '
'things.'))
else: # No name was given. Return the top/bottom N karmas.
limit = self.registryValue('rankingDisplay', channel)
top = self.db.top(channel, limit)
@ -318,21 +322,22 @@ class Karma(callbacks.Plugin):
lowest = [format('%q (%s)', s, t)
for (s, t) in self.db.bottom(channel, limit)]
if not (highest and lowest):
irc.error('I have no karma for this channel.')
irc.error(_('I have no karma for this channel.'))
return
rank = self.db.rank(channel, msg.nick)
if rank is not None:
total = self.db.size(channel)
rankS = format(' You (%s) are ranked %i out of %i.',
rankS = format(_(' You (%s) are ranked %i out of %i.'),
msg.nick, rank, total)
else:
rankS = ''
s = format('Highest karma: %L. Lowest karma: %L.%s',
s = format(_('Highest karma: %L. Lowest karma: %L.%s'),
highest, lowest, rankS)
irc.reply(s)
karma = wrap(karma, ['channel', any('something')])
_mostAbbrev = utils.abbrev(['increased', 'decreased', 'active'])
@internationalizeDocstring
def most(self, irc, msg, args, channel, kind):
"""[<channel>] {increased,decreased,active}
@ -346,10 +351,11 @@ class Karma(callbacks.Plugin):
L = [format('%q: %i', name, i) for (name, i) in L]
irc.reply(format('%L', L))
else:
irc.error('I have no karma for this channel.')
irc.error(_('I have no karma for this channel.'))
most = wrap(most, ['channel',
('literal', ['increased', 'decreased', 'active'])])
@internationalizeDocstring
def clear(self, irc, msg, args, channel, name):
"""[<channel>] <name>
@ -359,6 +365,7 @@ class Karma(callbacks.Plugin):
irc.replySuccess()
clear = wrap(clear, [('checkChannelCapability', 'op'), 'text'])
@internationalizeDocstring
def dump(self, irc, msg, args, channel, filename):
"""[<channel>] <filename>
@ -370,6 +377,7 @@ class Karma(callbacks.Plugin):
irc.replySuccess()
dump = wrap(dump, [('checkCapability', 'owner'), 'channeldb', 'filename'])
@internationalizeDocstring
def load(self, irc, msg, args, channel, filename):
"""[<channel>] <filename>

View File

@ -29,6 +29,8 @@
import supybot.conf as conf
import supybot.registry as registry
from supybot.i18n import PluginInternationalization, internationalizeDocstring
_ = PluginInternationalization('Lart')
def configure(advanced):
# This will be called by supybot to configure this module. advanced is
@ -42,10 +44,10 @@ def configure(advanced):
Lart = conf.registerPlugin('Lart')
# This is where your configuration variables (if any) should go. For example:
# conf.registerGlobalValue(Lart, 'someConfigVariableName',
# registry.Boolean(False, """Help for someConfigVariableName."""))
# registry.Boolean(False, _("""Help for someConfigVariableName.""")))
conf.registerChannelValue(Lart, 'showIds',
registry.Boolean(False, """Determines whether the bot will show the ids of
a lart when the lart is given."""))
registry.Boolean(False, _("""Determines whether the bot will show the ids
of a lart when the lart is given.""")))
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:

54
plugins/Lart/messages.pot Normal file
View File

@ -0,0 +1,54 @@
# 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:21+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:49
msgid ""
"Determines whether the bot will show the ids\n"
" of a lart when the lart is given."
msgstr ""
#: plugin.py:48
msgid "Larts must contain $who."
msgstr ""
#: plugin.py:52
#, docstring
msgid ""
"[<channel>] [<id>] <who|what> [for <reason>]\n"
"\n"
" Uses the Luser Attitude Readjustment Tool on <who|what> (for <reason>,\n"
" if given). If <id> is given, uses that specific lart. <channel> is\n"
" only necessary if the message isn't sent in the channel itself.\n"
" "
msgstr ""
#: plugin.py:66
msgid "There is no lart with id #%i."
msgstr ""
#: plugin.py:71
msgid "There are no larts in my database for %s."
msgstr ""
#: plugin.py:77
msgid "trying to dis me"
msgstr ""
#: plugin.py:85
msgid " for "
msgstr ""

View File

@ -32,6 +32,8 @@ import re
from supybot.commands import *
import supybot.plugins as plugins
import supybot.ircutils as ircutils
from supybot.i18n import PluginInternationalization, internationalizeDocstring
_ = PluginInternationalization('Lart')
class Lart(plugins.ChannelIdDatabasePlugin):
_meRe = re.compile(r'\bme\b', re.I)
@ -43,8 +45,9 @@ class Lart(plugins.ChannelIdDatabasePlugin):
def addValidator(self, irc, text):
if '$who' not in text:
irc.error('Larts must contain $who.', Raise=True)
irc.error(_('Larts must contain $who.'), Raise=True)
@internationalizeDocstring
def lart(self, irc, msg, args, channel, id, text):
"""[<channel>] [<id>] <who|what> [for <reason>]
@ -60,18 +63,18 @@ class Lart(plugins.ChannelIdDatabasePlugin):
try:
lart = self.db.get(channel, id)
except KeyError:
irc.error(format('There is no lart with id #%i.', id))
irc.error(format(_('There is no lart with id #%i.'), id))
return
else:
lart = self.db.random(channel)
if not lart:
irc.error(format('There are no larts in my database '
'for %s.', channel))
irc.error(format(_('There are no larts in my database '
'for %s.'), channel))
return
text = lart.text
if ircutils.strEqual(target, irc.nick):
target = msg.nick
reason = self._replaceFirstPerson('trying to dis me', irc.nick)
reason = self._replaceFirstPerson(_('trying to dis me'), irc.nick)
else:
target = self._replaceFirstPerson(target, msg.nick)
reason = self._replaceFirstPerson(reason, msg.nick)
@ -79,7 +82,7 @@ class Lart(plugins.ChannelIdDatabasePlugin):
target = target.rstrip('.')
text = text.replace('$who', target)
if reason:
text += ' for ' + reason
text += _(' for ') + reason
if self.registryValue('showIds', channel):
text += format(' (#%i)', lart.id)
irc.reply(text, action=True)

View File

@ -29,6 +29,8 @@
import supybot.conf as conf
import supybot.registry as registry
from supybot.i18n import PluginInternationalization, internationalizeDocstring
_ = PluginInternationalization('Later')
def configure(advanced):
# This will be called by setup.py to configure this module. Advanced is
@ -40,10 +42,11 @@ def configure(advanced):
Later = conf.registerPlugin('Later')
conf.registerGlobalValue(Later, 'maximum',
registry.NonNegativeInteger(0, """Determines the maximum number of messages
to be queued for a user. If this value is 0, there is no maximum."""))
registry.NonNegativeInteger(0, _("""Determines the maximum number of
messages to be queued for a user. If this value is 0, there is no maximum.
""")))
conf.registerGlobalValue(Later, 'private',
registry.Boolean(True, """Determines whether users will be notified in the
first place in which they're seen, or in private."""))
registry.Boolean(True, _("""Determines whether users will be notified in
the first place in which they're seen, or in private.""")))
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:

101
plugins/Later/messages.pot Normal file
View File

@ -0,0 +1,101 @@
# 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:21+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 the maximum number of\n"
" messages to be queued for a user. If this value is 0, there is no maximum.\n"
" "
msgstr ""
#: config.py:49
msgid ""
"Determines whether users will be notified in\n"
" the first place in which they're seen, or in private."
msgstr ""
#: plugin.py:47
#, docstring
msgid ""
"Used to do things later; currently, it only allows the sending of\n"
" nick-based notes. Do note (haha!) that these notes are *not* private\n"
" and don't even pretend to be; if you want such features, consider using the\n"
" Note plugin."
msgstr ""
#: plugin.py:87
msgid "just now"
msgstr ""
#: plugin.py:108
#, docstring
msgid ""
"<nick> <text>\n"
"\n"
" Tells <nick> <text> the next time <nick> is in seen. <nick> can\n"
" contain wildcard characters, and the first matching nick will be\n"
" given the note.\n"
" "
msgstr ""
#: plugin.py:115
msgid "I can't send notes to myself."
msgstr ""
#: plugin.py:121
msgid "That person's message queue is already full."
msgstr ""
#: plugin.py:126
#, docstring
msgid ""
"[<nick>]\n"
"\n"
" If <nick> is given, replies with what notes are waiting on <nick>,\n"
" otherwise, replies with the nicks that have notes waiting for them.\n"
" "
msgstr ""
#: plugin.py:137
msgid "I have no notes for that nick."
msgstr ""
#: plugin.py:142
msgid "I currently have notes waiting for %L."
msgstr ""
#: plugin.py:145
msgid "I have no notes waiting to be delivered."
msgstr ""
#: plugin.py:150
#, docstring
msgid ""
"<nick>\n"
"\n"
" Removes the notes waiting on <nick>.\n"
" "
msgstr ""
#: plugin.py:159
msgid "There were no notes for %r"
msgstr ""
#: plugin.py:183
msgid "Sent %s: <%s> %s"
msgstr ""

View File

@ -38,8 +38,11 @@ from supybot.commands import *
import supybot.ircmsgs as ircmsgs
import supybot.ircutils as ircutils
import supybot.callbacks as callbacks
from supybot.i18n import PluginInternationalization, internationalizeDocstring
_ = PluginInternationalization('Later')
@internationalizeDocstring
class Later(callbacks.Plugin):
"""Used to do things later; currently, it only allows the sending of
nick-based notes. Do note (haha!) that these notes are *not* private
@ -81,7 +84,7 @@ class Later(callbacks.Plugin):
try:
return utils.timeElapsed(diff, seconds=False) + ' ago'
except ValueError:
return 'just now'
return _('just now')
def _addNote(self, nick, whence, text, at=None, maximum=None):
if at is None:
@ -100,6 +103,7 @@ class Later(callbacks.Plugin):
self.wildcards.append(nick)
self._flushNotes()
@internationalizeDocstring
def tell(self, irc, msg, args, nick, text):
"""<nick> <text>
@ -108,15 +112,16 @@ class Later(callbacks.Plugin):
given the note.
"""
if ircutils.strEqual(nick, irc.nick):
irc.error('I can\'t send notes to myself.')
irc.error(_('I can\'t send notes to myself.'))
return
try:
self._addNote(nick, msg.nick, text)
irc.replySuccess()
except ValueError:
irc.error('That person\'s message queue is already full.')
irc.error(_('That person\'s message queue is already full.'))
tell = wrap(tell, ['something', 'text'])
@internationalizeDocstring
def notes(self, irc, msg, args, nick):
"""[<nick>]
@ -129,17 +134,18 @@ class Later(callbacks.Plugin):
for (when, whence, note) in self._notes[nick]]
irc.reply(format('%L', notes))
else:
irc.error('I have no notes for that nick.')
irc.error(_('I have no notes for that nick.'))
else:
nicks = self._notes.keys()
if nicks:
utils.sortBy(ircutils.toLower, nicks)
irc.reply(format('I currently have notes waiting for %L.',
irc.reply(format(_('I currently have notes waiting for %L.'),
nicks))
else:
irc.error('I have no notes waiting to be delivered.')
irc.error(_('I have no notes waiting to be delivered.'))
notes = wrap(notes, [additional('something')])
@internationalizeDocstring
def remove(self, irc, msg, args, nick):
"""<nick>
@ -150,7 +156,7 @@ class Later(callbacks.Plugin):
self._flushNotes()
irc.replySuccess()
except KeyError:
irc.error('There were no notes for %r' % nick)
irc.error(_('There were no notes for %r') % nick)
remove = wrap(remove, [('checkCapability', 'admin'), 'something'])
def doPrivmsg(self, irc, msg):
@ -174,7 +180,7 @@ class Later(callbacks.Plugin):
self._flushNotes()
def _formatNote(self, when, whence, note):
return 'Sent %s: <%s> %s' % (self._timestamp(when), whence, note)
return _('Sent %s: <%s> %s') % (self._timestamp(when), whence, note)

View File

@ -29,6 +29,8 @@
import supybot.conf as conf
import supybot.registry as registry
from supybot.i18n import PluginInternationalization, internationalizeDocstring
_ = PluginInternationalization('Limiter')
def configure(advanced):
# This will be called by supybot to configure this module. advanced is
@ -41,17 +43,17 @@ def configure(advanced):
Limiter = conf.registerPlugin('Limiter')
conf.registerChannelValue(Limiter, 'enable',
registry.Boolean(False, """Determines whether the bot will maintain the
registry.Boolean(False, _("""Determines whether the bot will maintain the
channel limit to be slightly above the current number of people in the
channel, in order to make clone/drone attacks harder."""))
channel, in order to make clone/drone attacks harder.""")))
conf.registerChannelValue(Limiter, 'minimumExcess',
registry.PositiveInteger(5, """Determines the minimum number of free
registry.PositiveInteger(5, _("""Determines the minimum number of free
spots that will be saved when limits are being enforced. This should
always be smaller than supybot.plugins.Limiter.limit.maximumExcess."""))
always be smaller than supybot.plugins.Limiter.limit.maximumExcess.""")))
conf.registerChannelValue(Limiter, 'maximumExcess',
registry.PositiveInteger(10, """Determines the maximum number of free spots
registry.PositiveInteger(10, _("""Determines the maximum number of free spots
that will be saved when limits are being enforced. This should always be
larger than supybot.plugins.Limiter.limit.minimumExcess."""))
larger than supybot.plugins.Limiter.limit.minimumExcess.""")))
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:

View File

@ -0,0 +1,50 @@
# 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:46
msgid ""
"Determines whether the bot will maintain the\n"
" channel limit to be slightly above the current number of people in the\n"
" channel, in order to make clone/drone attacks harder."
msgstr ""
#: config.py:50
msgid ""
"Determines the minimum number of free\n"
" spots that will be saved when limits are being enforced. This should\n"
" always be smaller than supybot.plugins.Limiter.limit.maximumExcess."
msgstr ""
#: config.py:54
msgid ""
"Determines the maximum number of free spots\n"
" that will be saved when limits are being enforced. This should always be\n"
" larger than supybot.plugins.Limiter.limit.minimumExcess."
msgstr ""
#: plugin.py:40
#, docstring
msgid ""
"In order to use this plugin, its config values need to be properly\n"
" setup. supybot.plugins.Limiter.enable needs to be set to True and\n"
" supybot.plugins.Limiter.{maximumExcess,minimumExcess} should be set to\n"
" values appropriate to your channel (if the defaults aren't satisfactory.\n"
" Once these are set, and someone enters/leaves the channel, Supybot will\n"
" start setting the proper +l modes.\n"
" "
msgstr ""

View File

@ -32,8 +32,10 @@ from supybot.commands import *
import supybot.ircmsgs as ircmsgs
import supybot.ircutils as ircutils
import supybot.callbacks as callbacks
from supybot.i18n import PluginInternationalization, internationalizeDocstring
_ = PluginInternationalization('Limiter')
@internationalizeDocstring
class Limiter(callbacks.Plugin):
"""In order to use this plugin, its config values need to be properly
setup. supybot.plugins.Limiter.enable needs to be set to True and

View File

@ -29,6 +29,8 @@
import supybot.conf as conf
import supybot.registry as registry
from supybot.i18n import PluginInternationalization, internationalizeDocstring
_ = PluginInternationalization('Math')
def configure(advanced):
# This will be called by supybot to configure this module. advanced is
@ -42,7 +44,7 @@ def configure(advanced):
Math = conf.registerPlugin('Math')
# This is where your configuration variables (if any) should go. For example:
# conf.registerGlobalValue(Math, 'someConfigVariableName',
# registry.Boolean(False, """Help for someConfigVariableName."""))
# registry.Boolean(False, _("""Help for someConfigVariableName.""")))
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:

129
plugins/Math/messages.pot Normal file
View File

@ -0,0 +1,129 @@
# 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"
#: plugin.py:52
#, docstring
msgid ""
"<fromBase> [<toBase>] <number>\n"
"\n"
" Converts <number> from base <fromBase> to base <toBase>.\n"
" If <toBase> is left out, it converts to decimal.\n"
" "
msgstr ""
#: plugin.py:63
msgid "Invalid <number> for base %s: %s"
msgstr ""
#: plugin.py:69
#, docstring
msgid "Convert a decimal number to another base; returns a string."
msgstr ""
#: plugin.py:90
#, docstring
msgid ""
"Convert a number from any base, 2 through 36, to any other\n"
" base, 2 through 36. Returns a string."
msgstr ""
#: plugin.py:157
#, docstring
msgid ""
"<math expression>\n"
"\n"
" Returns the value of the evaluated <math expression>. The syntax is\n"
" Python syntax; the type of arithmetic is floating point. Floating\n"
" point arithmetic is used in order to prevent a user from being able to\n"
" crash to the bot with something like '10**10**10**10'. One consequence\n"
" is that large values such as '10**24' might not be exact.\n"
" "
msgstr ""
#: plugin.py:166 plugin.py:220
msgid "There's really no reason why you should have underscores or brackets in your mathematical expression. Please remove them."
msgstr ""
#: plugin.py:172 plugin.py:228
msgid "You can't use lambda in this command."
msgstr ""
#: plugin.py:202 plugin.py:236
msgid "The answer exceeded %s or so."
msgstr ""
#: plugin.py:204 plugin.py:238
msgid "Something in there wasn't a valid number."
msgstr ""
#: plugin.py:206 plugin.py:240
msgid "%s is not a defined function."
msgstr ""
#: plugin.py:213
#, docstring
msgid ""
"<math expression>\n"
"\n"
" This is the same as the calc command except that it allows integer\n"
" math, and can thus cause the bot to suck up CPU. Hence it requires\n"
" the 'trusted' capability to use.\n"
" "
msgstr ""
#: plugin.py:250
#, docstring
msgid ""
"<rpn math expression>\n"
"\n"
" Returns the value of an RPN expression.\n"
" "
msgstr ""
#: plugin.py:275
msgid "Not enough arguments for %s"
msgstr ""
#: plugin.py:288
msgid "%q is not a defined function."
msgstr ""
#: plugin.py:295
msgid "Stack: [%s]"
msgstr ""
#: plugin.py:299
#, docstring
msgid ""
"[<number>] <unit> to <other unit>\n"
"\n"
" Converts from <unit> to <other unit>. If number isn't given, it\n"
" defaults to 1. For unit information, see 'units' command.\n"
" "
msgstr ""
#: plugin.py:314
#, docstring
msgid ""
" [<type>]\n"
"\n"
" With no arguments, returns a list of measurement types, which can be\n"
" passed as arguments. When called with a type as an argument, returns\n"
" the units of that type.\n"
" "
msgstr ""

View File

@ -39,12 +39,15 @@ import string
import supybot.utils as utils
from supybot.commands import *
import supybot.callbacks as callbacks
from supybot.i18n import PluginInternationalization, internationalizeDocstring
_ = PluginInternationalization('Math')
convertcore = utils.python.universalImport('local.convertcore')
baseArg = ('int', 'base', lambda i: i <= 36)
class Math(callbacks.Plugin):
@internationalizeDocstring
def base(self, irc, msg, args, frm, to, number):
"""<fromBase> [<toBase>] <number>
@ -57,7 +60,7 @@ class Math(callbacks.Plugin):
try:
irc.reply(self._convertBaseToBase(number, to, frm))
except ValueError:
irc.error('Invalid <number> for base %s: %s' % (frm, number))
irc.error(_('Invalid <number> for base %s: %s') % (frm, number))
base = wrap(base, [('int', 'base', lambda i: 2 <= i <= 36),
optional(('int', 'base', lambda i: 2 <= i <= 36), 10),
additional('something')])
@ -149,6 +152,7 @@ class Math(callbacks.Plugin):
# Then we delete all square brackets, underscores, and whitespace, so no
# one can do list comprehensions or call __...__ functions.
###
@internationalizeDocstring
def calc(self, irc, msg, args, text):
"""<math expression>
@ -159,13 +163,13 @@ class Math(callbacks.Plugin):
is that large values such as '10**24' might not be exact.
"""
if text != text.translate(utils.str.chars, '_[]'):
irc.error('There\'s really no reason why you should have '
irc.error(_('There\'s really no reason why you should have '
'underscores or brackets in your mathematical '
'expression. Please remove them.')
'expression. Please remove them.'))
return
#text = text.translate(utils.str.chars, '_[] \t')
if 'lambda' in text:
irc.error('You can\'t use lambda in this command.')
irc.error(_('You can\'t use lambda in this command.'))
return
text = text.lower()
def handleMatch(m):
@ -195,15 +199,16 @@ class Math(callbacks.Plugin):
irc.reply(self._complexToString(x))
except OverflowError:
maxFloat = math.ldexp(0.9999999999999999, 1024)
irc.error('The answer exceeded %s or so.' % maxFloat)
irc.error(_('The answer exceeded %s or so.') % maxFloat)
except TypeError:
irc.error('Something in there wasn\'t a valid number.')
irc.error(_('Something in there wasn\'t a valid number.'))
except NameError, e:
irc.error('%s is not a defined function.' % str(e).split()[1])
irc.error(_('%s is not a defined function.') % str(e).split()[1])
except Exception, e:
irc.error(str(e))
calc = wrap(calc, ['text'])
@internationalizeDocstring
def icalc(self, irc, msg, args, text):
"""<math expression>
@ -212,15 +217,15 @@ class Math(callbacks.Plugin):
the 'trusted' capability to use.
"""
if text != text.translate(utils.str.chars, '_[]'):
irc.error('There\'s really no reason why you should have '
irc.error(_('There\'s really no reason why you should have '
'underscores or brackets in your mathematical '
'expression. Please remove them.')
'expression. Please remove them.'))
return
# This removes spaces, too, but we'll leave the removal of _[] for
# safety's sake.
text = text.translate(utils.str.chars, '_[] \t')
if 'lambda' in text:
irc.error('You can\'t use lambda in this command.')
irc.error(_('You can\'t use lambda in this command.'))
return
text = text.replace('lambda', '')
try:
@ -228,11 +233,11 @@ class Math(callbacks.Plugin):
irc.reply(str(eval(text, self._mathEnv, self._mathEnv)))
except OverflowError:
maxFloat = math.ldexp(0.9999999999999999, 1024)
irc.error('The answer exceeded %s or so.' % maxFloat)
irc.error(_('The answer exceeded %s or so.') % maxFloat)
except TypeError:
irc.error('Something in there wasn\'t a valid number.')
irc.error(_('Something in there wasn\'t a valid number.'))
except NameError, e:
irc.error('%s is not a defined function.' % str(e).split()[1])
irc.error(_('%s is not a defined function.') % str(e).split()[1])
except Exception, e:
irc.error(utils.exnToString(e))
icalc = wrap(icalc, [('checkCapability', 'trusted'), 'text'])
@ -267,7 +272,7 @@ class Math(callbacks.Plugin):
except TypeError:
pass
if not called:
irc.error('Not enough arguments for %s' % arg)
irc.error(_('Not enough arguments for %s') % arg)
return
else:
stack.append(f)
@ -280,14 +285,16 @@ class Math(callbacks.Plugin):
try:
stack.append(eval(s, self._mathEnv, self._mathEnv))
except SyntaxError:
irc.error(format('%q is not a defined function.', arg))
irc.error(format(_('%q is not a defined function.'),
arg))
return
if len(stack) == 1:
irc.reply(str(self._complexToString(complex(stack[0]))))
else:
s = ', '.join(map(self._complexToString, map(complex, stack)))
irc.reply('Stack: [%s]' % s)
irc.reply(_('Stack: [%s]') % s)
@internationalizeDocstring
def convert(self, irc, msg, args, number, unit1, unit2):
"""[<number>] <unit> to <other unit>
@ -302,6 +309,7 @@ class Math(callbacks.Plugin):
irc.error(str(ude))
convert = wrap(convert, [optional('float', 1.0),'something','to','text'])
@internationalizeDocstring
def units(self, irc, msg, args, type):
""" [<type>]