From aaa0c480af0ddd9f36ef0ee37955e820ae33dff4 Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Tue, 19 Oct 2010 19:50:41 +0200 Subject: [PATCH 1/3] Internationalize Relay, Reply, RSS, Scheduler --- plugins/RSS/config.py | 36 +++--- plugins/RSS/messages.pot | 164 +++++++++++++++++++++++++ plugins/RSS/plugin.py | 23 +++- plugins/Relay/config.py | 44 +++---- plugins/Relay/messages.pot | 215 +++++++++++++++++++++++++++++++++ plugins/Relay/plugin.py | 57 +++++---- plugins/Reply/config.py | 4 +- plugins/Reply/messages.pot | 65 ++++++++++ plugins/Reply/plugin.py | 7 ++ plugins/Scheduler/config.py | 4 +- plugins/Scheduler/messages.pot | 81 +++++++++++++ plugins/Scheduler/plugin.py | 18 ++- 12 files changed, 640 insertions(+), 78 deletions(-) create mode 100644 plugins/RSS/messages.pot create mode 100644 plugins/Relay/messages.pot create mode 100644 plugins/Reply/messages.pot create mode 100644 plugins/Scheduler/messages.pot diff --git a/plugins/RSS/config.py b/plugins/RSS/config.py index f36e9dc4b..e4754375b 100644 --- a/plugins/RSS/config.py +++ b/plugins/RSS/config.py @@ -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."""))) diff --git a/plugins/RSS/messages.pot b/plugins/RSS/messages.pot new file mode 100644 index 000000000..4a2b76686 --- /dev/null +++ b/plugins/RSS/messages.pot @@ -0,0 +1,164 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR ORGANIZATION +# FIRST AUTHOR , 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 \n" +"Language-Team: LANGUAGE \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 "" +" \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 "" +"\n" +"\n" +" Removes the command for looking up RSS feeds at 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 "" +"[] [ ...]\n" +"\n" +" Adds the list of feeds to the current list of announced feeds in\n" +" . Valid feeds include the names of registered feeds as\n" +" well as URLs for RSS feeds. is only necessary if the\n" +" message isn't sent in the channel itself.\n" +" " +msgstr "" + +#: plugin.py:369 +#, docstring +msgid "" +"[] [ ...]\n" +"\n" +" Removes the list of feeds from the current list of announced feeds\n" +" in . Valid feeds include the names of registered feeds as\n" +" well as URLs for RSS feeds. is only necessary if the\n" +" message isn't sent in the channel itself.\n" +" " +msgstr "" + +#: plugin.py:387 +#, docstring +msgid "" +" []\n" +"\n" +" Gets the title components of the given RSS feed.\n" +" If is given, return only that many headlines.\n" +" " +msgstr "" + +#: plugin.py:400 +msgid "Couldn't get RSS feed." +msgstr "" + +#: plugin.py:413 +#, docstring +msgid "" +"\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 "" + diff --git a/plugins/RSS/plugin.py b/plugins/RSS/plugin.py index c5058d4ca..20e68bf6d 100644 --- a/plugins/RSS/plugin.py +++ b/plugins/RSS/plugin.py @@ -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("""[] @@ -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): """ @@ -312,6 +317,7 @@ class RSS(callbacks.Plugin): irc.replySuccess() add = wrap(add, ['feedName', 'url']) + @internationalizeDocstring def remove(self, irc, msg, args, 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): """[] @@ -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): """[] [ ...] @@ -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): """[] [ ...] @@ -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): """ [] @@ -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): """ @@ -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')]) diff --git a/plugins/Relay/config.py b/plugins/Relay/config.py index 757e42a9e..2bcbef095 100644 --- a/plugins/Relay/config.py +++ b/plugins/Relay/config.py @@ -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: diff --git a/plugins/Relay/messages.pot b/plugins/Relay/messages.pot new file mode 100644 index 000000000..5757bcdc1 --- /dev/null +++ b/plugins/Relay/messages.pot @@ -0,0 +1,215 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR ORGANIZATION +# FIRST AUTHOR , 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 \n" +"Language-Team: LANGUAGE \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 "" +"[]\n" +"\n" +" Starts relaying between the channel on all networks. If on a\n" +" network the bot isn't in , 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 is not given, starts relaying on the channel\n" +" the message was sent in.\n" +" " +msgstr "" + +#: plugin.py:118 +#, docstring +msgid "" +"\n" +"\n" +" Ceases relaying between the 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 "" +"[]\n" +"\n" +" Returns the nicks of the people in the channel on the various networks\n" +" the bot is connected to. 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 "" +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 "" + diff --git a/plugins/Relay/plugin.py b/plugins/Relay/plugin.py index ffd31f80f..6fe419589 100644 --- a/plugins/Relay/plugin.py +++ b/plugins/Relay/plugin.py @@ -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): """[] @@ -110,6 +113,7 @@ class Relay(callbacks.Plugin): irc.replySuccess() join = wrap(join, ['channel', 'admin']) + @internationalizeDocstring def part(self, irc, msg, args, channel): """ @@ -124,6 +128,7 @@ class Relay(callbacks.Plugin): irc.replySuccess() part = wrap(part, ['channel', 'admin']) + @internationalizeDocstring def nicks(self, irc, msg, args, 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 = '' - signon = '' + idle = _('') + signon = _('') if '312' in d: server = d['312'].args[2] else: - server = '' + server = _('') 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) diff --git a/plugins/Reply/config.py b/plugins/Reply/config.py index 7d861c528..f094cb36f 100644 --- a/plugins/Reply/config.py +++ b/plugins/Reply/config.py @@ -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: diff --git a/plugins/Reply/messages.pot b/plugins/Reply/messages.pot new file mode 100644 index 000000000..fac59c514 --- /dev/null +++ b/plugins/Reply/messages.pot @@ -0,0 +1,65 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR ORGANIZATION +# FIRST AUTHOR , 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 \n" +"Language-Team: LANGUAGE \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 "" +"\n" +"\n" +" Replies with in private. Use nested commands to your benefit\n" +" here.\n" +" " +msgstr "" + +#: plugin.py:54 +#, docstring +msgid "" +"\n" +"\n" +" Replies with as an action. use nested commands to your benefit\n" +" here.\n" +" " +msgstr "" + +#: plugin.py:67 +#, docstring +msgid "" +"\n" +"\n" +" Replies with 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 "" +"\n" +"\n" +" Replies with . Equivalent to the alias, 'echo $nick: $1'.\n" +" " +msgstr "" + diff --git a/plugins/Reply/plugin.py b/plugins/Reply/plugin.py index 9b0a6db4a..4bee7225f 100644 --- a/plugins/Reply/plugin.py +++ b/plugins/Reply/plugin.py @@ -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): """ @@ -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): """ @@ -57,6 +62,7 @@ class Reply(callbacks.Plugin): raise callbacks.ArgumentError action = wrap(action, ['text']) + @internationalizeDocstring def notice(self, irc, msg, args, 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): """ diff --git a/plugins/Scheduler/config.py b/plugins/Scheduler/config.py index bd901402b..9943c4557 100644 --- a/plugins/Scheduler/config.py +++ b/plugins/Scheduler/config.py @@ -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: diff --git a/plugins/Scheduler/messages.pot b/plugins/Scheduler/messages.pot new file mode 100644 index 000000000..226ac4fe6 --- /dev/null +++ b/plugins/Scheduler/messages.pot @@ -0,0 +1,81 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR ORGANIZATION +# FIRST AUTHOR , 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 \n" +"Language-Team: LANGUAGE \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 "" +" \n" +"\n" +" Schedules the command string to run 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 "" +"\n" +"\n" +" Removes the event scheduled with id from the schedule.\n" +" " +msgstr "" + +#: plugin.py:88 plugin.py:90 +msgid "Invalid event id." +msgstr "" + +#: plugin.py:95 +#, docstring +msgid "" +" \n" +"\n" +" Schedules the command to run every seconds,\n" +" starting now (i.e., the command runs now, and every seconds\n" +" thereafter). 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 "" + diff --git a/plugins/Scheduler/plugin.py b/plugins/Scheduler/plugin.py index 5ad55dc7b..ec1dd77af 100644 --- a/plugins/Scheduler/plugin.py +++ b/plugins/Scheduler/plugin.py @@ -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): """ @@ -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): """ @@ -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): """ @@ -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) From 371a40e0047519546d2f32dd9b8fb2fe609d9392 Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Wed, 20 Oct 2010 09:10:03 +0200 Subject: [PATCH 2/3] Internationalize Seen, Services, ShrinkUrl, Status, String, and Success --- plugins/Seen/config.py | 4 +- plugins/Seen/messages.pot | 118 +++++++++++++++++ plugins/Seen/plugin.py | 36 +++-- plugins/Services/config.py | 54 ++++---- plugins/Services/messages.pot | 235 +++++++++++++++++++++++++++++++++ plugins/Services/plugin.py | 37 ++++-- plugins/ShrinkUrl/config.py | 40 +++--- plugins/ShrinkUrl/messages.pot | 119 +++++++++++++++++ plugins/ShrinkUrl/plugin.py | 6 + plugins/Status/config.py | 14 +- plugins/Status/messages.pot | 155 ++++++++++++++++++++++ plugins/Status/plugin.py | 46 ++++--- plugins/String/config.py | 6 +- plugins/String/messages.pot | 168 +++++++++++++++++++++++ plugins/String/plugin.py | 31 +++-- plugins/Success/config.py | 8 +- plugins/Success/messages.pot | 33 +++++ plugins/Success/plugin.py | 3 + 18 files changed, 1002 insertions(+), 111 deletions(-) create mode 100644 plugins/Seen/messages.pot create mode 100644 plugins/Services/messages.pot create mode 100644 plugins/ShrinkUrl/messages.pot create mode 100644 plugins/Status/messages.pot create mode 100644 plugins/String/messages.pot create mode 100644 plugins/Success/messages.pot diff --git a/plugins/Seen/config.py b/plugins/Seen/config.py index fa24b305d..d7111bf93 100644 --- a/plugins/Seen/config.py +++ b/plugins/Seen/config.py @@ -29,6 +29,8 @@ import supybot.conf as conf import supybot.registry as registry +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('Seen') def configure(advanced): # This will be called by supybot to configure this module. advanced is @@ -42,7 +44,7 @@ def configure(advanced): Seen = conf.registerPlugin('Seen') # This is where your configuration variables (if any) should go. For example: # conf.registerGlobalValue(Seen, 'someConfigVariableName', -# registry.Boolean(False, """Help for someConfigVariableName.""")) +# registry.Boolean(False, _("""Help for someConfigVariableName."""))) # vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: diff --git a/plugins/Seen/messages.pot b/plugins/Seen/messages.pot new file mode 100644 index 000000000..e1186b0f1 --- /dev/null +++ b/plugins/Seen/messages.pot @@ -0,0 +1,118 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR ORGANIZATION +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2010-10-20 08:52+CEST\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \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:203 plugin.py:284 +msgid "%s was last seen in %s %s ago: %s" +msgstr "" + +#: plugin.py:210 +msgid "%s (%s ago)" +msgstr "" + +#: plugin.py:212 +msgid "%s could be %L" +msgstr "" + +#: plugin.py:212 +msgid "or" +msgstr "" + +#: plugin.py:214 +msgid "I haven't seen anyone matching %s." +msgstr "" + +#: plugin.py:216 plugin.py:288 +msgid "I have not seen %s." +msgstr "" + +#: plugin.py:220 +#, docstring +msgid "" +"[] \n" +"\n" +" Returns the last time was seen and what was last seen\n" +" saying. is only necessary if the message isn't sent on the\n" +" channel itself.\n" +" " +msgstr "" + +#: plugin.py:231 +#, docstring +msgid "" +"[] [--user ] []\n" +"\n" +" Returns the last time was seen and what was last seen\n" +" doing. This includes any form of activity, instead of just PRIVMSGs.\n" +" If isn't specified, returns the last activity seen in\n" +" . If --user is specified, looks up name in the user database\n" +" and returns the last time user was active in . is\n" +" only necessary if the message isn't sent on the channel itself.\n" +" " +msgstr "" + +#: plugin.py:261 +msgid "Someone was last seen in %s %s ago: %s" +msgstr "" + +#: plugin.py:265 +msgid "I have never seen anyone." +msgstr "" + +#: plugin.py:269 +#, docstring +msgid "" +"[]\n" +"\n" +" Returns the last thing said in . is only necessary\n" +" if the message isn't sent in the channel itself.\n" +" " +msgstr "" + +#: plugin.py:292 +#, docstring +msgid "" +"[] \n" +"\n" +" Returns the last time was seen and what was last seen\n" +" saying. This looks up in the user seen database, which means\n" +" that it could be any nick recognized as user that was seen.\n" +" is only necessary if the message isn't sent in the channel\n" +" itself.\n" +" " +msgstr "" + +#: plugin.py:305 +#, docstring +msgid "" +"[] \n" +"\n" +" Returns the messages since last left the channel.\n" +" " +msgstr "" + +#: plugin.py:312 +msgid "You must be in %s to use this command." +msgstr "" + +#: plugin.py:333 +msgid "I couldn't find in my history of %s messages where %r last left the %s" +msgstr "" + +#: plugin.py:342 +msgid "Either %s didn't leave, or no messages were sent while %s was gone." +msgstr "" + diff --git a/plugins/Seen/plugin.py b/plugins/Seen/plugin.py index 4051e0994..7d2fee947 100644 --- a/plugins/Seen/plugin.py +++ b/plugins/Seen/plugin.py @@ -42,6 +42,8 @@ import supybot.ircmsgs as ircmsgs import supybot.plugins as plugins import supybot.ircutils as ircutils import supybot.callbacks as callbacks +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('Seen') class IrcStringAndIntDict(utils.InsensitivePreservingDict): def key(self, x): @@ -198,21 +200,22 @@ class Seen(callbacks.Plugin): if len(results) == 1: (nick, info) = results[0] (when, said) = info - irc.reply(format('%s was last seen in %s %s ago: %s', + irc.reply(format(_('%s was last seen in %s %s ago: %s'), nick, channel, utils.timeElapsed(time.time()-when), said)) elif len(results) > 1: L = [] for (nick, info) in results: (when, said) = info - L.append(format('%s (%s ago)', nick, + L.append(format(_('%s (%s ago)'), nick, utils.timeElapsed(time.time()-when))) - irc.reply(format('%s could be %L', name, (L, 'or'))) + irc.reply(format(_('%s could be %L'), name, (L, _('or')))) else: - irc.reply(format('I haven\'t seen anyone matching %s.', name)) + irc.reply(format(_('I haven\'t seen anyone matching %s.'), name)) except KeyError: - irc.reply(format('I have not seen %s.', name)) + irc.reply(format(_('I have not seen %s.'), name)) + @internationalizeDocstring def seen(self, irc, msg, args, channel, name): """[] @@ -223,6 +226,7 @@ class Seen(callbacks.Plugin): self._seen(irc, channel, name) seen = wrap(seen, ['channel', 'nick']) + @internationalizeDocstring def any(self, irc, msg, args, channel, optlist, name): """[] [--user ] [] @@ -254,12 +258,13 @@ class Seen(callbacks.Plugin): db = self.db try: (when, said) = db.seen(channel, '') - irc.reply(format('Someone was last seen in %s %s ago: %s', + irc.reply(format(_('Someone was last seen in %s %s ago: %s'), channel, utils.timeElapsed(time.time()-when), said)) except KeyError: - irc.reply('I have never seen anyone.') + irc.reply(_('I have never seen anyone.')) + @internationalizeDocstring def last(self, irc, msg, args, channel): """[] @@ -276,12 +281,13 @@ class Seen(callbacks.Plugin): db = self.db try: (when, said) = db.seen(channel, user.id) - irc.reply(format('%s was last seen in %s %s ago: %s', + irc.reply(format(_('%s was last seen in %s %s ago: %s'), user.name, channel, utils.timeElapsed(time.time()-when), said)) except KeyError: - irc.reply(format('I have not seen %s.', user.name)) + irc.reply(format(_('I have not seen %s.'), user.name)) + @internationalizeDocstring def user(self, irc, msg, args, channel, user): """[] @@ -294,6 +300,7 @@ class Seen(callbacks.Plugin): self._user(irc, channel, user) user = wrap(user, ['channel', 'otherUser']) + @internationalizeDocstring def since(self, irc, msg, args, channel, nick): """[] @@ -302,7 +309,8 @@ class Seen(callbacks.Plugin): if nick is None: nick = msg.nick if nick not in irc.state.channels[channel].users: - irc.error(format('You must be in %s to use this command.', channel)) + irc.error(format(_('You must be in %s to use this command.'), + channel)) return end = None # By default, up until the most recent message. for (i, m) in utils.seq.renumerate(irc.state.history): @@ -322,8 +330,8 @@ class Seen(callbacks.Plugin): ircutils.strEqual(m.args[0], channel): break else: # I never use this; it only kicks in when the for loop exited normally. - irc.error(format('I couldn\'t find in my history of %s messages ' - 'where %r last left the %s', + irc.error(format(_('I couldn\'t find in my history of %s messages ' + 'where %r last left the %s'), len(irc.state.history), nick, channel)) return msgs = [m for m in irc.state.history[i:end] @@ -331,8 +339,8 @@ class Seen(callbacks.Plugin): if msgs: irc.reply(format('%L', map(ircmsgs.prettyPrint, msgs))) else: - irc.reply(format('Either %s didn\'t leave, ' - 'or no messages were sent while %s was gone.', nick, nick)) + irc.reply(format(_('Either %s didn\'t leave, ' + 'or no messages were sent while %s was gone.'), nick, nick)) since = wrap(since, ['channel', additional('nick')]) Class = Seen diff --git a/plugins/Services/config.py b/plugins/Services/config.py index aa09131ea..ffb2db783 100644 --- a/plugins/Services/config.py +++ b/plugins/Services/config.py @@ -31,11 +31,13 @@ import supybot.conf as conf import supybot.ircutils as ircutils import supybot.registry as registry +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('Services') def registerNick(nick, password=''): p = conf.supybot.plugins.Services.Nickserv.get('password') - h = 'Determines what password the bot will use with NickServ when ' \ - 'identifying as %s.' % nick + h = _('Determines what password the bot will use with NickServ when ' \ + 'identifying as %s.') % nick v = conf.registerGlobalValue(p, nick, registry.String(password, h, private=True)) if password: @@ -44,10 +46,10 @@ def registerNick(nick, password=''): def configure(advanced): from supybot.questions import expect, anything, something, yn, getpass conf.registerPlugin('Services', True) - nick = something('What is your registered nick?') - password = something('What is your password for that nick?') - chanserv = something('What is your ChanServ named?', default='ChanServ') - nickserv = something('What is your NickServ named?', default='NickServ') + nick = something(_('What is your registered nick?')) + password = something(_('What is your password for that nick?')) + chanserv = something(_('What is your ChanServ named?'), default='ChanServ') + nickserv = something(_('What is your NickServ named?'), default='NickServ') conf.supybot.plugins.Services.nicks.setValue([nick]) conf.supybot.plugins.Services.NickServ.setValue(nickserv) registerNick(nick, password) @@ -65,42 +67,42 @@ class ValidNickSet(conf.ValidNicks): Services = conf.registerPlugin('Services') conf.registerGlobalValue(Services, 'nicks', - ValidNickSet([], """Determines what nicks the bot will use with - services.""")) + ValidNickSet([], _("""Determines what nicks the bot will use with + services."""))) class Networks(registry.SpaceSeparatedSetOfStrings): List = ircutils.IrcSet conf.registerGlobalValue(Services, 'disabledNetworks', - Networks(['QuakeNet'], """Determines what networks this plugin will be - disabled on.""")) + Networks(_('QuakeNet').split(), _("""Determines what networks this plugin + will be disabled on."""))) conf.registerGlobalValue(Services, 'noJoinsUntilIdentified', - registry.Boolean(False, """Determines whether the bot will not join any + registry.Boolean(False, _("""Determines whether the bot will not join any channels until it is identified. This may be useful, for instances, if you have a vhost that isn't set until you're identified, or if you're - joining +r channels that won't allow you to join unless you identify.""")) + joining +r channels that won't allow you to join unless you identify."""))) conf.registerGlobalValue(Services, 'ghostDelay', - registry.PositiveInteger(60, """Determines how many seconds the bot will - wait between successive GHOST attempts.""")) + registry.PositiveInteger(60, _("""Determines how many seconds the bot will + wait between successive GHOST attempts."""))) conf.registerGlobalValue(Services, 'NickServ', - ValidNickOrEmptyString('', """Determines what nick the 'NickServ' service - has.""")) + ValidNickOrEmptyString('', _("""Determines what nick the 'NickServ' service + has."""))) conf.registerGroup(Services.NickServ, 'password') conf.registerGlobalValue(Services, 'ChanServ', - ValidNickOrEmptyString('', """Determines what nick the 'ChanServ' service - has.""")) + ValidNickOrEmptyString('', _("""Determines what nick the 'ChanServ' service + has."""))) conf.registerChannelValue(Services.ChanServ, 'password', - registry.String('', """Determines what password the bot will use with - ChanServ.""", private=True)) + registry.String('', _("""Determines what password the bot will use with + ChanServ."""), private=True)) conf.registerChannelValue(Services.ChanServ, 'op', - registry.Boolean(False, """Determines whether the bot will request to get - opped by the ChanServ when it joins the channel.""")) + registry.Boolean(False, _("""Determines whether the bot will request to get + opped by the ChanServ when it joins the channel."""))) conf.registerChannelValue(Services.ChanServ, 'halfop', - registry.Boolean(False, """Determines whether the bot will request to get - half-opped by the ChanServ when it joins the channel.""")) + registry.Boolean(False, _("""Determines whether the bot will request to get + half-opped by the ChanServ when it joins the channel."""))) conf.registerChannelValue(Services.ChanServ, 'voice', - registry.Boolean(False, """Determines whether the bot will request to get - voiced by the ChanServ when it joins the channel.""")) + registry.Boolean(False, _("""Determines whether the bot will request to get + voiced by the ChanServ when it joins the channel."""))) # vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: diff --git a/plugins/Services/messages.pot b/plugins/Services/messages.pot new file mode 100644 index 000000000..05b81d37a --- /dev/null +++ b/plugins/Services/messages.pot @@ -0,0 +1,235 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR ORGANIZATION +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2010-10-20 08:55+CEST\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \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 "Determines what password the bot will use with NickServ when identifying as %s." +msgstr "" + +#: config.py:49 +msgid "What is your registered nick?" +msgstr "" + +#: config.py:50 +msgid "What is your password for that nick?" +msgstr "" + +#: config.py:51 +msgid "What is your ChanServ named?" +msgstr "" + +#: config.py:52 +msgid "What is your NickServ named?" +msgstr "" + +#: config.py:70 +msgid "" +"Determines what nicks the bot will use with\n" +" services." +msgstr "" + +#: config.py:77 +msgid "" +"Determines what networks this plugin\n" +" will be disabled on." +msgstr "" + +#: config.py:77 +msgid "QuakeNet" +msgstr "" + +#: config.py:81 +msgid "" +"Determines whether the bot will not join any\n" +" channels until it is identified. This may be useful, for instances, if\n" +" you have a vhost that isn't set until you're identified, or if you're\n" +" joining +r channels that won't allow you to join unless you identify." +msgstr "" + +#: config.py:86 +msgid "" +"Determines how many seconds the bot will\n" +" wait between successive GHOST attempts." +msgstr "" + +#: config.py:89 +msgid "" +"Determines what nick the 'NickServ' service\n" +" has." +msgstr "" + +#: config.py:93 +msgid "" +"Determines what nick the 'ChanServ' service\n" +" has." +msgstr "" + +#: config.py:96 +msgid "" +"Determines what password the bot will use with\n" +" ChanServ." +msgstr "" + +#: config.py:99 +msgid "" +"Determines whether the bot will request to get\n" +" opped by the ChanServ when it joins the channel." +msgstr "" + +#: config.py:102 +msgid "" +"Determines whether the bot will request to get\n" +" half-opped by the ChanServ when it joins the channel." +msgstr "" + +#: config.py:105 +msgid "" +"Determines whether the bot will request to get\n" +" voiced by the ChanServ when it joins the channel." +msgstr "" + +#: plugin.py:48 +#, docstring +msgid "" +"This plugin handles dealing with Services on networks that provide them.\n" +" Basically, you should use the \"password\" command to tell the bot a nick to\n" +" identify with and what password to use to identify with that nick. You can\n" +" use the password command multiple times if your bot has multiple nicks\n" +" registered. Also, be sure to configure the NickServ and ChanServ\n" +" configuration variables to match the NickServ and ChanServ nicks on your\n" +" network. Other commands such as identify, op, etc. should not be\n" +" necessary if the bot is properly configured." +msgstr "" + +#: plugin.py:396 +msgid "You must set supybot.plugins.Services.ChanServ before I'm able to send the %s command." +msgstr "" + +#: plugin.py:402 +#, docstring +msgid "" +"[]\n" +"\n" +" Attempts to get opped by ChanServ in . is only\n" +" necessary if the message isn't sent in the channel itself.\n" +" " +msgstr "" + +#: plugin.py:408 +msgid "I'm already opped in %s." +msgstr "" + +#: plugin.py:415 +#, docstring +msgid "" +"[]\n" +"\n" +" Attempts to get voiced by ChanServ in . is only\n" +" necessary if the message isn't sent in the channel itself.\n" +" " +msgstr "" + +#: plugin.py:421 +msgid "I'm already voiced in %s." +msgstr "" + +#: plugin.py:438 +#, docstring +msgid "" +"[]\n" +"\n" +" Attempts to get unbanned by ChanServ in . is only\n" +" necessary if the message isn't sent in the channel itself, but chances\n" +" are, if you need this command, you're not sending it in the channel\n" +" itself.\n" +" " +msgstr "" + +#: plugin.py:459 +#, docstring +msgid "" +"[]\n" +"\n" +" Attempts to get invited by ChanServ to . is only\n" +" necessary if the message isn't sent in the channel itself, but chances\n" +" are, if you need this command, you're not sending it in the channel\n" +" itself.\n" +" " +msgstr "" + +#: plugin.py:480 +#, docstring +msgid "" +"takes no arguments\n" +"\n" +" Identifies with NickServ using the current nick.\n" +" " +msgstr "" + +#: plugin.py:489 +msgid "I don't have a configured password for my current nick." +msgstr "" + +#: plugin.py:492 +msgid "You must set supybot.plugins.Services.NickServ before I'm able to do identify." +msgstr "" + +#: plugin.py:498 +#, docstring +msgid "" +"[]\n" +"\n" +" Ghosts the bot's given nick and takes it. If no nick is given,\n" +" ghosts the bot's configured nick and takes it.\n" +" " +msgstr "" + +#: plugin.py:507 +msgid "I cowardly refuse to ghost myself." +msgstr "" + +#: plugin.py:512 +msgid "You must set supybot.plugins.Services.NickServ before I'm able to ghost a nick." +msgstr "" + +#: plugin.py:518 +#, docstring +msgid "" +" []\n" +"\n" +" Sets the NickServ password for to . If is\n" +" not given, removes from the configured nicks.\n" +" " +msgstr "" + +#: plugin.py:528 +msgid "That nick was not configured with a password." +msgstr "" + +#: plugin.py:539 +#, docstring +msgid "" +"takes no arguments\n" +"\n" +" Returns the nicks that this plugin is configured to identify and ghost\n" +" with.\n" +" " +msgstr "" + +#: plugin.py:549 +msgid "I'm not currently configured for any nicks." +msgstr "" + diff --git a/plugins/Services/plugin.py b/plugins/Services/plugin.py index e5882573b..d57ab0966 100644 --- a/plugins/Services/plugin.py +++ b/plugins/Services/plugin.py @@ -40,7 +40,10 @@ import supybot.ircmsgs as ircmsgs import supybot.ircutils as ircutils import supybot.schedule as schedule import supybot.callbacks as callbacks +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('Services') +@internationalizeDocstring class Services(callbacks.Plugin): """This plugin handles dealing with Services on networks that provide them. Basically, you should use the "password" command to tell the bot a nick to @@ -390,10 +393,11 @@ class Services(callbacks.Plugin): 'supybot.plugins.Services.ChanServ before ' 'I can send commands to ChanServ.', command) else: - irc.error('You must set supybot.plugins.Services.ChanServ ' - 'before I\'m able to send the %s command.' % command, + irc.error(_('You must set supybot.plugins.Services.ChanServ ' + 'before I\'m able to send the %s command.') % command, Raise=True) + @internationalizeDocstring def op(self, irc, msg, args, channel): """[] @@ -401,11 +405,12 @@ class Services(callbacks.Plugin): necessary if the message isn't sent in the channel itself. """ if irc.nick in irc.state.channels[channel].ops: - irc.error(format('I\'m already opped in %s.', channel)) + irc.error(format(_('I\'m already opped in %s.'), channel)) else: self._chanservCommand(irc, channel, 'op') op = wrap(op, [('checkChannelCapability', 'op'), 'inChannel']) + @internationalizeDocstring def voice(self, irc, msg, args, channel): """[] @@ -413,7 +418,7 @@ class Services(callbacks.Plugin): necessary if the message isn't sent in the channel itself. """ if irc.nick in irc.state.channels[channel].voices: - irc.error(format('I\'m already voiced in %s.', channel)) + irc.error(format(_('I\'m already voiced in %s.'), channel)) else: self._chanservCommand(irc, channel, 'voice') voice = wrap(voice, [('checkChannelCapability', 'op'), 'inChannel']) @@ -428,6 +433,7 @@ class Services(callbacks.Plugin): self._chanservCommand(irc, channel, 'unban', log=True) # Success log in doChanservNotice. + @internationalizeDocstring def unban(self, irc, msg, args, channel): """[] @@ -448,6 +454,7 @@ class Services(callbacks.Plugin): self.log.info('%s is +i, attempting ChanServ invite %s.', channel, on) self._chanservCommand(irc, channel, 'invite', log=True) + @internationalizeDocstring def invite(self, irc, msg, args, channel): """[] @@ -468,6 +475,7 @@ class Services(callbacks.Plugin): self.log.info('Joining %s, invited by ChanServ %s.', channel, on) irc.queueMsg(networkGroup.channels.join(channel)) + @internationalizeDocstring def identify(self, irc, msg, args): """takes no arguments @@ -478,13 +486,14 @@ class Services(callbacks.Plugin): self._doIdentify(irc, irc.nick) irc.replySuccess() else: - irc.error('I don\'t have a configured password for ' - 'my current nick.') + irc.error(_('I don\'t have a configured password for ' + 'my current nick.')) else: - irc.error('You must set supybot.plugins.Services.NickServ before ' - 'I\'m able to do identify.') + irc.error(_('You must set supybot.plugins.Services.NickServ before ' + 'I\'m able to do identify.')) identify = wrap(identify, [('checkCapability', 'admin')]) + @internationalizeDocstring def ghost(self, irc, msg, args, nick): """[] @@ -495,15 +504,16 @@ class Services(callbacks.Plugin): if not nick: nick = self._getNick() if ircutils.strEqual(nick, irc.nick): - irc.error('I cowardly refuse to ghost myself.') + irc.error(_('I cowardly refuse to ghost myself.')) else: self._doGhost(irc, nick=nick) irc.replySuccess() else: - irc.error('You must set supybot.plugins.Services.NickServ before ' - 'I\'m able to ghost a nick.') + irc.error(_('You must set supybot.plugins.Services.NickServ before ' + 'I\'m able to ghost a nick.')) ghost = wrap(ghost, [('checkCapability', 'admin'), additional('nick')]) + @internationalizeDocstring def password(self, irc, msg, args, nick, password): """ [] @@ -515,7 +525,7 @@ class Services(callbacks.Plugin): self.registryValue('nicks').remove(nick) irc.replySuccess() except KeyError: - irc.error('That nick was not configured with a password.') + irc.error(_('That nick was not configured with a password.')) return else: self.registryValue('nicks').add(nick) @@ -524,6 +534,7 @@ class Services(callbacks.Plugin): password = wrap(password, [('checkCapability', 'admin'), 'private', 'nick', 'text']) + @internationalizeDocstring def nicks(self, irc, msg, args): """takes no arguments @@ -535,7 +546,7 @@ class Services(callbacks.Plugin): utils.sortBy(ircutils.toLower, L) irc.reply(format('%L', L)) else: - irc.reply('I\'m not currently configured for any nicks.') + irc.reply(_('I\'m not currently configured for any nicks.')) nicks = wrap(nicks, [('checkCapability', 'admin')]) diff --git a/plugins/ShrinkUrl/config.py b/plugins/ShrinkUrl/config.py index fa5429510..5a2b6355e 100644 --- a/plugins/ShrinkUrl/config.py +++ b/plugins/ShrinkUrl/config.py @@ -30,13 +30,15 @@ import supybot.conf as conf import supybot.registry as registry +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('ShrinkUrl') def configure(advanced): from supybot.questions import output, expect, anything, something, yn conf.registerPlugin('ShrinkUrl', True) - if yn("""This plugin offers a snarfer that will go retrieve a shorter + if yn(_("""This plugin offers a snarfer that will go retrieve a shorter version of long URLs that are sent to the channel. Would you - like this snarfer to be enabled?""", default=False): + like this snarfer to be enabled?"""), default=False): conf.supybot.plugins.ShrinkUrl.shrinkSnarfer.setValue(True) class ShrinkService(registry.OnlySomeStrings): @@ -66,34 +68,34 @@ class ShrinkCycle(registry.SpaceSeparatedListOfStrings): ShrinkUrl = conf.registerPlugin('ShrinkUrl') conf.registerChannelValue(ShrinkUrl, 'shrinkSnarfer', - registry.Boolean(False, """Determines whether the + registry.Boolean(False, _("""Determines whether the shrink snarfer is enabled. This snarfer will watch for URLs in the channel, and if they're sufficiently long (as determined by supybot.plugins.ShrinkUrl.minimumLength) it will post a smaller URL from either ln-s.net or tinyurl.com, as denoted in - supybot.plugins.ShrinkUrl.default.""")) + supybot.plugins.ShrinkUrl.default."""))) conf.registerChannelValue(ShrinkUrl.shrinkSnarfer, 'showDomain', - registry.Boolean(True, """Determines whether the snarfer will show the - domain of the URL being snarfed along with the shrunken URL.""")) + registry.Boolean(True, _("""Determines whether the snarfer will show the + domain of the URL being snarfed along with the shrunken URL."""))) conf.registerChannelValue(ShrinkUrl, 'minimumLength', - registry.PositiveInteger(48, """The minimum length a URL must be before - the bot will shrink it.""")) + registry.PositiveInteger(48, _("""The minimum length a URL must be before + the bot will shrink it."""))) conf.registerChannelValue(ShrinkUrl, 'nonSnarfingRegexp', - registry.Regexp(None, """Determines what URLs are to be snarfed; URLs + registry.Regexp(None, _("""Determines what URLs are to be snarfed; URLs matching the regexp given will not be snarfed. Give the empty string if - you have no URLs that you'd like to exclude from being snarfed.""")) + you have no URLs that you'd like to exclude from being snarfed."""))) conf.registerChannelValue(ShrinkUrl, 'outFilter', - registry.Boolean(False, """Determines whether the bot will shrink the URLs - of outgoing messages if those URLs are longer than - supybot.plugins.ShrinkUrl.minimumLength.""")) + registry.Boolean(False, _("""Determines whether the bot will shrink the + URLs of outgoing messages if those URLs are longer than + supybot.plugins.ShrinkUrl.minimumLength."""))) conf.registerChannelValue(ShrinkUrl, 'default', - ShrinkService('ln', """Determines what website the bot will use when - shrinking a URL.""")) + ShrinkService('ln', _("""Determines what website the bot will use when + shrinking a URL."""))) conf.registerGlobalValue(ShrinkUrl, 'bold', - registry.Boolean(True, """Determines whether this plugin will bold certain - portions of its replies.""")) + registry.Boolean(True, _("""Determines whether this plugin will bold + certain portions of its replies."""))) conf.registerChannelValue(ShrinkUrl, 'serviceRotation', - ShrinkCycle([], """If set to a non-empty value, specifies the list of - services to rotate through for the shrinkSnarfer and outFilter.""")) + ShrinkCycle([], _("""If set to a non-empty value, specifies the list of + services to rotate through for the shrinkSnarfer and outFilter."""))) # vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: diff --git a/plugins/ShrinkUrl/messages.pot b/plugins/ShrinkUrl/messages.pot new file mode 100644 index 000000000..433b2cd45 --- /dev/null +++ b/plugins/ShrinkUrl/messages.pot @@ -0,0 +1,119 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR ORGANIZATION +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2010-10-20 08:55+CEST\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \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 "" +"This plugin offers a snarfer that will go retrieve a shorter\n" +" version of long URLs that are sent to the channel. Would you\n" +" like this snarfer to be enabled?" +msgstr "" + +#: config.py:45 config.py:49 +#, docstring +msgid "Valid values include 'ln', 'tiny', 'xrl', and 'x0'." +msgstr "" + +#: config.py:71 +msgid "" +"Determines whether the\n" +" shrink snarfer is enabled. This snarfer will watch for URLs in the\n" +" channel, and if they're sufficiently long (as determined by\n" +" supybot.plugins.ShrinkUrl.minimumLength) it will post a\n" +" smaller URL from either ln-s.net or tinyurl.com, as denoted in\n" +" supybot.plugins.ShrinkUrl.default." +msgstr "" + +#: config.py:78 +msgid "" +"Determines whether the snarfer will show the\n" +" domain of the URL being snarfed along with the shrunken URL." +msgstr "" + +#: config.py:81 +msgid "" +"The minimum length a URL must be before\n" +" the bot will shrink it." +msgstr "" + +#: config.py:84 +msgid "" +"Determines what URLs are to be snarfed; URLs\n" +" matching the regexp given will not be snarfed. Give the empty string if\n" +" you have no URLs that you'd like to exclude from being snarfed." +msgstr "" + +#: config.py:88 +msgid "" +"Determines whether the bot will shrink the\n" +" URLs of outgoing messages if those URLs are longer than\n" +" supybot.plugins.ShrinkUrl.minimumLength." +msgstr "" + +#: config.py:92 +msgid "" +"Determines what website the bot will use when\n" +" shrinking a URL." +msgstr "" + +#: config.py:95 +msgid "" +"Determines whether this plugin will bold\n" +" certain portions of its replies." +msgstr "" + +#: config.py:98 +msgid "" +"If set to a non-empty value, specifies the list of\n" +" services to rotate through for the shrinkSnarfer and outFilter." +msgstr "" + +#: plugin.py:169 +#, docstring +msgid "" +"\n" +"\n" +" Returns an ln-s.net version of .\n" +" " +msgstr "" + +#: plugin.py:194 +#, docstring +msgid "" +"\n" +"\n" +" Returns a TinyURL.com version of \n" +" " +msgstr "" + +#: plugin.py:222 +#, docstring +msgid "" +"\n" +"\n" +" Returns an xrl.us version of .\n" +" " +msgstr "" + +#: plugin.py:248 +#, docstring +msgid "" +"\n" +"\n" +" Returns an x0.no version of .\n" +" " +msgstr "" + diff --git a/plugins/ShrinkUrl/plugin.py b/plugins/ShrinkUrl/plugin.py index d162c27dc..471400186 100644 --- a/plugins/ShrinkUrl/plugin.py +++ b/plugins/ShrinkUrl/plugin.py @@ -37,6 +37,8 @@ import supybot.ircmsgs as ircmsgs import supybot.plugins as plugins import supybot.ircutils as ircutils import supybot.callbacks as callbacks +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('ShrinkUrl') class CdbShrunkenUrlDB(object): def __init__(self, filename): @@ -162,6 +164,7 @@ class ShrinkUrl(callbacks.PluginRegexp): else: raise ShrinkError, text + @internationalizeDocstring def ln(self, irc, msg, args, url): """ @@ -186,6 +189,7 @@ class ShrinkUrl(callbacks.PluginRegexp): self.db.set('tiny', url, text) return text + @internationalizeDocstring def tiny(self, irc, msg, args, url): """ @@ -213,6 +217,7 @@ class ShrinkUrl(callbacks.PluginRegexp): self.db.set('xrl', quotedurl, text) return text + @internationalizeDocstring def xrl(self, irc, msg, args, url): """ @@ -238,6 +243,7 @@ class ShrinkUrl(callbacks.PluginRegexp): self.db.set('x0', url, text) return text + @internationalizeDocstring def x0(self, irc, msg, args, url): """ diff --git a/plugins/Status/config.py b/plugins/Status/config.py index 74d059b45..56cda1717 100644 --- a/plugins/Status/config.py +++ b/plugins/Status/config.py @@ -29,6 +29,8 @@ import supybot.conf as conf import supybot.registry as registry +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('Status') def configure(advanced): # This will be called by supybot to configure this module. advanced is @@ -41,13 +43,13 @@ def configure(advanced): Status = conf.registerPlugin('Status') conf.registerGroup(Status, 'cpu') conf.registerChannelValue(Status.cpu, 'children', - registry.Boolean(True, """Determines whether the cpu command will list the - time taken by children as well as the bot's process.""")) + registry.Boolean(True, _("""Determines whether the cpu command will list + the time taken by children as well as the bot's process."""))) conf.registerChannelValue(Status.cpu, 'threads', - registry.Boolean(False, """Determines whether the cpu command will provide - the number of threads spawned and active.""")) + registry.Boolean(False, _("""Determines whether the cpu command will + provide the number of threads spawned and active."""))) conf.registerChannelValue(Status.cpu, 'memory', - registry.Boolean(True, """Determines whether the cpu command will report - the amount of memory being used by the bot.""")) + registry.Boolean(True, _("""Determines whether the cpu command will report + the amount of memory being used by the bot."""))) # vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: diff --git a/plugins/Status/messages.pot b/plugins/Status/messages.pot new file mode 100644 index 000000000..c186802a1 --- /dev/null +++ b/plugins/Status/messages.pot @@ -0,0 +1,155 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR ORGANIZATION +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2010-10-20 09:05+CEST\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \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 cpu command will list\n" +" the time taken by children as well as the bot's process." +msgstr "" + +#: config.py:49 +msgid "" +"Determines whether the cpu command will\n" +" provide the number of threads spawned and active." +msgstr "" + +#: config.py:52 +msgid "" +"Determines whether the cpu command will report\n" +" the amount of memory being used by the bot." +msgstr "" + +#: plugin.py:71 +#, docstring +msgid "" +"takes no arguments\n" +"\n" +" Returns the status of the bot.\n" +" " +msgstr "" + +#: plugin.py:80 +msgid "%s as %L" +msgstr "" + +#: plugin.py:81 +msgid "I am connected to %L." +msgstr "" + +#: plugin.py:83 +msgid "I am currently in code profiling mode." +msgstr "" + +#: plugin.py:89 +#, docstring +msgid "" +"takes no arguments\n" +"\n" +" Returns the current threads that are active.\n" +" " +msgstr "" + +#: plugin.py:95 +msgid "I have spawned %n; %n %b still currently active: %L." +msgstr "" + +#: plugin.py:103 +#, docstring +msgid "" +"takes no arguments\n" +"\n" +" Returns some interesting network-related statistics.\n" +" " +msgstr "" + +#: plugin.py:111 +msgid "an indeterminate amount of time" +msgstr "" + +#: plugin.py:112 +msgid "I have received %s messages for a total of %s bytes. I have sent %s messages for a total of %s bytes. I have been connected to %s for %s." +msgstr "" + +#: plugin.py:121 +#, docstring +msgid "" +"takes no arguments\n" +"\n" +" Returns some interesting CPU-related statistics on the bot.\n" +" " +msgstr "" + +#: plugin.py:131 +msgid "My children have taken %.2f seconds of user time and %.2f seconds of system time for a total of %.2f seconds of CPU time. " +msgstr "" + +#: plugin.py:138 +msgid "I have taken %.2f seconds of user time and %.2f seconds of system time, for a total of %.2f seconds of CPU time. %s" +msgstr "" + +#: plugin.py:160 +msgid "Unable to run ps command." +msgstr "" + +#: plugin.py:166 +msgid " I'm taking up %s kB of memory." +msgstr "" + +#: plugin.py:174 +#, docstring +msgid "" +"takes no arguments\n" +"\n" +" Returns some interesting command-related statistics.\n" +" " +msgstr "" + +#: plugin.py:184 +msgid "I offer a total of %n in %n. I have processed %n." +msgstr "" + +#: plugin.py:193 +#, docstring +msgid "" +"takes no arguments\n" +"\n" +" Returns a list of the commands offered by the bot.\n" +" " +msgstr "" + +#: plugin.py:207 +#, docstring +msgid "" +"takes no arguments\n" +"\n" +" Returns the amount of time the bot has been running.\n" +" " +msgstr "" + +#: plugin.py:211 +msgid "I have been running for %s." +msgstr "" + +#: plugin.py:218 +#, docstring +msgid "" +"takes no arguments\n" +"\n" +" Returns the server the bot is on.\n" +" " +msgstr "" + diff --git a/plugins/Status/plugin.py b/plugins/Status/plugin.py index fccd58336..58bda4290 100644 --- a/plugins/Status/plugin.py +++ b/plugins/Status/plugin.py @@ -39,6 +39,8 @@ import supybot.utils as utils import supybot.world as world from supybot.commands import * import supybot.callbacks as callbacks +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('Status') class Status(callbacks.Plugin): def __init__(self, irc): @@ -64,6 +66,7 @@ class Status(callbacks.Plugin): def do001(self, irc, msg): self.connected[irc] = time.time() + @internationalizeDocstring def status(self, irc, msg, args): """takes no arguments @@ -74,13 +77,14 @@ class Status(callbacks.Plugin): networks.setdefault(Irc.network, []).append(Irc.nick) networks = networks.items() networks.sort() - networks = [format('%s as %L', net, nicks) for (net,nicks) in networks] - L = [format('I am connected to %L.', networks)] + networks = [format(_('%s as %L'), net, nicks) for (net,nicks) in networks] + L = [format(_('I am connected to %L.'), networks)] if world.profiling: - L.append('I am currently in code profiling mode.') + L.append(_('I am currently in code profiling mode.')) irc.reply(' '.join(L)) status = wrap(status) + @internationalizeDocstring def threads(self, irc, msg, args): """takes no arguments @@ -88,12 +92,13 @@ class Status(callbacks.Plugin): """ threads = [t.getName() for t in threading.enumerate()] threads.sort() - s = format('I have spawned %n; %n %b still currently active: %L.', + s = format(_('I have spawned %n; %n %b still currently active: %L.'), (world.threadsSpawned, 'thread'), (len(threads), 'thread'), len(threads), threads) irc.reply(s) threads = wrap(threads) + @internationalizeDocstring def net(self, irc, msg, args): """takes no arguments @@ -103,14 +108,15 @@ class Status(callbacks.Plugin): elapsed = time.time() - self.connected[irc.getRealIrc()] timeElapsed = utils.timeElapsed(elapsed) except KeyError: - timeElapsed = 'an indeterminate amount of time' - irc.reply('I have received %s messages for a total of %s bytes. ' + timeElapsed = _('an indeterminate amount of time') + irc.reply(_('I have received %s messages for a total of %s bytes. ' 'I have sent %s messages for a total of %s bytes. ' - 'I have been connected to %s for %s.' % + 'I have been connected to %s for %s.') % (self.recvdMsgs, self.recvdBytes, self.sentMsgs, self.sentBytes, irc.server, timeElapsed)) net = wrap(net) + @internationalizeDocstring def cpu(self, irc, msg, args): """takes no arguments @@ -122,16 +128,16 @@ class Status(callbacks.Plugin): timeRunning = now - world.startedAt if self.registryValue('cpu.children', target) and \ user+system < timeRunning+1: # Fudge for FPU inaccuracies. - children = 'My children have taken %.2f seconds of user time ' \ - 'and %.2f seconds of system time ' \ - 'for a total of %.2f seconds of CPU time. ' % \ + children = _('My children have taken %.2f seconds of user time ' + 'and %.2f seconds of system time ' + 'for a total of %.2f seconds of CPU time. ') % \ (childUser, childSystem, childUser+childSystem) else: children = '' activeThreads = threading.activeCount() - response = 'I have taken %.2f seconds of user time and %.2f seconds ' \ - 'of system time, for a total of %.2f seconds of CPU ' \ - 'time. %s' % (user, system, user + system, children) + response = _('I have taken %.2f seconds of user time and %.2f seconds ' + 'of system time, for a total of %.2f seconds of CPU ' + 'time. %s') % (user, system, user + system, children) if self.registryValue('cpu.threads', target): response += format('I have spawned %n; I currently have %i still ' 'running.', @@ -151,18 +157,19 @@ class Status(callbacks.Plugin): stdout=subprocess.PIPE, stderr=subprocess.PIPE) except OSError: - irc.error('Unable to run ps command.', Raise=True) - (out, _) = inst.communicate() + irc.error(_('Unable to run ps command.'), Raise=True) + (out, foo) = inst.communicate() inst.wait() mem = out.splitlines()[1] elif sys.platform.startswith('netbsd'): mem = '%s kB' % os.stat('/proc/%s/mem' % pid)[7] - response += ' I\'m taking up %s kB of memory.' % mem + response += _(' I\'m taking up %s kB of memory.') % mem except Exception: self.log.exception('Uncaught exception in cpu.memory:') irc.reply(utils.str.normalizeWhitespace(response)) cpu = wrap(cpu) + @internationalizeDocstring def cmd(self, irc, msg, args): """takes no arguments @@ -174,13 +181,14 @@ class Status(callbacks.Plugin): if isinstance(cb, callbacks.Plugin): callbacksPlugin += 1 commands += len(cb.listCommands()) - s = format('I offer a total of %n in %n. I have processed %n.', + s = format(_('I offer a total of %n in %n. I have processed %n.'), (commands, 'command'), (callbacksPlugin, 'command-based', 'plugin'), (world.commandsProcessed, 'command')) irc.reply(s) cmd = wrap(cmd) + @internationalizeDocstring def commands(self, irc, msg, args): """takes no arguments @@ -194,16 +202,18 @@ class Status(callbacks.Plugin): irc.reply(format('%L', sorted(commands))) commands = wrap(commands) + @internationalizeDocstring def uptime(self, irc, msg, args): """takes no arguments Returns the amount of time the bot has been running. """ - response = 'I have been running for %s.' % \ + response = _('I have been running for %s.') % \ utils.timeElapsed(time.time() - world.startedAt) irc.reply(response) uptime = wrap(uptime) + @internationalizeDocstring def server(self, irc, msg, args): """takes no arguments diff --git a/plugins/String/config.py b/plugins/String/config.py index e4f1840ad..d451b6a9e 100644 --- a/plugins/String/config.py +++ b/plugins/String/config.py @@ -29,6 +29,8 @@ import supybot.conf as conf import supybot.registry as registry +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('String') def configure(advanced): # This will be called by supybot to configure this module. advanced is @@ -42,13 +44,13 @@ def configure(advanced): String = conf.registerPlugin('String') conf.registerGroup(String, 'levenshtein') conf.registerGlobalValue(String.levenshtein, 'max', - registry.PositiveInteger(256, """Determines the maximum size of a string + registry.PositiveInteger(256, _("""Determines the maximum size of a string given to the levenshtein command. The levenshtein command uses an O(m*n) algorithm, which means that with strings of length 256, it can take 1.5 seconds to finish; with strings of length 384, though, it can take 4 seconds to finish, and with strings of much larger lengths, it takes more and more time. Using nested commands, strings can get quite large, hence this variable, to limit the size of arguments passed to the levenshtein - command.""")) + command."""))) # vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: diff --git a/plugins/String/messages.pot b/plugins/String/messages.pot new file mode 100644 index 000000000..1d593ab4b --- /dev/null +++ b/plugins/String/messages.pot @@ -0,0 +1,168 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR ORGANIZATION +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2010-10-20 09:08+CEST\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \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:47 +msgid "" +"Determines the maximum size of a string\n" +" given to the levenshtein command. The levenshtein command uses an O(m*n)\n" +" algorithm, which means that with strings of length 256, it can take 1.5\n" +" seconds to finish; with strings of length 384, though, it can take 4\n" +" seconds to finish, and with strings of much larger lengths, it takes more\n" +" and more time. Using nested commands, strings can get quite large, hence\n" +" this variable, to limit the size of arguments passed to the levenshtein\n" +" command." +msgstr "" + +#: plugin.py:46 +#, docstring +msgid "" +"\n" +"\n" +" Returns the 8-bit value of .\n" +" " +msgstr "" + +#: plugin.py:55 +#, docstring +msgid "" +"\n" +"\n" +" Returns the character associated with the 8-bit value \n" +" " +msgstr "" + +#: plugin.py:62 +msgid "That number doesn't map to an 8-bit character." +msgstr "" + +#: plugin.py:67 +#, docstring +msgid "" +" \n" +"\n" +" Returns an encoded form of the given text; the valid encodings are\n" +" available in the documentation of the Python codecs module:\n" +" .\n" +" " +msgstr "" + +#: plugin.py:76 plugin.py:90 +msgid "encoding" +msgstr "" + +#: plugin.py:81 +#, docstring +msgid "" +" \n" +"\n" +" Returns an un-encoded form of the given text; the valid encodings are\n" +" available in the documentation of the Python codecs module:\n" +" .\n" +" " +msgstr "" + +#: plugin.py:92 +msgid "base64 string" +msgstr "" + +#: plugin.py:93 +msgid "Base64 strings must be a multiple of 4 in length, padded with '=' if necessary." +msgstr "" + +#: plugin.py:99 +#, docstring +msgid "" +" \n" +"\n" +" Returns the levenshtein distance (also known as the \"edit distance\"\n" +" between and )\n" +" " +msgstr "" + +#: plugin.py:106 +msgid "Levenshtein distance is a complicated algorithm, try it with some smaller inputs." +msgstr "" + +#: plugin.py:114 +#, docstring +msgid "" +" []\n" +"\n" +" Returns the Soundex hash to a given length. The length defaults to\n" +" 4, since that's the standard length for a soundex hash. For unlimited\n" +" length, use 0.\n" +" " +msgstr "" + +#: plugin.py:125 +#, docstring +msgid "" +"\n" +"\n" +" Returns the length of .\n" +" " +msgstr "" + +#: plugin.py:134 +#, docstring +msgid "" +" \n" +"\n" +" If is of the form m/regexp/flags, returns the portion of\n" +" that matches the regexp. If is of the form\n" +" s/regexp/replacement/flags, returns the result of applying such a\n" +" regexp to .\n" +" " +msgstr "" + +#: plugin.py:146 +msgid "You probably don't want to match the empty string." +msgstr "" + +#: plugin.py:156 +#, docstring +msgid "" +" \n" +"\n" +" Returns XOR-encrypted with . See\n" +" http://www.yoe.org/developer/xor.html for information about XOR\n" +" encryption.\n" +" " +msgstr "" + +#: plugin.py:169 +#, docstring +msgid "" +"\n" +"\n" +" Returns the md5 hash of a given string. Read\n" +" http://www.rsasecurity.com/rsalabs/faq/3-6-6.html for more information\n" +" about md5.\n" +" " +msgstr "" + +#: plugin.py:180 +#, docstring +msgid "" +"\n" +"\n" +" Returns the SHA hash of a given string. Read\n" +" http://www.secure-hash-algorithm-md5-sha-1.co.uk/ for more information\n" +" about SHA.\n" +" " +msgstr "" + diff --git a/plugins/String/plugin.py b/plugins/String/plugin.py index d6b4c0dbe..6d0073529 100644 --- a/plugins/String/plugin.py +++ b/plugins/String/plugin.py @@ -36,9 +36,12 @@ from supybot.commands import * import supybot.plugins as plugins import supybot.ircutils as ircutils import supybot.callbacks as callbacks +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('String') class String(callbacks.Plugin): + @internationalizeDocstring def ord(self, irc, msg, args, letter): """ @@ -47,6 +50,7 @@ class String(callbacks.Plugin): irc.reply(str(ord(letter))) ord = wrap(ord, ['letter']) + @internationalizeDocstring def chr(self, irc, msg, args, i): """ @@ -55,9 +59,10 @@ class String(callbacks.Plugin): try: irc.reply(chr(i)) except ValueError: - irc.error('That number doesn\'t map to an 8-bit character.') + irc.error(_('That number doesn\'t map to an 8-bit character.')) chr = wrap(chr, ['int']) + @internationalizeDocstring def encode(self, irc, msg, args, encoding, text): """ @@ -68,9 +73,10 @@ class String(callbacks.Plugin): try: irc.reply(text.encode(encoding).rstrip('\n')) except LookupError: - irc.errorInvalid('encoding', encoding) + irc.errorInvalid(_('encoding'), encoding) encode = wrap(encode, ['something', 'text']) + @internationalizeDocstring def decode(self, irc, msg, args, encoding, text): """ @@ -81,13 +87,14 @@ class String(callbacks.Plugin): try: irc.reply(text.decode(encoding).encode('utf-8')) except LookupError: - irc.errorInvalid('encoding', encoding) + irc.errorInvalid(_('encoding'), encoding) except binascii.Error: - irc.errorInvalid('base64 string', - s='Base64 strings must be a multiple of 4 in ' - 'length, padded with \'=\' if necessary.') + irc.errorInvalid(_('base64 string'), + s=_('Base64 strings must be a multiple of 4 in ' + 'length, padded with \'=\' if necessary.')) decode = wrap(decode, ['something', 'text']) + @internationalizeDocstring def levenshtein(self, irc, msg, args, s1, s2): """ @@ -96,12 +103,13 @@ class String(callbacks.Plugin): """ max = self.registryValue('levenshtein.max') if len(s1) > max or len(s2) > max: - irc.error('Levenshtein distance is a complicated algorithm, try ' - 'it with some smaller inputs.') + irc.error(_('Levenshtein distance is a complicated algorithm, try ' + 'it with some smaller inputs.')) else: irc.reply(str(utils.str.distance(s1, s2))) levenshtein = wrap(levenshtein, ['something', 'text']) + @internationalizeDocstring def soundex(self, irc, msg, args, text, length): """ [] @@ -112,6 +120,7 @@ class String(callbacks.Plugin): irc.reply(utils.str.soundex(text, length)) soundex = wrap(soundex, ['somethingWithoutSpaces', additional('int', 4)]) + @internationalizeDocstring def len(self, irc, msg, args, text): """ @@ -120,6 +129,7 @@ class String(callbacks.Plugin): irc.reply(str(len(text))) len = wrap(len, ['text']) + @internationalizeDocstring def re(self, irc, msg, args, ff, text): """ @@ -133,7 +143,7 @@ class String(callbacks.Plugin): else: f = lambda s: ff.search(s) and ff.search(s).group(0) or '' if f('') and len(f(' ')) > len(f(''))+1: # Matches the empty string. - s = 'You probably don\'t want to match the empty string.' + s = _('You probably don\'t want to match the empty string.') irc.error(s) else: irc.reply(f(text)) @@ -141,6 +151,7 @@ class String(callbacks.Plugin): first('regexpMatcher', 'regexpReplacer'), 'text']) + @internationalizeDocstring def xor(self, irc, msg, args, password, text): """ @@ -153,6 +164,7 @@ class String(callbacks.Plugin): irc.reply(''.join(ret)) xor = wrap(xor, ['something', 'text']) + @internationalizeDocstring def md5(self, irc, msg, args, text): """ @@ -163,6 +175,7 @@ class String(callbacks.Plugin): irc.reply(utils.crypt.md5(text).hexdigest()) md5 = wrap(md5, ['text']) + @internationalizeDocstring def sha(self, irc, msg, args, text): """ diff --git a/plugins/Success/config.py b/plugins/Success/config.py index 8a0cabb4f..72ddf49e3 100644 --- a/plugins/Success/config.py +++ b/plugins/Success/config.py @@ -29,6 +29,8 @@ import supybot.conf as conf import supybot.registry as registry +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('Success') def configure(advanced): # This will be called by supybot to configure this module. advanced is @@ -42,10 +44,10 @@ def configure(advanced): Success = conf.registerPlugin('Success') # This is where your configuration variables (if any) should go. For example: # conf.registerGlobalValue(Success, 'someConfigVariableName', -# registry.Boolean(False, """Help for someConfigVariableName.""")) +# registry.Boolean(False, _("""Help for someConfigVariableName."""))) conf.registerChannelValue(conf.supybot.plugins.Success, 'prefixNick', - registry.Boolean(True, """Determines whether the bot will prefix the nick - of the user giving an invalid command to the success response.""")) + registry.Boolean(True, _("""Determines whether the bot will prefix the nick + of the user giving an invalid command to the success response."""))) # vim:set shiftwidth=4 softtabstop=8 expandtab textwidth=78 diff --git a/plugins/Success/messages.pot b/plugins/Success/messages.pot new file mode 100644 index 000000000..361535e0e --- /dev/null +++ b/plugins/Success/messages.pot @@ -0,0 +1,33 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR ORGANIZATION +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2010-10-20 09:09+CEST\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \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 prefix the nick\n" +" of the user giving an invalid command to the success response." +msgstr "" + +#: plugin.py:39 +#, docstring +msgid "" +"This plugin was written initially to work with MoobotFactoids, the two\n" +" of them to provide a similar-to-moobot-and-blootbot interface for factoids.\n" +" Basically, it replaces the standard 'The operation succeeded.' messages\n" +" with messages kept in a database, able to give more personable\n" +" responses." +msgstr "" + diff --git a/plugins/Success/plugin.py b/plugins/Success/plugin.py index ec6adbcf0..572b1e340 100644 --- a/plugins/Success/plugin.py +++ b/plugins/Success/plugin.py @@ -31,7 +31,10 @@ import supybot.conf as conf from supybot.commands import * import supybot.plugins as plugins import supybot.ircutils as ircutils +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('Success') +@internationalizeDocstring class Success(plugins.ChannelIdDatabasePlugin): """This plugin was written initially to work with MoobotFactoids, the two of them to provide a similar-to-moobot-and-blootbot interface for factoids. From 6a9a8d81b81dd0a7e7e0ff1608d25b56e33d9bd0 Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Wed, 20 Oct 2010 09:39:44 +0200 Subject: [PATCH 3/3] Internationalize Time, Todo, Topic, URL, Unix, Utilities, and Web --- plugins/Time/config.py | 6 +- plugins/Time/messages.pot | 97 +++++++++ plugins/Time/plugin.py | 14 +- plugins/Todo/config.py | 4 +- plugins/Todo/messages.pot | 129 ++++++++++++ plugins/Todo/plugin.py | 42 ++-- plugins/Topic/config.py | 26 +-- plugins/Topic/messages.pot | 356 +++++++++++++++++++++++++++++++++ plugins/Topic/plugin.py | 67 +++++-- plugins/URL/config.py | 6 +- plugins/URL/messages.pot | 58 ++++++ plugins/URL/plugin.py | 8 +- plugins/Unix/config.py | 36 ++-- plugins/Unix/messages.pot | 198 ++++++++++++++++++ plugins/Unix/plugin.py | 46 +++-- plugins/Utilities/config.py | 4 +- plugins/Utilities/messages.pot | 81 ++++++++ plugins/Utilities/plugin.py | 8 + plugins/Web/config.py | 18 +- plugins/Web/messages.pot | 156 +++++++++++++++ plugins/Web/plugin.py | 36 ++-- 21 files changed, 1279 insertions(+), 117 deletions(-) create mode 100644 plugins/Time/messages.pot create mode 100644 plugins/Todo/messages.pot create mode 100644 plugins/Topic/messages.pot create mode 100644 plugins/URL/messages.pot create mode 100644 plugins/Unix/messages.pot create mode 100644 plugins/Utilities/messages.pot create mode 100644 plugins/Web/messages.pot diff --git a/plugins/Time/config.py b/plugins/Time/config.py index 6317c41cc..cb56cf3b5 100644 --- a/plugins/Time/config.py +++ b/plugins/Time/config.py @@ -29,6 +29,8 @@ import supybot.conf as conf import supybot.registry as registry +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('Time') def configure(advanced): # This will be called by supybot to configure this module. advanced is @@ -40,10 +42,10 @@ def configure(advanced): Time = conf.registerPlugin('Time') conf.registerChannelValue(Time, 'format', - registry.String(str(conf.supybot.reply.format.time()), """Determines the + registry.String(str(conf.supybot.reply.format.time()), _("""Determines the format string for timestamps. Refer to the Python documentation for the time module to see what formats are accepted. If you set this variable to - the empty string, the timestamp will not be shown.""")) + the empty string, the timestamp will not be shown."""))) # vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: diff --git a/plugins/Time/messages.pot b/plugins/Time/messages.pot new file mode 100644 index 000000000..cd16ce41c --- /dev/null +++ b/plugins/Time/messages.pot @@ -0,0 +1,97 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR ORGANIZATION +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2010-10-20 09:38+CEST\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \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\n" +" format string for timestamps. Refer to the Python documentation for the\n" +" time module to see what formats are accepted. If you set this variable to\n" +" the empty string, the timestamp will not be shown." +msgstr "" + +#: plugin.py:60 +#, docstring +msgid "" +"[y] [w] [d] [h] [m] [s]\n" +"\n" +" Returns the number of seconds in the number of , ,\n" +" , , , and given. An example usage is\n" +" \"seconds 2h 30m\", which would return 9000, which is '3600*2 + 30*60'.\n" +" Useful for scheduling events at a given number of seconds in the\n" +" future.\n" +" " +msgstr "" + +#: plugin.py:95 +#, docstring +msgid "" +"