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.conf as conf
import supybot.registry as registry import supybot.registry as registry
import supybot.callbacks as callbacks import supybot.callbacks as callbacks
from supybot.i18n import PluginInternationalization, internationalizeDocstring
_ = PluginInternationalization('RSS')
def configure(advanced): def configure(advanced):
# This will be called by supybot to configure this module. advanced is # This will be called by supybot to configure this module. advanced is
@ -45,37 +47,37 @@ class FeedNames(registry.SpaceSeparatedListOfStrings):
RSS = conf.registerPlugin('RSS') RSS = conf.registerPlugin('RSS')
conf.registerChannelValue(RSS, 'bold', registry.Boolean( conf.registerChannelValue(RSS, 'bold', registry.Boolean(
True, """Determines whether the bot will bold the title of the feed when it True, _("""Determines whether the bot will bold the title of the feed when
announces new news.""")) it announces new news.""")))
conf.registerChannelValue(RSS, 'headlineSeparator', conf.registerChannelValue(RSS, 'headlineSeparator',
registry.StringSurroundedBySpaces(' || ', """Determines what string is used registry.StringSurroundedBySpaces(' || ', _("""Determines what string is
to separate headlines in new feeds.""")) used to separate headlines in new feeds.""")))
conf.registerChannelValue(RSS, 'announcementPrefix', conf.registerChannelValue(RSS, 'announcementPrefix',
registry.StringWithSpaceOnRight('New news from ', """Determines what prefix registry.StringWithSpaceOnRight('New news from ', _("""Determines what
is prepended (if any) to the new news item announcements made in the prefix is prepended (if any) to the new news item announcements made in the
channel.""")) channel.""")))
conf.registerChannelValue(RSS, 'announce', 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 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', 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 wait between retrieving RSS feeds; requests made within this period will
return cached results.""")) return cached results.""")))
conf.registerGlobalValue(RSS, 'feeds', conf.registerGlobalValue(RSS, 'feeds',
FeedNames([], """Determines what feeds should be accessible as FeedNames([], _("""Determines what feeds should be accessible as
commands.""")) commands.""")))
conf.registerChannelValue(RSS, 'showLinks', 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. along with the title of the feed when the rss command is called.
supybot.plugins.RSS.announce.showLinks affects whether links will be 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.registerGroup(RSS, 'announce')
conf.registerChannelValue(RSS.announce, 'showLinks', 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 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.ircutils as ircutils
import supybot.registry as registry import supybot.registry as registry
import supybot.callbacks as callbacks import supybot.callbacks as callbacks
from supybot.i18n import PluginInternationalization, internationalizeDocstring
_ = PluginInternationalization('RSS')
try: try:
feedparser = utils.python.universalImport('feedparser', 'local.feedparser') 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))) state.args.append(callbacks.canonicalName(args.pop(0)))
addConverter('feedName', getFeedName) addConverter('feedName', getFeedName)
@internationalizeDocstring
class RSS(callbacks.Plugin): class RSS(callbacks.Plugin):
"""This plugin is useful both for announcing updates to RSS feeds in a """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 channel, and for retrieving the headlines of RSS feeds via command. Use
@ -280,6 +283,7 @@ class RSS(callbacks.Plugin):
headlines.append((title, None)) headlines.append((title, None))
return headlines return headlines
@internationalizeDocstring
def makeFeedCommand(self, name, url): def makeFeedCommand(self, name, url):
docstring = format("""[<number of headlines>] docstring = format("""[<number of headlines>]
@ -302,6 +306,7 @@ class RSS(callbacks.Plugin):
self.feedNames[name] = (url, f) self.feedNames[name] = (url, f)
self._registerFeed(name, url) self._registerFeed(name, url)
@internationalizeDocstring
def add(self, irc, msg, args, name, url): def add(self, irc, msg, args, name, url):
"""<name> <url> """<name> <url>
@ -312,6 +317,7 @@ class RSS(callbacks.Plugin):
irc.replySuccess() irc.replySuccess()
add = wrap(add, ['feedName', 'url']) add = wrap(add, ['feedName', 'url'])
@internationalizeDocstring
def remove(self, irc, msg, args, name): def remove(self, irc, msg, args, name):
"""<name> """<name>
@ -319,7 +325,7 @@ class RSS(callbacks.Plugin):
this plugin. this plugin.
""" """
if name not in self.feedNames: 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 return
del self.feedNames[name] del self.feedNames[name]
conf.supybot.plugins.RSS.feeds().remove(name) conf.supybot.plugins.RSS.feeds().remove(name)
@ -327,6 +333,7 @@ class RSS(callbacks.Plugin):
irc.replySuccess() irc.replySuccess()
remove = wrap(remove, ['feedName']) remove = wrap(remove, ['feedName'])
@internationalizeDocstring
class announce(callbacks.Commands): class announce(callbacks.Commands):
def list(self, irc, msg, args, channel): def list(self, irc, msg, args, channel):
"""[<channel>] """[<channel>]
@ -336,9 +343,10 @@ class RSS(callbacks.Plugin):
""" """
announce = conf.supybot.plugins.RSS.announce announce = conf.supybot.plugins.RSS.announce
feeds = format('%L', list(announce.get(channel)())) 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',]) list = wrap(list, ['channel',])
@internationalizeDocstring
def add(self, irc, msg, args, channel, feeds): def add(self, irc, msg, args, channel, feeds):
"""[<channel>] <name|url> [<name|url> ...] """[<channel>] <name|url> [<name|url> ...]
@ -356,6 +364,7 @@ class RSS(callbacks.Plugin):
add = wrap(add, [('checkChannelCapability', 'op'), add = wrap(add, [('checkChannelCapability', 'op'),
many(first('url', 'feedName'))]) many(first('url', 'feedName'))])
@internationalizeDocstring
def remove(self, irc, msg, args, channel, feeds): def remove(self, irc, msg, args, channel, feeds):
"""[<channel>] <name|url> [<name|url> ...] """[<channel>] <name|url> [<name|url> ...]
@ -373,6 +382,7 @@ class RSS(callbacks.Plugin):
remove = wrap(remove, [('checkChannelCapability', 'op'), remove = wrap(remove, [('checkChannelCapability', 'op'),
many(first('url', 'feedName'))]) many(first('url', 'feedName'))])
@internationalizeDocstring
def rss(self, irc, msg, args, url, n): def rss(self, irc, msg, args, url, n):
"""<url> [<number of headlines>] """<url> [<number of headlines>]
@ -387,7 +397,7 @@ class RSS(callbacks.Plugin):
channel = None channel = None
headlines = self.getHeadlines(feed) headlines = self.getHeadlines(feed)
if not headlines: if not headlines:
irc.error('Couldn\'t get RSS feed.') irc.error(_('Couldn\'t get RSS feed.'))
return return
headlines = self.buildHeadlines(headlines, channel, 'showLinks') headlines = self.buildHeadlines(headlines, channel, 'showLinks')
if n: if n:
@ -398,6 +408,7 @@ class RSS(callbacks.Plugin):
irc.replies(headlines, joiner=sep) irc.replies(headlines, joiner=sep)
rss = wrap(rss, ['url', additional('int')]) rss = wrap(rss, ['url', additional('int')])
@internationalizeDocstring
def info(self, irc, msg, args, url): def info(self, irc, msg, args, url):
"""<url|feed> """<url|feed>
@ -412,7 +423,7 @@ class RSS(callbacks.Plugin):
conv = self._getConverter(feed) conv = self._getConverter(feed)
info = feed.get('feed') info = feed.get('feed')
if not info: if not info:
irc.error('I couldn\'t retrieve that RSS feed.') irc.error(_('I couldn\'t retrieve that RSS feed.'))
return return
# check the 'modified_parsed' key, if it's there, convert it here first # check the 'modified_parsed' key, if it's there, convert it here first
if 'modified' in info: if 'modified' in info:
@ -425,8 +436,8 @@ class RSS(callbacks.Plugin):
desc = conv(info.get('description', 'unavailable')) desc = conv(info.get('description', 'unavailable'))
link = conv(info.get('link', 'unavailable')) link = conv(info.get('link', 'unavailable'))
# The rest of the entries are all available in the channel key # The rest of the entries are all available in the channel key
response = format('Title: %s; URL: %u; ' response = format(_('Title: %s; URL: %u; '
'Description: %s; Last updated: %s.', 'Description: %s; Last updated: %s.'),
title, link, desc, when) title, link, desc, when)
irc.reply(utils.str.normalizeWhitespace(response)) irc.reply(utils.str.normalizeWhitespace(response))
info = wrap(info, [first('url', 'feedName')]) info = wrap(info, [first('url', 'feedName')])

View File

@ -30,14 +30,16 @@
import supybot.conf as conf import supybot.conf as conf
import supybot.ircutils as ircutils import supybot.ircutils as ircutils
import supybot.registry as registry import supybot.registry as registry
from supybot.i18n import PluginInternationalization, internationalizeDocstring
_ = PluginInternationalization('Relay')
def configure(advanced): def configure(advanced):
from supybot.questions import output, expect, anything, something, yn from supybot.questions import output, expect, anything, something, yn
conf.registerPlugin('Relay', True) conf.registerPlugin('Relay', True)
if yn('Would you like to relay between any channels?'): if yn(_('Would you like to relay between any channels?')):
channels = anything('What channels? Separated them by spaces.') channels = anything(_('What channels? Separated them by spaces.'))
conf.supybot.plugins.Relay.channels.set(channels) 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) conf.supybot.plugins.Relay.color.setValue(True)
output("""Right now there's no way to configure the actual connection to 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 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') Relay = conf.registerPlugin('Relay')
conf.registerChannelValue(Relay, 'color', conf.registerChannelValue(Relay, 'color',
registry.Boolean(False, """Determines whether the bot will color relayed registry.Boolean(False, _("""Determines whether the bot will color relayed
PRIVMSGs so as to make the messages easier to read.""")) PRIVMSGs so as to make the messages easier to read.""")))
conf.registerChannelValue(Relay, 'topicSync', conf.registerChannelValue(Relay, 'topicSync',
registry.Boolean(True, """Determines whether the bot will synchronize registry.Boolean(True, _("""Determines whether the bot will synchronize
topics between networks in the channels it relays.""")) topics between networks in the channels it relays.""")))
conf.registerChannelValue(Relay, 'hostmasks', 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 hostmask of the person joining or parting the channel when he or she joins
or parts.""")) or parts.""")))
conf.registerChannelValue(Relay, 'includeNetwork', 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, 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', conf.registerChannelValue(Relay, 'punishOtherRelayBots',
registry.Boolean(False, """Determines whether the bot will detect other registry.Boolean(False, _("""Determines whether the bot will detect other
bots relaying and respond by kickbanning them.""")) bots relaying and respond by kickbanning them.""")))
conf.registerGlobalValue(Relay, 'channels', conf.registerGlobalValue(Relay, 'channels',
conf.SpaceSeparatedSetOfChannels([], """Determines which channels the bot conf.SpaceSeparatedSetOfChannels([], _("""Determines which channels the bot
will relay in.""")) will relay in.""")))
conf.registerChannelValue(Relay.channels, 'joinOnAllNetworks', 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 will always join the channel(s) it relays for on all networks the bot is
connected to.""")) connected to.""")))
conf.registerChannelValue(Relay, 'ignores', conf.registerChannelValue(Relay, 'ignores',
Ignores([], """Determines what hostmasks will not be relayed on a Ignores([], _("""Determines what hostmasks will not be relayed on a
channel.""")) channel.""")))
conf.registerChannelValue(Relay, 'noticeNonPrivmsgs', 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, 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: # 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.ircutils as ircutils
import supybot.callbacks as callbacks import supybot.callbacks as callbacks
from supybot.utils.structures import MultiSet, TimeoutQueue from supybot.utils.structures import MultiSet, TimeoutQueue
from supybot.i18n import PluginInternationalization, internationalizeDocstring
_ = PluginInternationalization('Relay')
class Relay(callbacks.Plugin): class Relay(callbacks.Plugin):
noIgnore = True noIgnore = True
@ -92,6 +94,7 @@ class Relay(callbacks.Plugin):
irc.queueMsg(ircmsgs.who(channel)) irc.queueMsg(ircmsgs.who(channel))
irc.queueMsg(ircmsgs.names(channel)) irc.queueMsg(ircmsgs.names(channel))
@internationalizeDocstring
def join(self, irc, msg, args, channel): def join(self, irc, msg, args, channel):
"""[<channel>] """[<channel>]
@ -110,6 +113,7 @@ class Relay(callbacks.Plugin):
irc.replySuccess() irc.replySuccess()
join = wrap(join, ['channel', 'admin']) join = wrap(join, ['channel', 'admin'])
@internationalizeDocstring
def part(self, irc, msg, args, channel): def part(self, irc, msg, args, channel):
"""<channel> """<channel>
@ -124,6 +128,7 @@ class Relay(callbacks.Plugin):
irc.replySuccess() irc.replySuccess()
part = wrap(part, ['channel', 'admin']) part = wrap(part, ['channel', 'admin'])
@internationalizeDocstring
def nicks(self, irc, msg, args, channel): def nicks(self, irc, msg, args, channel):
"""[<channel>] """[<channel>]
@ -215,43 +220,43 @@ class Relay(callbacks.Plugin):
normal.append(channel) normal.append(channel)
L = [] L = []
if ops: if ops:
L.append(format('is an op on %L', ops)) L.append(format(_('is an op on %L'), ops))
if halfops: if halfops:
L.append(format('is a halfop on %L', halfups)) L.append(format(_('is a halfop on %L'), halfups))
if voices: if voices:
L.append(format('is voiced on %L', voices)) L.append(format(_('is voiced on %L'), voices))
if normal: if normal:
if L: if L:
L.append(format('is also on %L', normal)) L.append(format(_('is also on %L'), normal))
else: else:
L.append(format('is on %L', normal)) L.append(format(_('is on %L'), normal))
else: else:
L = ['isn\'t on any non-secret channels'] L = [_('isn\'t on any non-secret channels')]
channels = format('%L', L) channels = format('%L', L)
if '317' in d: if '317' in d:
idle = utils.timeElapsed(d['317'].args[2]) idle = utils.timeElapsed(d['317'].args[2])
signon = time.strftime(conf.supybot.reply.format.time(), signon = time.strftime(conf.supybot.reply.format.time(),
time.localtime(float(d['317'].args[3]))) time.localtime(float(d['317'].args[3])))
else: else:
idle = '<unknown>' idle = _('<unknown>')
signon = '<unknown>' signon = _('<unknown>')
if '312' in d: if '312' in d:
server = d['312'].args[2] server = d['312'].args[2]
else: else:
server = '<unknown>' server = _('<unknown>')
if '301' in d: 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: else:
away = '' away = ''
if '320' in d: if '320' in d:
if d['320'].args[2]: if d['320'].args[2]:
identify = ' identified' identify = _(' identified')
else: else:
identify = '' identify = ''
else: else:
identify = '' identify = ''
s = format('%s (%s) has been%s on server %s since %s (idle for %s) ' s = format(_('%s (%s) has been%s on server %s since %s (idle for %s) '
'and %s.%s', 'and %s.%s'),
user, hostmask, identify, server, signon, idle, user, hostmask, identify, server, signon, idle,
channels, away) channels, away)
replyIrc.reply(s) replyIrc.reply(s)
@ -265,7 +270,7 @@ class Relay(callbacks.Plugin):
return return
(replyIrc, replyMsg, d) = self._whois[(irc, loweredNick)] (replyIrc, replyMsg, d) = self._whois[(irc, loweredNick)]
del 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) replyIrc.reply(s)
do401 = do402 do401 = do402
@ -334,7 +339,7 @@ class Relay(callbacks.Plugin):
self.log.info('Punishing %s in %s on %s for relaying.', self.log.info('Punishing %s in %s on %s for relaying.',
who, channel, irc.network) who, channel, irc.network)
irc.sendMsg(ircmsgs.ban(channel, who)) 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)) irc.sendMsg(ircmsgs.kick(channel, msg.nick, kmsg))
else: else:
notPunishing(irc, 'not opped') notPunishing(irc, 'not opped')
@ -387,7 +392,7 @@ class Relay(callbacks.Plugin):
hostmask = format(' (%s)', msg.prefix) hostmask = format(' (%s)', msg.prefix)
else: else:
hostmask = '' 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) m = self._msgmaker(channel, s)
self._sendToOthers(irc, m) self._sendToOthers(irc, m)
@ -402,10 +407,10 @@ class Relay(callbacks.Plugin):
else: else:
hostmask = '' hostmask = ''
if len(msg.args) > 1: 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]) msg.nick, hostmask, network, msg.args[1])
else: 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) m = self._msgmaker(channel, s)
self._sendToOthers(irc, m) self._sendToOthers(irc, m)
@ -415,7 +420,7 @@ class Relay(callbacks.Plugin):
if channel not in self.registryValue('channels'): if channel not in self.registryValue('channels'):
return return
network = self._getIrcName(irc) 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:])) msg.nick, network, ' '.join(msg.args[1:]))
m = self._msgmaker(channel, s) m = self._msgmaker(channel, s)
self._sendToOthers(irc, m) self._sendToOthers(irc, m)
@ -427,10 +432,10 @@ class Relay(callbacks.Plugin):
return return
network = self._getIrcName(irc) network = self._getIrcName(irc)
if len(msg.args) == 3: 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]) msg.args[1], msg.nick, network, msg.args[2])
else: 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) msg.args[1], msg.nick, network)
m = self._msgmaker(channel, s) m = self._msgmaker(channel, s)
self._sendToOthers(irc, m) self._sendToOthers(irc, m)
@ -439,7 +444,7 @@ class Relay(callbacks.Plugin):
irc = self._getRealIrc(irc) irc = self._getRealIrc(irc)
newNick = msg.args[0] newNick = msg.args[0]
network = self._getIrcName(irc) 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'): for channel in self.registryValue('channels'):
if channel in irc.state.channels: if channel in irc.state.channels:
if newNick in irc.state.channels[channel].users: if newNick in irc.state.channels[channel].users:
@ -469,7 +474,7 @@ class Relay(callbacks.Plugin):
'can\'t sync topics.', 'can\'t sync topics.',
channel, otherIrc.network) channel, otherIrc.network)
else: else:
s = format('topic change by %s on %s: %s', s = format(_('topic change by %s on %s: %s'),
msg.nick, network, newTopic) msg.nick, network, newTopic)
m = self._msgmaker(channel, s) m = self._msgmaker(channel, s)
self._sendToOthers(irc, m) self._sendToOthers(irc, m)
@ -478,9 +483,9 @@ class Relay(callbacks.Plugin):
irc = self._getRealIrc(irc) irc = self._getRealIrc(irc)
network = self._getIrcName(irc) network = self._getIrcName(irc)
if msg.args: 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: 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'): for channel in self.registryValue('channels'):
if channel in self.ircstates[irc].channels: if channel in self.ircstates[irc].channels:
if msg.nick in self.ircstates[irc].channels[channel].users: if msg.nick in self.ircstates[irc].channels[channel].users:
@ -490,7 +495,7 @@ class Relay(callbacks.Plugin):
def doError(self, irc, msg): def doError(self, irc, msg):
irc = self._getRealIrc(irc) irc = self._getRealIrc(irc)
network = self._getIrcName(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'): for channel in self.registryValue('channels'):
m = self._msgmaker(channel, s) m = self._msgmaker(channel, s)
self._sendToOthers(irc, m) self._sendToOthers(irc, m)

View File

@ -29,6 +29,8 @@
import supybot.conf as conf import supybot.conf as conf
import supybot.registry as registry import supybot.registry as registry
from supybot.i18n import PluginInternationalization, internationalizeDocstring
_ = PluginInternationalization('Reply')
def configure(advanced): def configure(advanced):
# This will be called by supybot to configure this module. advanced is # This will be called by supybot to configure this module. advanced is
@ -42,7 +44,7 @@ def configure(advanced):
Reply = conf.registerPlugin('Reply') Reply = conf.registerPlugin('Reply')
# This is where your configuration variables (if any) should go. For example: # This is where your configuration variables (if any) should go. For example:
# conf.registerGlobalValue(Reply, 'someConfigVariableName', # 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: # 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 * from supybot.commands import *
import supybot.callbacks as callbacks import supybot.callbacks as callbacks
from supybot.i18n import PluginInternationalization, internationalizeDocstring
_ = PluginInternationalization('Reply')
@internationalizeDocstring
class Reply(callbacks.Plugin): class Reply(callbacks.Plugin):
"""This plugins contains a few commands that construct various types of """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 replies. Some bot owners would be wise to not load this plugin because it
can be easily abused. can be easily abused.
""" """
@internationalizeDocstring
def private(self, irc, msg, args, text): def private(self, irc, msg, args, text):
"""<text> """<text>
@ -45,6 +49,7 @@ class Reply(callbacks.Plugin):
irc.reply(text, private=True) irc.reply(text, private=True)
private = wrap(private, ['text']) private = wrap(private, ['text'])
@internationalizeDocstring
def action(self, irc, msg, args, text): def action(self, irc, msg, args, text):
"""<text> """<text>
@ -57,6 +62,7 @@ class Reply(callbacks.Plugin):
raise callbacks.ArgumentError raise callbacks.ArgumentError
action = wrap(action, ['text']) action = wrap(action, ['text'])
@internationalizeDocstring
def notice(self, irc, msg, args, text): def notice(self, irc, msg, args, text):
"""<text> """<text>
@ -66,6 +72,7 @@ class Reply(callbacks.Plugin):
irc.reply(text, notice=True) irc.reply(text, notice=True)
notice = wrap(notice, ['text']) notice = wrap(notice, ['text'])
@internationalizeDocstring
def reply(self, irc, msg, args, text): def reply(self, irc, msg, args, text):
"""<text> """<text>

View File

@ -29,6 +29,8 @@
import supybot.conf as conf import supybot.conf as conf
import supybot.registry as registry import supybot.registry as registry
from supybot.i18n import PluginInternationalization, internationalizeDocstring
_ = PluginInternationalization('Scheduler')
def configure(advanced): def configure(advanced):
# This will be called by supybot to configure this module. advanced is # This will be called by supybot to configure this module. advanced is
@ -42,7 +44,7 @@ def configure(advanced):
Scheduler = conf.registerPlugin('Scheduler') Scheduler = conf.registerPlugin('Scheduler')
# This is where your configuration variables (if any) should go. For example: # This is where your configuration variables (if any) should go. For example:
# conf.registerGlobalValue(Scheduler, 'someConfigVariableName', # 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: # 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 * from supybot.commands import *
import supybot.schedule as schedule import supybot.schedule as schedule
import supybot.callbacks as callbacks import supybot.callbacks as callbacks
from supybot.i18n import PluginInternationalization, internationalizeDocstring
_ = PluginInternationalization('Scheduler')
class Scheduler(callbacks.Plugin): class Scheduler(callbacks.Plugin):
def __init__(self, irc): def __init__(self, irc):
@ -50,6 +52,7 @@ class Scheduler(callbacks.Plugin):
self.Proxy(irc.irc, msg, tokens) self.Proxy(irc.irc, msg, tokens)
return f return f
@internationalizeDocstring
def add(self, irc, msg, args, seconds, command): def add(self, irc, msg, args, seconds, command):
"""<seconds> <command> """<seconds> <command>
@ -63,9 +66,10 @@ class Scheduler(callbacks.Plugin):
id = schedule.addEvent(f, time.time() + seconds) id = schedule.addEvent(f, time.time() + seconds)
f.eventId = id f.eventId = id
self.events[str(id)] = command self.events[str(id)] = command
irc.replySuccess(format('Event #%i added.', id)) irc.replySuccess(format(_('Event #%i added.'), id))
add = wrap(add, ['positiveInt', 'text']) add = wrap(add, ['positiveInt', 'text'])
@internationalizeDocstring
def remove(self, irc, msg, args, id): def remove(self, irc, msg, args, id):
"""<id> """<id>
@ -81,11 +85,12 @@ class Scheduler(callbacks.Plugin):
schedule.removeEvent(id) schedule.removeEvent(id)
irc.replySuccess() irc.replySuccess()
except KeyError: except KeyError:
irc.error('Invalid event id.') irc.error(_('Invalid event id.'))
else: else:
irc.error('Invalid event id.') irc.error(_('Invalid event id.'))
remove = wrap(remove, ['lowered']) remove = wrap(remove, ['lowered'])
@internationalizeDocstring
def repeat(self, irc, msg, args, name, seconds, command): def repeat(self, irc, msg, args, name, seconds, command):
"""<name> <seconds> <command> """<name> <seconds> <command>
@ -96,8 +101,8 @@ class Scheduler(callbacks.Plugin):
""" """
name = name.lower() name = name.lower()
if name in self.events: if name in self.events:
irc.error('There is already an event with that name, please ' irc.error(_('There is already an event with that name, please '
'choose another name.', Raise=True) 'choose another name.'), Raise=True)
self.events[name] = command self.events[name] = command
f = self._makeCommandFunction(irc, msg, command, remove=False) f = self._makeCommandFunction(irc, msg, command, remove=False)
id = schedule.addPeriodicEvent(f, seconds, name) id = schedule.addPeriodicEvent(f, seconds, name)
@ -107,6 +112,7 @@ class Scheduler(callbacks.Plugin):
# irc.replySuccess() # irc.replySuccess()
repeat = wrap(repeat, ['nonInt', 'positiveInt', 'text']) repeat = wrap(repeat, ['nonInt', 'positiveInt', 'text'])
@internationalizeDocstring
def list(self, irc, msg, args): def list(self, irc, msg, args):
"""takes no arguments """takes no arguments
@ -119,7 +125,7 @@ class Scheduler(callbacks.Plugin):
L[i] = format('%s: %q', name, command) L[i] = format('%s: %q', name, command)
irc.reply(format('%L', L)) irc.reply(format('%L', L))
else: else:
irc.reply('There are currently no scheduled commands.') irc.reply(_('There are currently no scheduled commands.'))
list = wrap(list) list = wrap(list)