Internationalize Relay, Reply, RSS, Scheduler

This commit is contained in:
Valentin Lorentz 2010-10-19 19:50:41 +02:00
parent 029c0cbe80
commit aaa0c480af
12 changed files with 640 additions and 78 deletions

View File

@ -30,6 +30,8 @@
import supybot.conf as conf
import supybot.registry as registry
import supybot.callbacks as callbacks
from supybot.i18n import PluginInternationalization, internationalizeDocstring
_ = PluginInternationalization('RSS')
def configure(advanced):
# This will be called by supybot to configure this module. advanced is
@ -45,37 +47,37 @@ class FeedNames(registry.SpaceSeparatedListOfStrings):
RSS = conf.registerPlugin('RSS')
conf.registerChannelValue(RSS, 'bold', registry.Boolean(
True, """Determines whether the bot will bold the title of the feed when it
announces new news."""))
True, _("""Determines whether the bot will bold the title of the feed when
it announces new news.""")))
conf.registerChannelValue(RSS, 'headlineSeparator',
registry.StringSurroundedBySpaces(' || ', """Determines what string is used
to separate headlines in new feeds."""))
registry.StringSurroundedBySpaces(' || ', _("""Determines what string is
used to separate headlines in new feeds.""")))
conf.registerChannelValue(RSS, 'announcementPrefix',
registry.StringWithSpaceOnRight('New news from ', """Determines what prefix
is prepended (if any) to the new news item announcements made in the
channel."""))
registry.StringWithSpaceOnRight('New news from ', _("""Determines what
prefix is prepended (if any) to the new news item announcements made in the
channel.""")))
conf.registerChannelValue(RSS, 'announce',
registry.SpaceSeparatedSetOfStrings([], """Determines which RSS feeds
registry.SpaceSeparatedSetOfStrings([], _("""Determines which RSS feeds
should be announced in the channel; valid input is a list of strings
(either registered RSS feeds or RSS feed URLs) separated by spaces."""))
(either registered RSS feeds or RSS feed URLs) separated by spaces.""")))
conf.registerGlobalValue(RSS, 'waitPeriod',
registry.PositiveInteger(1800, """Indicates how many seconds the bot will
registry.PositiveInteger(1800, _("""Indicates how many seconds the bot will
wait between retrieving RSS feeds; requests made within this period will
return cached results."""))
return cached results.""")))
conf.registerGlobalValue(RSS, 'feeds',
FeedNames([], """Determines what feeds should be accessible as
commands."""))
FeedNames([], _("""Determines what feeds should be accessible as
commands.""")))
conf.registerChannelValue(RSS, 'showLinks',
registry.Boolean(False, """Determines whether the bot will list the link
registry.Boolean(False, _("""Determines whether the bot will list the link
along with the title of the feed when the rss command is called.
supybot.plugins.RSS.announce.showLinks affects whether links will be
listed when a feed is automatically announced."""))
listed when a feed is automatically announced.""")))
conf.registerGroup(RSS, 'announce')
conf.registerChannelValue(RSS.announce, 'showLinks',
registry.Boolean(False, """Determines whether the bot will list the link
registry.Boolean(False, _("""Determines whether the bot will list the link
along with the title of the feed when a feed is automatically
announced."""))
announced.""")))

164
plugins/RSS/messages.pot Normal file
View File

@ -0,0 +1,164 @@
# 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-19 19:27+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:50
msgid ""
"Determines whether the bot will bold the title of the feed when it\n"
" announces new news."
msgstr ""
#: config.py:53
msgid ""
"Determines what string is used\n"
" to separate headlines in new feeds."
msgstr ""
#: config.py:56
msgid ""
"Determines what prefix\n"
" is prepended (if any) to the new news item announcements made in the\n"
" channel."
msgstr ""
#: config.py:60
msgid ""
"Determines which RSS feeds\n"
" should be announced in the channel; valid input is a list of strings\n"
" (either registered RSS feeds or RSS feed URLs) separated by spaces."
msgstr ""
#: config.py:64
msgid ""
"Indicates how many seconds the bot will\n"
" wait between retrieving RSS feeds; requests made within this period will\n"
" return cached results."
msgstr ""
#: config.py:68
msgid ""
"Determines what feeds should be accessible as\n"
" commands."
msgstr ""
#: config.py:71
msgid ""
"Determines whether the bot will list the link\n"
" along with the title of the feed when the rss command is called.\n"
" supybot.plugins.RSS.announce.showLinks affects whether links will be\n"
" listed when a feed is automatically announced."
msgstr ""
#: config.py:78
msgid ""
"Determines whether the bot will list the link\n"
" along with the title of the feed when a feed is automatically\n"
" announced."
msgstr ""
#: plugin.py:63
#, docstring
msgid ""
"This plugin is useful both for announcing updates to RSS feeds in a\n"
" channel, and for retrieving the headlines of RSS feeds via command. Use\n"
" the \"add\" command to add feeds to this plugin, and use the \"announce\"\n"
" command to determine what feeds should be announced in a given channel."
msgstr ""
#: plugin.py:311
#, docstring
msgid ""
"<name> <url>\n"
"\n"
" Adds a command to this plugin that will look up the RSS feed at the\n"
" given URL.\n"
" "
msgstr ""
#: plugin.py:322
#, docstring
msgid ""
"<name>\n"
"\n"
" Removes the command for looking up RSS feeds at <name> from\n"
" this plugin.\n"
" "
msgstr ""
#: plugin.py:328
msgid "That's not a valid RSS feed command name."
msgstr ""
#: plugin.py:346
msgid "I am currently not announcing any feeds."
msgstr ""
#: plugin.py:351
#, docstring
msgid ""
"[<channel>] <name|url> [<name|url> ...]\n"
"\n"
" Adds the list of feeds to the current list of announced feeds in\n"
" <channel>. Valid feeds include the names of registered feeds as\n"
" well as URLs for RSS feeds. <channel> is only necessary if the\n"
" message isn't sent in the channel itself.\n"
" "
msgstr ""
#: plugin.py:369
#, docstring
msgid ""
"[<channel>] <name|url> [<name|url> ...]\n"
"\n"
" Removes the list of feeds from the current list of announced feeds\n"
" in <channel>. Valid feeds include the names of registered feeds as\n"
" well as URLs for RSS feeds. <channel> is only necessary if the\n"
" message isn't sent in the channel itself.\n"
" "
msgstr ""
#: plugin.py:387
#, docstring
msgid ""
"<url> [<number of headlines>]\n"
"\n"
" Gets the title components of the given RSS feed.\n"
" If <number of headlines> is given, return only that many headlines.\n"
" "
msgstr ""
#: plugin.py:400
msgid "Couldn't get RSS feed."
msgstr ""
#: plugin.py:413
#, docstring
msgid ""
"<url|feed>\n"
"\n"
" Returns information from the given RSS feed, namely the title,\n"
" URL, description, and last update date, if available.\n"
" "
msgstr ""
#: plugin.py:426
msgid "I couldn't retrieve that RSS feed."
msgstr ""
#: plugin.py:439
msgid "Title: %s; URL: %u; Description: %s; Last updated: %s."
msgstr ""

View File

@ -41,6 +41,8 @@ from supybot.commands import *
import supybot.ircutils as ircutils
import supybot.registry as registry
import supybot.callbacks as callbacks
from supybot.i18n import PluginInternationalization, internationalizeDocstring
_ = PluginInternationalization('RSS')
try:
feedparser = utils.python.universalImport('feedparser', 'local.feedparser')
@ -56,6 +58,7 @@ def getFeedName(irc, msg, args, state):
state.args.append(callbacks.canonicalName(args.pop(0)))
addConverter('feedName', getFeedName)
@internationalizeDocstring
class RSS(callbacks.Plugin):
"""This plugin is useful both for announcing updates to RSS feeds in a
channel, and for retrieving the headlines of RSS feeds via command. Use
@ -280,6 +283,7 @@ class RSS(callbacks.Plugin):
headlines.append((title, None))
return headlines
@internationalizeDocstring
def makeFeedCommand(self, name, url):
docstring = format("""[<number of headlines>]
@ -302,6 +306,7 @@ class RSS(callbacks.Plugin):
self.feedNames[name] = (url, f)
self._registerFeed(name, url)
@internationalizeDocstring
def add(self, irc, msg, args, name, url):
"""<name> <url>
@ -312,6 +317,7 @@ class RSS(callbacks.Plugin):
irc.replySuccess()
add = wrap(add, ['feedName', 'url'])
@internationalizeDocstring
def remove(self, irc, msg, args, name):
"""<name>
@ -319,7 +325,7 @@ class RSS(callbacks.Plugin):
this plugin.
"""
if name not in self.feedNames:
irc.error('That\'s not a valid RSS feed command name.')
irc.error(_('That\'s not a valid RSS feed command name.'))
return
del self.feedNames[name]
conf.supybot.plugins.RSS.feeds().remove(name)
@ -327,6 +333,7 @@ class RSS(callbacks.Plugin):
irc.replySuccess()
remove = wrap(remove, ['feedName'])
@internationalizeDocstring
class announce(callbacks.Commands):
def list(self, irc, msg, args, channel):
"""[<channel>]
@ -336,9 +343,10 @@ class RSS(callbacks.Plugin):
"""
announce = conf.supybot.plugins.RSS.announce
feeds = format('%L', list(announce.get(channel)()))
irc.reply(feeds or 'I am currently not announcing any feeds.')
irc.reply(feeds or _('I am currently not announcing any feeds.'))
list = wrap(list, ['channel',])
@internationalizeDocstring
def add(self, irc, msg, args, channel, feeds):
"""[<channel>] <name|url> [<name|url> ...]
@ -356,6 +364,7 @@ class RSS(callbacks.Plugin):
add = wrap(add, [('checkChannelCapability', 'op'),
many(first('url', 'feedName'))])
@internationalizeDocstring
def remove(self, irc, msg, args, channel, feeds):
"""[<channel>] <name|url> [<name|url> ...]
@ -373,6 +382,7 @@ class RSS(callbacks.Plugin):
remove = wrap(remove, [('checkChannelCapability', 'op'),
many(first('url', 'feedName'))])
@internationalizeDocstring
def rss(self, irc, msg, args, url, n):
"""<url> [<number of headlines>]
@ -387,7 +397,7 @@ class RSS(callbacks.Plugin):
channel = None
headlines = self.getHeadlines(feed)
if not headlines:
irc.error('Couldn\'t get RSS feed.')
irc.error(_('Couldn\'t get RSS feed.'))
return
headlines = self.buildHeadlines(headlines, channel, 'showLinks')
if n:
@ -398,6 +408,7 @@ class RSS(callbacks.Plugin):
irc.replies(headlines, joiner=sep)
rss = wrap(rss, ['url', additional('int')])
@internationalizeDocstring
def info(self, irc, msg, args, url):
"""<url|feed>
@ -412,7 +423,7 @@ class RSS(callbacks.Plugin):
conv = self._getConverter(feed)
info = feed.get('feed')
if not info:
irc.error('I couldn\'t retrieve that RSS feed.')
irc.error(_('I couldn\'t retrieve that RSS feed.'))
return
# check the 'modified_parsed' key, if it's there, convert it here first
if 'modified' in info:
@ -425,8 +436,8 @@ class RSS(callbacks.Plugin):
desc = conv(info.get('description', 'unavailable'))
link = conv(info.get('link', 'unavailable'))
# The rest of the entries are all available in the channel key
response = format('Title: %s; URL: %u; '
'Description: %s; Last updated: %s.',
response = format(_('Title: %s; URL: %u; '
'Description: %s; Last updated: %s.'),
title, link, desc, when)
irc.reply(utils.str.normalizeWhitespace(response))
info = wrap(info, [first('url', 'feedName')])

View File

@ -30,14 +30,16 @@
import supybot.conf as conf
import supybot.ircutils as ircutils
import supybot.registry as registry
from supybot.i18n import PluginInternationalization, internationalizeDocstring
_ = PluginInternationalization('Relay')
def configure(advanced):
from supybot.questions import output, expect, anything, something, yn
conf.registerPlugin('Relay', True)
if yn('Would you like to relay between any channels?'):
channels = anything('What channels? Separated them by spaces.')
if yn(_('Would you like to relay between any channels?')):
channels = anything(_('What channels? Separated them by spaces.'))
conf.supybot.plugins.Relay.channels.set(channels)
if yn('Would you like to use color to distinguish between nicks?'):
if yn(_('Would you like to use color to distinguish between nicks?')):
conf.supybot.plugins.Relay.color.setValue(True)
output("""Right now there's no way to configure the actual connection to
the server. What you'll need to do when the bot finishes starting up is
@ -54,36 +56,36 @@ class Networks(registry.SpaceSeparatedListOf):
Relay = conf.registerPlugin('Relay')
conf.registerChannelValue(Relay, 'color',
registry.Boolean(False, """Determines whether the bot will color relayed
PRIVMSGs so as to make the messages easier to read."""))
registry.Boolean(False, _("""Determines whether the bot will color relayed
PRIVMSGs so as to make the messages easier to read.""")))
conf.registerChannelValue(Relay, 'topicSync',
registry.Boolean(True, """Determines whether the bot will synchronize
topics between networks in the channels it relays."""))
registry.Boolean(True, _("""Determines whether the bot will synchronize
topics between networks in the channels it relays.""")))
conf.registerChannelValue(Relay, 'hostmasks',
registry.Boolean(False, """Determines whether the bot will relay the
registry.Boolean(False, _("""Determines whether the bot will relay the
hostmask of the person joining or parting the channel when he or she joins
or parts."""))
or parts.""")))
conf.registerChannelValue(Relay, 'includeNetwork',
registry.Boolean(True, """Determines whether the bot will include the
registry.Boolean(True, _("""Determines whether the bot will include the
network in relayed PRIVMSGs; if you're only relaying between two networks,
it's somewhat redundant, and you may wish to save the space."""))
it's somewhat redundant, and you may wish to save the space.""")))
conf.registerChannelValue(Relay, 'punishOtherRelayBots',
registry.Boolean(False, """Determines whether the bot will detect other
bots relaying and respond by kickbanning them."""))
registry.Boolean(False, _("""Determines whether the bot will detect other
bots relaying and respond by kickbanning them.""")))
conf.registerGlobalValue(Relay, 'channels',
conf.SpaceSeparatedSetOfChannels([], """Determines which channels the bot
will relay in."""))
conf.SpaceSeparatedSetOfChannels([], _("""Determines which channels the bot
will relay in.""")))
conf.registerChannelValue(Relay.channels, 'joinOnAllNetworks',
registry.Boolean(True, """Determines whether the bot
registry.Boolean(True, _("""Determines whether the bot
will always join the channel(s) it relays for on all networks the bot is
connected to."""))
connected to.""")))
conf.registerChannelValue(Relay, 'ignores',
Ignores([], """Determines what hostmasks will not be relayed on a
channel."""))
Ignores([], _("""Determines what hostmasks will not be relayed on a
channel.""")))
conf.registerChannelValue(Relay, 'noticeNonPrivmsgs',
registry.Boolean(False, """Determines whether the bot will used NOTICEs
registry.Boolean(False, _("""Determines whether the bot will used NOTICEs
rather than PRIVMSGs for non-PRIVMSG relay messages (i.e., joins, parts,
nicks, quits, modes, etc.)"""))
nicks, quits, modes, etc.)""")))
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:

215
plugins/Relay/messages.pot Normal file
View File

@ -0,0 +1,215 @@
# 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-19 19:27+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:39
msgid "Would you like to relay between any channels?"
msgstr ""
#: config.py:40
msgid "What channels? Separated them by spaces."
msgstr ""
#: config.py:42
msgid "Would you like to use color to distinguish between nicks?"
msgstr ""
#: config.py:59
msgid ""
"Determines whether the bot will color relayed\n"
" PRIVMSGs so as to make the messages easier to read."
msgstr ""
#: config.py:62
msgid ""
"Determines whether the bot will synchronize\n"
" topics between networks in the channels it relays."
msgstr ""
#: config.py:65
msgid ""
"Determines whether the bot will relay the\n"
" hostmask of the person joining or parting the channel when he or she joins\n"
" or parts."
msgstr ""
#: config.py:69
msgid ""
"Determines whether the bot will include the\n"
" network in relayed PRIVMSGs; if you're only relaying between two networks,\n"
" it's somewhat redundant, and you may wish to save the space."
msgstr ""
#: config.py:73
msgid ""
"Determines whether the bot will detect other\n"
" bots relaying and respond by kickbanning them."
msgstr ""
#: config.py:76
msgid ""
"Determines which channels the bot\n"
" will relay in."
msgstr ""
#: config.py:79
msgid ""
"Determines whether the bot\n"
" will always join the channel(s) it relays for on all networks the bot is\n"
" connected to."
msgstr ""
#: config.py:83
msgid ""
"Determines what hostmasks will not be relayed on a\n"
" channel."
msgstr ""
#: config.py:86
msgid ""
"Determines whether the bot will used NOTICEs\n"
" rather than PRIVMSGs for non-PRIVMSG relay messages (i.e., joins, parts,\n"
" nicks, quits, modes, etc.)"
msgstr ""
#: plugin.py:99
#, docstring
msgid ""
"[<channel>]\n"
"\n"
" Starts relaying between the channel <channel> on all networks. If on a\n"
" network the bot isn't in <channel>, he'll join. This commands is\n"
" required even if the bot is in the channel on both networks; he won't\n"
" relay between those channels unless he's told to join both\n"
" channels. If <channel> is not given, starts relaying on the channel\n"
" the message was sent in.\n"
" "
msgstr ""
#: plugin.py:118
#, docstring
msgid ""
"<channel>\n"
"\n"
" Ceases relaying between the channel <channel> on all networks. The bot\n"
" will part from the channel on all networks in which it is on the\n"
" channel.\n"
" "
msgstr ""
#: plugin.py:133
#, docstring
msgid ""
"[<channel>]\n"
"\n"
" Returns the nicks of the people in the channel on the various networks\n"
" the bot is connected to. <channel> is only necessary if the message\n"
" isn't sent on the channel itself.\n"
" "
msgstr ""
#: plugin.py:223
msgid "is an op on %L"
msgstr ""
#: plugin.py:225
msgid "is a halfop on %L"
msgstr ""
#: plugin.py:227
msgid "is voiced on %L"
msgstr ""
#: plugin.py:230
msgid "is also on %L"
msgstr ""
#: plugin.py:232
msgid "is on %L"
msgstr ""
#: plugin.py:234
msgid "isn't on any non-secret channels"
msgstr ""
#: plugin.py:241 plugin.py:242 plugin.py:246
msgid "<unknown>"
msgstr ""
#: plugin.py:248
msgid " %s is away: %s."
msgstr ""
#: plugin.py:253
msgid " identified"
msgstr ""
#: plugin.py:258
msgid "%s (%s) has been%s on server %s since %s (idle for %s) and %s.%s"
msgstr ""
#: plugin.py:273
msgid "There is no %s on %s."
msgstr ""
#: plugin.py:342
msgid "You seem to be relaying, punk."
msgstr ""
#: plugin.py:395
msgid "%s%s has joined on %s"
msgstr ""
#: plugin.py:410
msgid "%s%s has left on %s (%s)"
msgstr ""
#: plugin.py:413
msgid "%s%s has left on %s"
msgstr ""
#: plugin.py:423
msgid "mode change by %s on %s: %s"
msgstr ""
#: plugin.py:435
msgid "%s was kicked by %s on %s (%s)"
msgstr ""
#: plugin.py:438
msgid "%s was kicked by %s on %s"
msgstr ""
#: plugin.py:447
msgid "nick change by %s to %s on %s"
msgstr ""
#: plugin.py:477
msgid "topic change by %s on %s: %s"
msgstr ""
#: plugin.py:486
msgid "%s has quit %s (%s)"
msgstr ""
#: plugin.py:488
msgid "%s has quit %s."
msgstr ""
#: plugin.py:498
msgid "disconnected from %s: %s"
msgstr ""

View File

@ -39,6 +39,8 @@ import supybot.ircmsgs as ircmsgs
import supybot.ircutils as ircutils
import supybot.callbacks as callbacks
from supybot.utils.structures import MultiSet, TimeoutQueue
from supybot.i18n import PluginInternationalization, internationalizeDocstring
_ = PluginInternationalization('Relay')
class Relay(callbacks.Plugin):
noIgnore = True
@ -92,6 +94,7 @@ class Relay(callbacks.Plugin):
irc.queueMsg(ircmsgs.who(channel))
irc.queueMsg(ircmsgs.names(channel))
@internationalizeDocstring
def join(self, irc, msg, args, channel):
"""[<channel>]
@ -110,6 +113,7 @@ class Relay(callbacks.Plugin):
irc.replySuccess()
join = wrap(join, ['channel', 'admin'])
@internationalizeDocstring
def part(self, irc, msg, args, channel):
"""<channel>
@ -124,6 +128,7 @@ class Relay(callbacks.Plugin):
irc.replySuccess()
part = wrap(part, ['channel', 'admin'])
@internationalizeDocstring
def nicks(self, irc, msg, args, channel):
"""[<channel>]
@ -215,43 +220,43 @@ class Relay(callbacks.Plugin):
normal.append(channel)
L = []
if ops:
L.append(format('is an op on %L', ops))
L.append(format(_('is an op on %L'), ops))
if halfops:
L.append(format('is a halfop on %L', halfups))
L.append(format(_('is a halfop on %L'), halfups))
if voices:
L.append(format('is voiced on %L', voices))
L.append(format(_('is voiced on %L'), voices))
if normal:
if L:
L.append(format('is also on %L', normal))
L.append(format(_('is also on %L'), normal))
else:
L.append(format('is on %L', normal))
L.append(format(_('is on %L'), normal))
else:
L = ['isn\'t on any non-secret channels']
L = [_('isn\'t on any non-secret channels')]
channels = format('%L', L)
if '317' in d:
idle = utils.timeElapsed(d['317'].args[2])
signon = time.strftime(conf.supybot.reply.format.time(),
time.localtime(float(d['317'].args[3])))
else:
idle = '<unknown>'
signon = '<unknown>'
idle = _('<unknown>')
signon = _('<unknown>')
if '312' in d:
server = d['312'].args[2]
else:
server = '<unknown>'
server = _('<unknown>')
if '301' in d:
away = format(' %s is away: %s.', nick, d['301'].args[2])
away = format(_(' %s is away: %s.'), nick, d['301'].args[2])
else:
away = ''
if '320' in d:
if d['320'].args[2]:
identify = ' identified'
identify = _(' identified')
else:
identify = ''
else:
identify = ''
s = format('%s (%s) has been%s on server %s since %s (idle for %s) '
'and %s.%s',
s = format(_('%s (%s) has been%s on server %s since %s (idle for %s) '
'and %s.%s'),
user, hostmask, identify, server, signon, idle,
channels, away)
replyIrc.reply(s)
@ -265,7 +270,7 @@ class Relay(callbacks.Plugin):
return
(replyIrc, replyMsg, d) = self._whois[(irc, loweredNick)]
del self._whois[(irc, loweredNick)]
s = format('There is no %s on %s.', nick, self._getIrcName(irc))
s = format(_('There is no %s on %s.'), nick, self._getIrcName(irc))
replyIrc.reply(s)
do401 = do402
@ -334,7 +339,7 @@ class Relay(callbacks.Plugin):
self.log.info('Punishing %s in %s on %s for relaying.',
who, channel, irc.network)
irc.sendMsg(ircmsgs.ban(channel, who))
kmsg = 'You seem to be relaying, punk.'
kmsg = _('You seem to be relaying, punk.')
irc.sendMsg(ircmsgs.kick(channel, msg.nick, kmsg))
else:
notPunishing(irc, 'not opped')
@ -387,7 +392,7 @@ class Relay(callbacks.Plugin):
hostmask = format(' (%s)', msg.prefix)
else:
hostmask = ''
s = format('%s%s has joined on %s', msg.nick, hostmask, network)
s = format(_('%s%s has joined on %s'), msg.nick, hostmask, network)
m = self._msgmaker(channel, s)
self._sendToOthers(irc, m)
@ -402,10 +407,10 @@ class Relay(callbacks.Plugin):
else:
hostmask = ''
if len(msg.args) > 1:
s = format('%s%s has left on %s (%s)',
s = format(_('%s%s has left on %s (%s)'),
msg.nick, hostmask, network, msg.args[1])
else:
s = format('%s%s has left on %s', msg.nick, hostmask, network)
s = format(_('%s%s has left on %s'), msg.nick, hostmask, network)
m = self._msgmaker(channel, s)
self._sendToOthers(irc, m)
@ -415,7 +420,7 @@ class Relay(callbacks.Plugin):
if channel not in self.registryValue('channels'):
return
network = self._getIrcName(irc)
s = format('mode change by %s on %s: %s',
s = format(_('mode change by %s on %s: %s'),
msg.nick, network, ' '.join(msg.args[1:]))
m = self._msgmaker(channel, s)
self._sendToOthers(irc, m)
@ -427,10 +432,10 @@ class Relay(callbacks.Plugin):
return
network = self._getIrcName(irc)
if len(msg.args) == 3:
s = format('%s was kicked by %s on %s (%s)',
s = format(_('%s was kicked by %s on %s (%s)'),
msg.args[1], msg.nick, network, msg.args[2])
else:
s = format('%s was kicked by %s on %s',
s = format(_('%s was kicked by %s on %s'),
msg.args[1], msg.nick, network)
m = self._msgmaker(channel, s)
self._sendToOthers(irc, m)
@ -439,7 +444,7 @@ class Relay(callbacks.Plugin):
irc = self._getRealIrc(irc)
newNick = msg.args[0]
network = self._getIrcName(irc)
s = format('nick change by %s to %s on %s', msg.nick,newNick,network)
s = format(_('nick change by %s to %s on %s'), msg.nick,newNick,network)
for channel in self.registryValue('channels'):
if channel in irc.state.channels:
if newNick in irc.state.channels[channel].users:
@ -469,7 +474,7 @@ class Relay(callbacks.Plugin):
'can\'t sync topics.',
channel, otherIrc.network)
else:
s = format('topic change by %s on %s: %s',
s = format(_('topic change by %s on %s: %s'),
msg.nick, network, newTopic)
m = self._msgmaker(channel, s)
self._sendToOthers(irc, m)
@ -478,9 +483,9 @@ class Relay(callbacks.Plugin):
irc = self._getRealIrc(irc)
network = self._getIrcName(irc)
if msg.args:
s = format('%s has quit %s (%s)', msg.nick, network, msg.args[0])
s = format(_('%s has quit %s (%s)'), msg.nick, network, msg.args[0])
else:
s = format('%s has quit %s.', msg.nick, network)
s = format(_('%s has quit %s.'), msg.nick, network)
for channel in self.registryValue('channels'):
if channel in self.ircstates[irc].channels:
if msg.nick in self.ircstates[irc].channels[channel].users:
@ -490,7 +495,7 @@ class Relay(callbacks.Plugin):
def doError(self, irc, msg):
irc = self._getRealIrc(irc)
network = self._getIrcName(irc)
s = format('disconnected from %s: %s', network, msg.args[0])
s = format(_('disconnected from %s: %s'), network, msg.args[0])
for channel in self.registryValue('channels'):
m = self._msgmaker(channel, s)
self._sendToOthers(irc, m)

View File

@ -29,6 +29,8 @@
import supybot.conf as conf
import supybot.registry as registry
from supybot.i18n import PluginInternationalization, internationalizeDocstring
_ = PluginInternationalization('Reply')
def configure(advanced):
# This will be called by supybot to configure this module. advanced is
@ -42,7 +44,7 @@ def configure(advanced):
Reply = conf.registerPlugin('Reply')
# This is where your configuration variables (if any) should go. For example:
# conf.registerGlobalValue(Reply, '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,65 @@
# 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-19 19:27+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:38
#, docstring
msgid ""
"This plugins contains a few commands that construct various types of\n"
" replies. Some bot owners would be wise to not load this plugin because it\n"
" can be easily abused.\n"
" "
msgstr ""
#: plugin.py:44
#, docstring
msgid ""
"<text>\n"
"\n"
" Replies with <text> in private. Use nested commands to your benefit\n"
" here.\n"
" "
msgstr ""
#: plugin.py:54
#, docstring
msgid ""
"<text>\n"
"\n"
" Replies with <text> as an action. use nested commands to your benefit\n"
" here.\n"
" "
msgstr ""
#: plugin.py:67
#, docstring
msgid ""
"<text>\n"
"\n"
" Replies with <text> in a notice. Use nested commands to your benefit\n"
" here. If you want a private notice, nest the private command.\n"
" "
msgstr ""
#: plugin.py:77
#, docstring
msgid ""
"<text>\n"
"\n"
" Replies with <text>. Equivalent to the alias, 'echo $nick: $1'.\n"
" "
msgstr ""

View File

@ -29,13 +29,17 @@
from supybot.commands import *
import supybot.callbacks as callbacks
from supybot.i18n import PluginInternationalization, internationalizeDocstring
_ = PluginInternationalization('Reply')
@internationalizeDocstring
class Reply(callbacks.Plugin):
"""This plugins contains a few commands that construct various types of
replies. Some bot owners would be wise to not load this plugin because it
can be easily abused.
"""
@internationalizeDocstring
def private(self, irc, msg, args, text):
"""<text>
@ -45,6 +49,7 @@ class Reply(callbacks.Plugin):
irc.reply(text, private=True)
private = wrap(private, ['text'])
@internationalizeDocstring
def action(self, irc, msg, args, text):
"""<text>
@ -57,6 +62,7 @@ class Reply(callbacks.Plugin):
raise callbacks.ArgumentError
action = wrap(action, ['text'])
@internationalizeDocstring
def notice(self, irc, msg, args, text):
"""<text>
@ -66,6 +72,7 @@ class Reply(callbacks.Plugin):
irc.reply(text, notice=True)
notice = wrap(notice, ['text'])
@internationalizeDocstring
def reply(self, irc, msg, args, text):
"""<text>

View File

@ -29,6 +29,8 @@
import supybot.conf as conf
import supybot.registry as registry
from supybot.i18n import PluginInternationalization, internationalizeDocstring
_ = PluginInternationalization('Scheduler')
def configure(advanced):
# This will be called by supybot to configure this module. advanced is
@ -42,7 +44,7 @@ def configure(advanced):
Scheduler = conf.registerPlugin('Scheduler')
# This is where your configuration variables (if any) should go. For example:
# conf.registerGlobalValue(Scheduler, '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,81 @@
# 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-19 19:28+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:47
#, docstring
msgid "Makes a function suitable for scheduling from command."
msgstr ""
#: plugin.py:57
#, docstring
msgid ""
"<seconds> <command>\n"
"\n"
" Schedules the command string <command> to run <seconds> seconds in the\n"
" future. For example, 'scheduler add [seconds 30m] \"echo [cpu]\"' will\n"
" schedule the command \"cpu\" to be sent to the channel the schedule add\n"
" command was given in (with no prefixed nick, a consequence of using\n"
" echo). Do pay attention to the quotes in that example.\n"
" "
msgstr ""
#: plugin.py:69
msgid "Event #%i added."
msgstr ""
#: plugin.py:74
#, docstring
msgid ""
"<id>\n"
"\n"
" Removes the event scheduled with id <id> from the schedule.\n"
" "
msgstr ""
#: plugin.py:88 plugin.py:90
msgid "Invalid event id."
msgstr ""
#: plugin.py:95
#, docstring
msgid ""
"<name> <seconds> <command>\n"
"\n"
" Schedules the command <command> to run every <seconds> seconds,\n"
" starting now (i.e., the command runs now, and every <seconds> seconds\n"
" thereafter). <name> is a name by which the command can be\n"
" unscheduled.\n"
" "
msgstr ""
#: plugin.py:104
msgid "There is already an event with that name, please choose another name."
msgstr ""
#: plugin.py:117
#, docstring
msgid ""
"takes no arguments\n"
"\n"
" Lists the currently scheduled events.\n"
" "
msgstr ""
#: plugin.py:128
msgid "There are currently no scheduled commands."
msgstr ""

View File

@ -34,6 +34,8 @@ import supybot.utils as utils
from supybot.commands import *
import supybot.schedule as schedule
import supybot.callbacks as callbacks
from supybot.i18n import PluginInternationalization, internationalizeDocstring
_ = PluginInternationalization('Scheduler')
class Scheduler(callbacks.Plugin):
def __init__(self, irc):
@ -50,6 +52,7 @@ class Scheduler(callbacks.Plugin):
self.Proxy(irc.irc, msg, tokens)
return f
@internationalizeDocstring
def add(self, irc, msg, args, seconds, command):
"""<seconds> <command>
@ -63,9 +66,10 @@ class Scheduler(callbacks.Plugin):
id = schedule.addEvent(f, time.time() + seconds)
f.eventId = id
self.events[str(id)] = command
irc.replySuccess(format('Event #%i added.', id))
irc.replySuccess(format(_('Event #%i added.'), id))
add = wrap(add, ['positiveInt', 'text'])
@internationalizeDocstring
def remove(self, irc, msg, args, id):
"""<id>
@ -81,11 +85,12 @@ class Scheduler(callbacks.Plugin):
schedule.removeEvent(id)
irc.replySuccess()
except KeyError:
irc.error('Invalid event id.')
irc.error(_('Invalid event id.'))
else:
irc.error('Invalid event id.')
irc.error(_('Invalid event id.'))
remove = wrap(remove, ['lowered'])
@internationalizeDocstring
def repeat(self, irc, msg, args, name, seconds, command):
"""<name> <seconds> <command>
@ -96,8 +101,8 @@ class Scheduler(callbacks.Plugin):
"""
name = name.lower()
if name in self.events:
irc.error('There is already an event with that name, please '
'choose another name.', Raise=True)
irc.error(_('There is already an event with that name, please '
'choose another name.'), Raise=True)
self.events[name] = command
f = self._makeCommandFunction(irc, msg, command, remove=False)
id = schedule.addPeriodicEvent(f, seconds, name)
@ -107,6 +112,7 @@ class Scheduler(callbacks.Plugin):
# irc.replySuccess()
repeat = wrap(repeat, ['nonInt', 'positiveInt', 'text'])
@internationalizeDocstring
def list(self, irc, msg, args):
"""takes no arguments
@ -119,7 +125,7 @@ class Scheduler(callbacks.Plugin):
L[i] = format('%s: %q', name, command)
irc.reply(format('%L', L))
else:
irc.reply('There are currently no scheduled commands.')
irc.reply(_('There are currently no scheduled commands.'))
list = wrap(list)