From 5fa6ff7bf85e90c871be61c007f0f46a17dd9f9b Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Sat, 16 Oct 2010 10:54:33 +0200 Subject: [PATCH 01/10] Add an accidentaly removed space --- plugins/Admin/messages.pot | 60 +++++++++++++++++++------------------- plugins/Admin/plugin.py | 2 +- 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/plugins/Admin/messages.pot b/plugins/Admin/messages.pot index e5833f721..673d31155 100644 --- a/plugins/Admin/messages.pot +++ b/plugins/Admin/messages.pot @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2010-10-16 09:41+CEST\n" +"POT-Creation-Date: 2010-10-16 10:43+CEST\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -15,32 +15,32 @@ msgstr "" "Generated-By: pygettext.py 1.5\n" -#: plugin.py:53 +#: plugin.py:54 #, docstring msgid "Nick/channel temporarily unavailable." msgstr "" -#: plugin.py:71 +#: plugin.py:72 msgid "Cannot join %s, it's full." msgstr "" -#: plugin.py:79 +#: plugin.py:80 msgid "Cannot join %s, I was not invited." msgstr "" -#: plugin.py:87 +#: plugin.py:88 msgid "Cannot join %s, it's banned me." msgstr "" -#: plugin.py:95 +#: plugin.py:96 msgid "Cannot join %s, my keyword was wrong." msgstr "" -#: plugin.py:103 +#: plugin.py:104 msgid "Cannot join %s, I'm not identified with the NickServ." msgstr "" -#: plugin.py:133 +#: plugin.py:134 #, docstring msgid "" " []\n" @@ -50,11 +50,11 @@ msgid "" " " msgstr "" -#: plugin.py:146 +#: plugin.py:147 msgid "I'm already too close to maximum number of channels for this network." msgstr "" -#: plugin.py:155 +#: plugin.py:156 #, docstring msgid "" "takes no arguments\n" @@ -64,27 +64,27 @@ msgid "" " " msgstr "" -#: plugin.py:165 +#: plugin.py:166 msgid "I'm not currently in any channels." msgstr "" -#: plugin.py:171 +#: plugin.py:172 msgid "My connection is restricted, I can't change nicks." msgstr "" -#: plugin.py:178 +#: plugin.py:179 msgid "Someone else is already using that nick." msgstr "" -#: plugin.py:185 +#: plugin.py:186 msgid "That nick is currently banned." msgstr "" -#: plugin.py:192 +#: plugin.py:193 msgid "I can't change nicks, the server said %q." msgstr "" -#: plugin.py:206 +#: plugin.py:207 #, docstring msgid "" "[]\n" @@ -94,7 +94,7 @@ msgid "" " " msgstr "" -#: plugin.py:221 +#: plugin.py:222 #, docstring msgid "" "[] []\n" @@ -106,11 +106,11 @@ msgid "" " " msgstr "" -#: plugin.py:239 +#: plugin.py:240 msgid "I'm not in %s." msgstr "" -#: plugin.py:251 +#: plugin.py:252 #, docstring msgid "" " \n" @@ -120,15 +120,15 @@ msgid "" " " msgstr "" -#: plugin.py:271 -msgid "The \"owner\" capability can't be added in thebot. Use the supybot-adduser program (or edit the users.conf file yourself) to add an owner capability." +#: plugin.py:272 +msgid "The \"owner\" capability can't be added in the bot. Use the supybot-adduser program (or edit the users.conf file yourself) to add an owner capability." msgstr "" -#: plugin.py:282 +#: plugin.py:283 msgid "You can't add capabilities you don't have." msgstr "" -#: plugin.py:287 +#: plugin.py:288 #, docstring msgid "" " \n" @@ -138,15 +138,15 @@ msgid "" " " msgstr "" -#: plugin.py:299 +#: plugin.py:300 msgid "That user doesn't have that capability." msgstr "" -#: plugin.py:301 +#: plugin.py:302 msgid "You can't remove capabilities you don't have." msgstr "" -#: plugin.py:309 +#: plugin.py:310 #, docstring msgid "" " []\n" @@ -158,7 +158,7 @@ msgid "" " " msgstr "" -#: plugin.py:322 +#: plugin.py:323 #, docstring msgid "" "\n" @@ -168,11 +168,11 @@ msgid "" " " msgstr "" -#: plugin.py:331 +#: plugin.py:332 msgid "%s wasn't in the ignores database." msgstr "" -#: plugin.py:336 +#: plugin.py:337 #, docstring msgid "" "takes no arguments\n" @@ -181,7 +181,7 @@ msgid "" " " msgstr "" -#: plugin.py:344 +#: plugin.py:345 msgid "I'm not currently globally ignoring anyone." msgstr "" diff --git a/plugins/Admin/plugin.py b/plugins/Admin/plugin.py index 205856a2d..0590f715c 100644 --- a/plugins/Admin/plugin.py +++ b/plugins/Admin/plugin.py @@ -269,7 +269,7 @@ class Admin(callbacks.Plugin): # will depend on supybot.capabilities and its child default) but # generally means they can't mess with channel capabilities. if ircutils.strEqual(capability, 'owner'): - irc.error(_('The "owner" capability can\'t be added in the' + irc.error(_('The "owner" capability can\'t be added in the ' 'bot. Use the supybot-adduser program (or edit the ' 'users.conf file yourself) to add an owner ' 'capability.')) From 1cc1ec93a5a0a57e144677a2d596024fbc3e226c Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Sat, 16 Oct 2010 13:51:27 +0200 Subject: [PATCH 02/10] Internationalize Config, Network, Plugin, and User --- plugins/Config/config.py | 2 + plugins/Config/messages.pot | 134 ++++++++++++++++ plugins/Config/plugin.py | 35 +++-- plugins/Network/config.py | 2 + plugins/Network/messages.pot | 170 +++++++++++++++++++++ plugins/Network/plugin.py | 51 ++++--- plugins/Plugin/config.py | 2 + plugins/Plugin/messages.pot | 217 ++++++++++++++++++++++++++ plugins/Plugin/plugin.py | 64 ++++---- plugins/User/config.py | 2 + plugins/User/messages.pot | 288 +++++++++++++++++++++++++++++++++++ plugins/User/plugin.py | 79 ++++++---- 12 files changed, 958 insertions(+), 88 deletions(-) create mode 100644 plugins/Config/messages.pot create mode 100644 plugins/Network/messages.pot create mode 100644 plugins/Plugin/messages.pot create mode 100644 plugins/User/messages.pot diff --git a/plugins/Config/config.py b/plugins/Config/config.py index 878b5051a..7f53e8208 100644 --- a/plugins/Config/config.py +++ b/plugins/Config/config.py @@ -30,6 +30,8 @@ import supybot.conf as conf import supybot.registry as registry +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('Config') def configure(advanced): # This will be called by supybot to configure this module. advanced is diff --git a/plugins/Config/messages.pot b/plugins/Config/messages.pot new file mode 100644 index 000000000..bc578f015 --- /dev/null +++ b/plugins/Config/messages.pot @@ -0,0 +1,134 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR ORGANIZATION +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2010-10-16 12:34+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:136 +#, docstring +msgid "" +"\n" +"\n" +" Returns the configuration variables available under the given\n" +" configuration . If a variable has values under it, it is\n" +" preceded by an '@' sign. If a variable is a 'ChannelValue', that is,\n" +" it can be separately configured for each channel using the 'channel'\n" +" command in this plugin, it is preceded by an '#' sign.\n" +" " +msgstr "" + +#: plugin.py:148 +msgid "There don't seem to be any values in %s." +msgstr "" + +#: plugin.py:154 +#, docstring +msgid "" +"\n" +"\n" +" Searches for in the current configuration variables.\n" +" " +msgstr "" + +#: plugin.py:167 +msgid "There were no matching configuration variables." +msgstr "" + +#: plugin.py:174 +msgid "Global: %s; %s: %s" +msgstr "" + +#: plugin.py:185 +msgid "That registry variable has no value. Use the list command in this plugin to see what variables are available in this group." +msgstr "" + +#: plugin.py:200 +#, docstring +msgid "" +"[] []\n" +"\n" +" If is given, sets the channel configuration variable for \n" +" to for . Otherwise, returns the current channel\n" +" configuration value of . is only necessary if the\n" +" message isn't sent in the channel itself." +msgstr "" + +#: plugin.py:207 +msgid "That configuration variable is not a channel-specific configuration variable." +msgstr "" + +#: plugin.py:220 +#, docstring +msgid "" +" []\n" +"\n" +" If is given, sets the value of to . Otherwise,\n" +" returns the current value of . You may omit the leading\n" +" \"supybot.\" in the name if you so choose.\n" +" " +msgstr "" + +#: plugin.py:234 +#, docstring +msgid "" +"\n" +"\n" +" Returns the description of the configuration variable .\n" +" " +msgstr "" + +#: plugin.py:242 +msgid " (Current value: %s)" +msgstr "" + +#: plugin.py:245 +msgid "That configuration group exists, but seems to have no help. Try \"config list %s\" to see if it has any children values." +msgstr "" + +#: plugin.py:249 +msgid "%s has no help." +msgstr "" + +#: plugin.py:254 +#, docstring +msgid "" +"\n" +"\n" +" Returns the default value of the configuration variable .\n" +" " +msgstr "" + +#: plugin.py:264 +#, docstring +msgid "" +"takes no arguments\n" +"\n" +" Reloads the various configuration files (user database, channel\n" +" database, registry, etc.).\n" +" " +msgstr "" + +#: plugin.py:275 +#, docstring +msgid "" +"\n" +"\n" +" Exports the public variables of your configuration to .\n" +" If you want to show someone your configuration file, but you don't\n" +" want that person to be able to see things like passwords, etc., this\n" +" command will export a \"sanitized\" configuration file suitable for\n" +" showing publicly.\n" +" " +msgstr "" + diff --git a/plugins/Config/plugin.py b/plugins/Config/plugin.py index 0b2dd6fda..6ad3bdf8e 100644 --- a/plugins/Config/plugin.py +++ b/plugins/Config/plugin.py @@ -41,6 +41,8 @@ from supybot.utils.iter import all import supybot.ircutils as ircutils import supybot.registry as registry import supybot.callbacks as callbacks +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('Config') ### # Now, to setup the registry. @@ -129,6 +131,7 @@ class Config(callbacks.Plugin): utils.sortBy(str.lower, L) return L + @internationalizeDocstring def list(self, irc, msg, args, group): """ @@ -142,9 +145,11 @@ class Config(callbacks.Plugin): if L: irc.reply(format('%L', L)) else: - irc.error('There don\'t seem to be any values in %s.' % group._name) + irc.error(_('There don\'t seem to be any values in %s.') % + group._name) list = wrap(list, ['configVar']) + @internationalizeDocstring def search(self, irc, msg, args, word): """ @@ -159,14 +164,14 @@ class Config(callbacks.Plugin): if L: irc.reply(format('%L', L)) else: - irc.reply('There were no matching configuration variables.') + irc.reply(_('There were no matching configuration variables.')) search = wrap(search, ['lowered']) # XXX compose with withoutSpaces? def _getValue(self, irc, msg, group, addChannel=False): value = str(group) or ' ' if addChannel and irc.isChannel(msg.args[0]) and not irc.nested: s = str(group.get(msg.args[0])) - value = 'Global: %s; %s: %s' % (value, msg.args[0], s) + value = _('Global: %s; %s: %s') % (value, msg.args[0], s) if hasattr(group, 'value'): if not group._private: irc.reply(value) @@ -177,9 +182,9 @@ class Config(callbacks.Plugin): else: irc.errorNoCapability(capability) else: - irc.error('That registry variable has no value. Use the list ' + irc.error(_('That registry variable has no value. Use the list ' 'command in this plugin to see what variables are ' - 'available in this group.') + 'available in this group.')) def _setValue(self, irc, msg, group, value): capability = getCapability(group._name) @@ -190,6 +195,7 @@ class Config(callbacks.Plugin): else: irc.errorNoCapability(capability) + @internationalizeDocstring def channel(self, irc, msg, args, channel, group, value): """[] [] @@ -198,8 +204,8 @@ class Config(callbacks.Plugin): configuration value of . is only necessary if the message isn't sent in the channel itself.""" if not group.channelValue: - irc.error('That configuration variable is not a channel-specific ' - 'configuration variable.') + irc.error(_('That configuration variable is not a channel-specific ' + 'configuration variable.')) return group = group.get(channel) if value is not None: @@ -209,6 +215,7 @@ class Config(callbacks.Plugin): channel = wrap(channel, ['channel', 'settableConfigVar', additional('text')]) + @internationalizeDocstring def config(self, irc, msg, args, group, value): """ [] @@ -222,6 +229,7 @@ class Config(callbacks.Plugin): self._getValue(irc, msg, group, addChannel=group.channelValue) config = wrap(config, ['settableConfigVar', additional('text')]) + @internationalizeDocstring def help(self, irc, msg, args, group): """ @@ -231,16 +239,17 @@ class Config(callbacks.Plugin): s = group.help() if s: if hasattr(group, 'value') and not group._private: - s += ' (Current value: %s)' % group + s += _(' (Current value: %s)') % group irc.reply(s) else: - irc.reply('That configuration group exists, but seems to have ' - 'no help. Try "config list %s" to see if it has ' - 'any children values.' % group._name) + irc.reply(_('That configuration group exists, but seems to ' + 'have no help. Try "config list %s" to see if it ' + 'has any children values.') % group._name) else: - irc.error('%s has no help.' % group._name) + irc.error(_('%s has no help.') % group._name) help = wrap(help, ['configVar']) + @internationalizeDocstring def default(self, irc, msg, args, group): """ @@ -250,6 +259,7 @@ class Config(callbacks.Plugin): irc.reply(str(v)) default = wrap(default, ['settableConfigVar']) + @internationalizeDocstring def reload(self, irc, msg, args): """takes no arguments @@ -260,6 +270,7 @@ class Config(callbacks.Plugin): irc.replySuccess() reload = wrap(reload, [('checkCapability', 'owner')]) + @internationalizeDocstring def export(self, irc, msg, args, filename): """ diff --git a/plugins/Network/config.py b/plugins/Network/config.py index f50ddc473..c1cf102ef 100644 --- a/plugins/Network/config.py +++ b/plugins/Network/config.py @@ -29,6 +29,8 @@ import supybot.conf as conf import supybot.registry as registry +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('Network') def configure(advanced): # This will be called by supybot to configure this module. advanced is diff --git a/plugins/Network/messages.pot b/plugins/Network/messages.pot new file mode 100644 index 000000000..e368ae1f0 --- /dev/null +++ b/plugins/Network/messages.pot @@ -0,0 +1,170 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR ORGANIZATION +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2010-10-16 12: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:57 +#, docstring +msgid "" +"[--ssl] [] []\n" +"\n" +" Connects to another network (which will be represented by the name\n" +" provided in ) at . If port is not provided, it\n" +" defaults to 6667, the default port for IRC. If password is\n" +" provided, it will be sent to the server in a PASS command. If --ssl is\n" +" provided, an SSL connection will be attempted.\n" +" " +msgstr "" + +#: plugin.py:67 +msgid "I'm already connected to %s." +msgstr "" + +#: plugin.py:87 +msgid "A server must be provided if the network is not already registered." +msgstr "" + +#: plugin.py:95 +msgid "Connection to %s initiated." +msgstr "" + +#: plugin.py:102 +#, docstring +msgid "" +"[] []\n" +"\n" +" Disconnects from the network represented by the network .\n" +" If is given, quits the network with the given quit\n" +" message. is only necessary if the network is different\n" +" from the network the command is sent on.\n" +" " +msgstr "" + +#: plugin.py:114 +msgid "Disconnection to %s initiated." +msgstr "" + +#: plugin.py:120 +#, docstring +msgid "" +"[] []\n" +"\n" +" Disconnects and then reconnects to . If no network is given,\n" +" disconnects and then reconnects to the network the command was given\n" +" on. If no quit message is given, uses the configured one\n" +" (supybot.plugins.Owner.quitMsg) or the nick of the person giving the\n" +" command.\n" +" " +msgstr "" + +#: plugin.py:137 +#, docstring +msgid "" +" [ ...]\n" +"\n" +" Gives the bot (with its associated s) on .\n" +" " +msgstr "" + +#: plugin.py:210 +msgid "is an op on %L" +msgstr "" + +#: plugin.py:212 +msgid "is a halfop on %L" +msgstr "" + +#: plugin.py:214 +msgid "is voiced on %L" +msgstr "" + +#: plugin.py:217 +msgid "is also on %L" +msgstr "" + +#: plugin.py:219 +msgid "is on %L" +msgstr "" + +#: plugin.py:221 +msgid "isn't on any non-secret channels" +msgstr "" + +#: plugin.py:228 plugin.py:229 plugin.py:233 +msgid "" +msgstr "" + +#: plugin.py:240 +msgid " identified" +msgstr "" + +#: plugin.py:245 +msgid "%s (%s) has been%s on server %s since %s (idle for %s) and %s.%s" +msgstr "" + +#: plugin.py:258 +msgid "There is no %s on %s." +msgstr "" + +#: plugin.py:264 +#, docstring +msgid "" +"[] \n" +"\n" +" Returns the WHOIS response gives for . is\n" +" only necessary if the network is different than the network the command\n" +" is sent on.\n" +" " +msgstr "" + +#: plugin.py:280 +#, docstring +msgid "" +"takes no arguments\n" +"\n" +" Returns the networks to which the bot is currently connected.\n" +" " +msgstr "" + +#: plugin.py:293 +msgid "%.2f seconds." +msgstr "" + +#: plugin.py:297 +#, docstring +msgid "" +"[]\n" +"\n" +" Returns the current latency to . is only necessary\n" +" if the message isn't sent on the network to which this command is to\n" +" apply.\n" +" " +msgstr "" + +#: plugin.py:303 +msgid "Latency check (from %s)." +msgstr "" + +#: plugin.py:311 +#, docstring +msgid "" +"[]\n" +"\n" +" Returns the current network driver for . is only\n" +" necessary if the message isn't sent on the network to which this\n" +" command is to apply.\n" +" " +msgstr "" + diff --git a/plugins/Network/plugin.py b/plugins/Network/plugin.py index 2eb405f01..41bf0c646 100644 --- a/plugins/Network/plugin.py +++ b/plugins/Network/plugin.py @@ -38,6 +38,8 @@ import supybot.ircmsgs as ircmsgs import supybot.ircutils as ircutils import supybot.registry as registry import supybot.callbacks as callbacks +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('Network') class Network(callbacks.Plugin): _whois = {} @@ -50,6 +52,7 @@ class Network(callbacks.Plugin): raise callbacks.Error, \ 'I\'m not currently connected to %s.' % network + @internationalizeDocstring def connect(self, irc, msg, args, opts, network, server, password): """[--ssl] [] [] @@ -61,7 +64,7 @@ class Network(callbacks.Plugin): """ try: otherIrc = self._getIrc(network) - irc.error('I\'m already connected to %s.' % network) + irc.error(_('I\'m already connected to %s.') % network) return # We've gotta return here. This is ugly code, but I'm not # quite sure what to do about it. except callbacks.Error: @@ -81,19 +84,20 @@ class Network(callbacks.Plugin): try: serverPort = conf.supybot.networks.get(network).servers()[0] except (registry.NonExistentRegistryEntry, IndexError): - irc.error('A server must be provided if the network is not ' - 'already registered.') + irc.error(_('A server must be provided if the network is not ' + 'already registered.')) return Owner = irc.getCallback('Owner') newIrc = Owner._connect(network, serverPort=serverPort, password=password, ssl=ssl) conf.supybot.networks().add(network) assert newIrc.callbacks is irc.callbacks, 'callbacks list is different' - irc.replySuccess('Connection to %s initiated.' % network) + irc.replySuccess(_('Connection to %s initiated.') % network) connect = wrap(connect, ['owner', getopts({'ssl': ''}), 'something', additional('something'), additional('something', '')]) + @internationalizeDocstring def disconnect(self, irc, msg, args, otherIrc, quitMsg): """[] [] @@ -107,10 +111,11 @@ class Network(callbacks.Plugin): otherIrc.die() conf.supybot.networks().discard(otherIrc.network) if otherIrc != irc: - irc.replySuccess('Disconnection to %s initiated.' % + irc.replySuccess(_('Disconnection to %s initiated.') % otherIrc.network) disconnect = wrap(disconnect, ['owner', 'networkIrc', additional('text')]) + @internationalizeDocstring def reconnect(self, irc, msg, args, otherIrc, quitMsg): """[] [] @@ -127,6 +132,7 @@ class Network(callbacks.Plugin): irc.replySuccess() reconnect = wrap(reconnect, ['owner', 'networkIrc', additional('text')]) + @internationalizeDocstring def command(self, irc, msg, args, otherIrc, commandAndArgs): """ [ ...] @@ -201,43 +207,43 @@ class Network(callbacks.Plugin): voices.append(channel[1:]) 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', halfops)) + L.append(format(_('is a halfop on %L'), halfops)) 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 = ' %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 = '%s (%s) has been%s on server %s since %s (idle for %s) and ' \ - '%s.%s' % (user, hostmask, identify, server, signon, idle, + s = _('%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) del self._whois[(irc, loweredNick)] @@ -249,10 +255,11 @@ class Network(callbacks.Plugin): return (replyIrc, replyMsg, d) = self._whois[(irc, loweredNick)] del self._whois[(irc, loweredNick)] - s = 'There is no %s on %s.' % (nick, irc.network) + s = _('There is no %s on %s.') % (nick, irc.network) replyIrc.reply(s) do401 = do402 + @internationalizeDocstring def whois(self, irc, msg, args, otherIrc, nick): """[] @@ -268,6 +275,7 @@ class Network(callbacks.Plugin): self._whois[(otherIrc, nick)] = (irc, msg, {}) whois = wrap(whois, ['networkIrc', 'nick']) + @internationalizeDocstring def networks(self, irc, msg, args): """takes no arguments @@ -282,8 +290,9 @@ class Network(callbacks.Plugin): now = time.time() if irc in self._latency: (replyIrc, when) = self._latency.pop(irc) - replyIrc.reply('%.2f seconds.' % (now-when)) + replyIrc.reply(_('%.2f seconds.') % (now-when)) + @internationalizeDocstring def latency(self, irc, msg, args, otherIrc): """[] @@ -291,11 +300,13 @@ class Network(callbacks.Plugin): if the message isn't sent on the network to which this command is to apply. """ - otherIrc.queueMsg(ircmsgs.ping('Latency check (from %s).' % msg.nick)) + otherIrc.queueMsg(ircmsgs.ping(_('Latency check (from %s).') % + msg.nick)) self._latency[otherIrc] = (irc, time.time()) irc.noReply() latency = wrap(latency, ['networkIrc']) + @internationalizeDocstring def driver(self, irc, msg, args, otherIrc): """[] diff --git a/plugins/Plugin/config.py b/plugins/Plugin/config.py index 3a0891ace..f9d0cd673 100644 --- a/plugins/Plugin/config.py +++ b/plugins/Plugin/config.py @@ -29,6 +29,8 @@ import supybot.conf as conf import supybot.registry as registry +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('Plugin') def configure(advanced): # This will be called by supybot to configure this module. advanced is diff --git a/plugins/Plugin/messages.pot b/plugins/Plugin/messages.pot new file mode 100644 index 000000000..3e978d574 --- /dev/null +++ b/plugins/Plugin/messages.pot @@ -0,0 +1,217 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR ORGANIZATION +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2010-10-16 13:50+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:43 +#, docstring +msgid "" +"This plugin exists to help users manage their plugins. Use 'plugin\n" +" list' to list the loaded plugins; use 'plugin help' to get the description\n" +" of a plugin; use the 'plugin' command itself to determine what plugin a\n" +" command exists in." +msgstr "" + +#: plugin.py:49 +#, docstring +msgid "" +"\n" +"\n" +" Returns a useful description of how to use , if the plugin has\n" +" one.\n" +" " +msgstr "" + +#: plugin.py:58 +msgid "That plugin is loaded, but has no plugin help." +msgstr "" + +#: plugin.py:63 +#, docstring +msgid "" +"takes no arguments\n" +"\n" +" Returns a list of the currently loaded plugins.\n" +" " +msgstr "" + +#: plugin.py:74 +#, docstring +msgid "" +"\n" +"\n" +" Returns the plugin(s) that is in.\n" +" " +msgstr "" + +#: plugin.py:89 +msgid "plugins" +msgstr "" + +#: plugin.py:91 +msgid "plugin" +msgstr "" + +#: plugin.py:92 +msgid "The %q command is available in the %L %s." +msgstr "" + +#: plugin.py:95 +msgid "There is no command %q." +msgstr "" + +#: plugin.py:100 +#, docstring +msgid "" +"\n" +"\n" +" Returns the author of . This is the person you should talk to\n" +" if you have ideas, suggestions, or other comments about a given plugin.\n" +" " +msgstr "" + +#: plugin.py:106 +msgid "That plugin does not seem to be loaded." +msgstr "" + +#: plugin.py:112 +msgid "That plugin doesn't have an author that claims it." +msgstr "" + +#: plugin.py:117 +#, docstring +msgid "" +" []\n" +"\n" +" Replies with a list of people who made contributions to a given plugin.\n" +" If is specified, that person's specific contributions will\n" +" be listed. Note: The is the part inside of the parentheses\n" +" in the people listing.\n" +" " +msgstr "" + +#: plugin.py:125 +#, docstring +msgid "" +"\n" +" Take an Authors object, and return only the name and nick values\n" +" in the format 'First Last (nick)'.\n" +" " +msgstr "" + +#: plugin.py:131 +#, docstring +msgid "" +"\n" +" Take a list of long names and turn it into :\n" +" shortname[, shortname and shortname].\n" +" " +msgstr "" + +#: plugin.py:138 +#, docstring +msgid "" +"\n" +" Sort the list of 'long names' based on the number of contributions\n" +" associated with each.\n" +" " +msgstr "" + +#: plugin.py:148 +#, docstring +msgid "" +"\n" +" Build the list of author + contributors (if any) for the requested\n" +" plugin.\n" +" " +msgstr "" + +#: plugin.py:152 +msgid "The %s plugin" +msgstr "" + +#: plugin.py:153 +msgid "has not been claimed by an author" +msgstr "" + +#: plugin.py:154 +msgid "and" +msgstr "" + +#: plugin.py:155 +msgid "has no contributors listed." +msgstr "" + +#: plugin.py:160 +msgid "was written by %s" +msgstr "" + +#: plugin.py:171 +msgid "%s %h contributed to it." +msgstr "" + +#: plugin.py:176 +msgid "has no additional contributors listed." +msgstr "" + +#: plugin.py:178 +msgid "but" +msgstr "" + +#: plugin.py:181 +#, docstring +msgid "" +"\n" +" Build the list of contributions (if any) for the requested person\n" +" for the requested plugin\n" +" " +msgstr "" + +#: plugin.py:195 +msgid "The nick specified (%s) is not a registered contributor." +msgstr "" + +#: plugin.py:201 +msgid "The %s plugin does not have '%s' listed as a contributor." +msgstr "" + +#: plugin.py:209 +msgid "command" +msgstr "" + +#: plugin.py:212 +msgid "the %L %s" +msgstr "" + +#: plugin.py:214 +msgid "the %L" +msgstr "" + +#: plugin.py:217 +msgid "%s wrote the %s plugin and also contributed %L." +msgstr "" + +#: plugin.py:220 +msgid "%s contributed %L to the %s plugin." +msgstr "" + +#: plugin.py:223 +msgid "%s wrote the %s plugin" +msgstr "" + +#: plugin.py:226 +msgid "%s has no listed contributions for the %s plugin." +msgstr "" + diff --git a/plugins/Plugin/plugin.py b/plugins/Plugin/plugin.py index 6753125ce..0e77eab3d 100644 --- a/plugins/Plugin/plugin.py +++ b/plugins/Plugin/plugin.py @@ -34,13 +34,17 @@ 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('Plugin') +@internationalizeDocstring class Plugin(callbacks.Plugin): """This plugin exists to help users manage their plugins. Use 'plugin list' to list the loaded plugins; use 'plugin help' to get the description of a plugin; use the 'plugin' command itself to determine what plugin a command exists in.""" + @internationalizeDocstring def help(self, irc, msg, args, cb): """ @@ -51,9 +55,10 @@ class Plugin(callbacks.Plugin): if doc: irc.reply(utils.str.normalizeWhitespace(doc)) else: - irc.reply('That plugin is loaded, but has no plugin help.') + irc.reply(_('That plugin is loaded, but has no plugin help.')) help = wrap(help, ['plugin']) + @internationalizeDocstring def list(self, irc, msg, args): """takes no arguments @@ -64,6 +69,7 @@ class Plugin(callbacks.Plugin): irc.reply(format('%L', L)) list = wrap(list) + @internationalizeDocstring def plugin(self, irc, msg, args, command): """ @@ -80,15 +86,16 @@ class Plugin(callbacks.Plugin): irc.reply(format('%L', L)) else: if len(L) > 1: - plugin = 'plugins' + plugin = _('plugins') else: - plugin = 'plugin' - irc.reply(format('The %q command is available in the %L %s.', - command, L, plugin)) + plugin = _('plugin') + irc.reply(format(_('The %q command is available in the %L ' + '%s.'), command, L, plugin)) else: - irc.error(format('There is no command %q.', command)) + irc.error(format(_('There is no command %q.'), command)) plugin = wrap(plugin, [many('something')]) + @internationalizeDocstring def author(self, irc, msg, args, cb): """ @@ -96,15 +103,16 @@ class Plugin(callbacks.Plugin): if you have ideas, suggestions, or other comments about a given plugin. """ if cb is None: - irc.error('That plugin does not seem to be loaded.') + irc.error(_('That plugin does not seem to be loaded.')) return module = cb.classModule if hasattr(module, '__author__') and module.__author__: irc.reply(str(module.__author__)) else: - irc.reply('That plugin doesn\'t have an author that claims it.') + irc.reply(_('That plugin doesn\'t have an author that claims it.')) author = wrap(author, [('plugin')]) + @internationalizeDocstring def contributors(self, irc, msg, args, cb, nick): """ [] @@ -141,15 +149,15 @@ class Plugin(callbacks.Plugin): Build the list of author + contributors (if any) for the requested plugin. """ - head = 'The %s plugin' % cb.name() - author = 'has not been claimed by an author' - conjunction = 'and' - contrib = 'has no contributors listed.' + head = _('The %s plugin') % cb.name() + author = _('has not been claimed by an author') + conjunction = _('and') + contrib = _('has no contributors listed.') hasAuthor = False hasContribs = False if hasattr(module, '__author__'): if module.__author__ != supybot.authors.unknown: - author = 'was written by %s' % \ + author = _('was written by %s') % \ utils.web.mungeEmail(str(module.__author__)) hasAuthor = True if hasattr(module, '__contributors__'): @@ -160,14 +168,14 @@ class Plugin(callbacks.Plugin): except ValueError: pass if contribs: - contrib = format('%s %h contributed to it.', + contrib = format(_('%s %h contributed to it.'), buildContributorsString(contribs), len(contribs)) hasContribs = True elif hasAuthor: - contrib = 'has no additional contributors listed.' + contrib = _('has no additional contributors listed.') if hasContribs and not hasAuthor: - conjunction = 'but' + conjunction = _('but') return ' '.join([head, author, conjunction, contrib]) def buildPersonString(module): """ @@ -184,39 +192,39 @@ class Plugin(callbacks.Plugin): break authorInfo = authorInfo or getattr(supybot.authors, nick, None) if not authorInfo: - return 'The nick specified (%s) is not a registered ' \ - 'contributor.' % nick + return _('The nick specified (%s) is not a registered ' + 'contributor.') % nick fullName = utils.web.mungeEmail(str(authorInfo)) contributions = [] if hasattr(module, '__contributors__'): if authorInfo not in module.__contributors__: - return 'The %s plugin does not have \'%s\' listed as a ' \ - 'contributor.' % (cb.name(), nick) + return _('The %s plugin does not have \'%s\' listed as a ' + 'contributor.') % (cb.name(), nick) contributions = module.__contributors__[authorInfo] isAuthor = getattr(module, '__author__', False) == authorInfo (nonCommands, commands) = utils.iter.partition(lambda s: ' ' in s, contributions) results = [] if commands: - s = 'command' + s = _('command') if len(commands) > 1: s = utils.str.pluralize(s) - results.append(format('the %L %s', commands, s)) + results.append(format(_('the %L %s'), commands, s)) if nonCommands: - results.append(format('the %L', nonCommands)) + results.append(format(_('the %L'), nonCommands)) if results and isAuthor: return format( - '%s wrote the %s plugin and also contributed %L.', + _('%s wrote the %s plugin and also contributed %L.'), (fullName, cb.name(), results)) elif results and not isAuthor: - return format('%s contributed %L to the %s plugin.', + return format(_('%s contributed %L to the %s plugin.'), fullName, results, cb.name()) elif isAuthor and not results: - return '%s wrote the %s plugin' % (fullName, cb.name()) + return _('%s wrote the %s plugin') % (fullName, cb.name()) # XXX Does this ever actually get reached? else: - return '%s has no listed contributions for the %s plugin.' % \ - (fullName, cb.name()) + return _('%s has no listed contributions for the %s ' + 'plugin.') % (fullName, cb.name()) # First we need to check and see if the requested plugin is loaded module = cb.classModule if not nick: diff --git a/plugins/User/config.py b/plugins/User/config.py index 7cc8b8f24..eb6bea839 100644 --- a/plugins/User/config.py +++ b/plugins/User/config.py @@ -30,6 +30,8 @@ import supybot.conf as conf import supybot.registry as registry +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('User') def configure(advanced): # This will be called by supybot to configure this module. advanced is diff --git a/plugins/User/messages.pot b/plugins/User/messages.pot new file mode 100644 index 000000000..faaf3ad96 --- /dev/null +++ b/plugins/User/messages.pot @@ -0,0 +1,288 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR ORGANIZATION +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2010-10-16 13:50+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:49 +#, docstring +msgid "" +"[--capability=] []\n" +"\n" +" Returns the valid registered usernames matching . If is\n" +" not given, returns all registered usernames.\n" +" " +msgstr "" + +#: plugin.py:80 +msgid "There are no matching registered users." +msgstr "" + +#: plugin.py:82 +msgid "There are no registered users." +msgstr "" + +#: plugin.py:88 +#, docstring +msgid "" +" \n" +"\n" +" Registers with the given password and the current\n" +" hostmask of the person registering. You shouldn't register twice; if\n" +" you're not recognized as a user but you've already registered, use the\n" +" hostmask add command to add another hostmask to your already-registered\n" +" user, or use the identify command to identify just for a session.\n" +" This command (and all other commands that include a password) must be\n" +" sent to the bot privately, not in a channel.\n" +" " +msgstr "" + +#: plugin.py:101 +msgid "That name is already assigned to someone." +msgstr "" + +#: plugin.py:106 +msgid "username" +msgstr "" + +#: plugin.py:107 +msgid "Hostmasks are not valid usernames." +msgstr "" + +#: plugin.py:114 +msgid "Your hostmask is already registered to %s" +msgstr "" + +#: plugin.py:130 +#, docstring +msgid "" +" []\n" +"\n" +" Unregisters from the user database. If the user giving this\n" +" command is an owner user, the password is not necessary.\n" +" " +msgstr "" + +#: plugin.py:145 +msgid "This command has been disabled. You'll have to ask the owner of this bot to unregister your user." +msgstr "" + +#: plugin.py:158 +#, docstring +msgid "" +" []\n" +"\n" +" Changes your current user database name to the new name given.\n" +" is only necessary if the user isn't recognized by hostmask.\n" +" This message must be sent to the bot privately (not on a channel) since\n" +" it may contain a password.\n" +" " +msgstr "" + +#: plugin.py:167 +msgid "%q is already registered." +msgstr "" + +#: plugin.py:181 +#, docstring +msgid "" +"[] \n" +"\n" +" Sets the new password for the user specified by to . Obviously this message must be sent to the bot\n" +" privately (not in a channel). If the requesting user is an owner\n" +" user (and the user whose password is being changed isn't that same\n" +" owner user), then needn't be correct.\n" +" " +msgstr "" + +#: plugin.py:209 +#, docstring +msgid "" +" []\n" +"\n" +" Sets the secure flag on the user of the person sending the message.\n" +" Requires that the person's hostmask be in the list of hostmasks for\n" +" that user in addition to the password being correct. When the\n" +" secure flag is set, the user *must* identify before he can be\n" +" recognized. If a specific True/False value is not given, it\n" +" inverts the current value.\n" +" " +msgstr "" + +#: plugin.py:224 +msgid "Secure flag set to %s" +msgstr "" + +#: plugin.py:232 +#, docstring +msgid "" +"\n" +"\n" +" Returns the username of the user specified by or if\n" +" the user is registered.\n" +" " +msgstr "" + +#: plugin.py:241 +msgid "I haven't seen %s." +msgstr "" + +#: plugin.py:246 +msgid "I don't know who that is." +msgstr "" + +#: plugin.py:252 +#, docstring +msgid "" +"[]\n" +"\n" +" Returns the hostmask of . If isn't given, return the\n" +" hostmask of the person giving the command.\n" +" " +msgstr "" + +#: plugin.py:264 +#, docstring +msgid "" +"[]\n" +"\n" +" Returns the hostmasks of the user specified by ; if \n" +" isn't specified, returns the hostmasks of the user calling the\n" +" command.\n" +" " +msgstr "" + +#: plugin.py:276 +msgid "%s has no registered hostmasks." +msgstr "" + +#: plugin.py:283 +msgid "You may only retrieve your own (hostmasks." +msgstr "" + +#: plugin.py:299 +#, docstring +msgid "" +"[] [] []\n" +"\n" +" Adds the hostmask to the user specified by . The\n" +" may only be required if the user is not recognized by\n" +" hostmask. is also not required if an owner user is\n" +" giving the command on behalf of some other user. If is\n" +" not given, it defaults to your current hostmask. If is not\n" +" given, it defaults to your currently identified name. This message\n" +" must be sent to the bot privately (not on a channel) since it may\n" +" contain a password.\n" +" " +msgstr "" + +#: plugin.py:313 +msgid "hostmask" +msgstr "" + +#: plugin.py:314 +msgid "Make sure your hostmask includes a nick, then an exclamation point (!), then a user, then an at symbol (@), then a host. Feel free to use wildcards (* and ?, which work just like they do on the command line) in any of these parts." +msgstr "" + +#: plugin.py:324 plugin.py:347 +msgid "That hostmask is already registered." +msgstr "" + +#: plugin.py:355 +#, docstring +msgid "" +" []\n" +"\n" +" Removes the hostmask from the record of the user\n" +" specified by . If the hostmask given is 'all' then all\n" +" hostmasks will be removed. The may only be required if\n" +" the user is not recognized by his hostmask. This message must be\n" +" sent to the bot privately (not on a channel) since it may contain a\n" +" password.\n" +" " +msgstr "" + +#: plugin.py:374 +msgid "All hostmasks removed." +msgstr "" + +#: plugin.py:378 +msgid "There was no such hostmask." +msgstr "" + +#: plugin.py:387 +#, docstring +msgid "" +"[]\n" +"\n" +" Returns the capabilities of the user specified by ; if \n" +" isn't specified, returns the capabilities of the user calling the\n" +" command.\n" +" " +msgstr "" + +#: plugin.py:407 +#, docstring +msgid "" +" \n" +"\n" +" Identifies the user as . This command (and all other\n" +" commands that include a password) must be sent to the bot privately,\n" +" not in a channel.\n" +" " +msgstr "" + +#: plugin.py:419 +msgid "Your secure flag is true and your hostmask doesn't match any of your known hostmasks." +msgstr "" + +#: plugin.py:429 +#, docstring +msgid "" +"takes no arguments\n" +"\n" +" Un-identifies you. Note that this may not result in the desired\n" +" effect of causing the bot not to recognize you anymore, since you may\n" +" have added hostmasks to your user that can cause the bot to continue to\n" +" recognize you.\n" +" " +msgstr "" + +#: plugin.py:447 +#, docstring +msgid "" +"takes no arguments\n" +"\n" +" Returns the name of the user calling the command.\n" +" " +msgstr "" + +#: plugin.py:455 +msgid "I don't recognize you." +msgstr "" + +#: plugin.py:460 +#, docstring +msgid "" +"takes no arguments\n" +"\n" +" Returns some statistics on the user database.\n" +" " +msgstr "" + +#: plugin.py:478 +msgid "I have %s registered users with %s registered hostmasks; %n and %n." +msgstr "" + diff --git a/plugins/User/plugin.py b/plugins/User/plugin.py index e9eddc3b6..f949ac14a 100644 --- a/plugins/User/plugin.py +++ b/plugins/User/plugin.py @@ -36,12 +36,15 @@ import supybot.ircdb as ircdb from supybot.commands import * import supybot.ircutils as ircutils import supybot.callbacks as callbacks +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('User') class User(callbacks.Plugin): def _checkNotChannel(self, irc, msg, password=' '): if password and irc.isChannel(msg.args[0]): raise callbacks.Error, conf.supybot.replies.requiresPrivacy() + @internationalizeDocstring def list(self, irc, msg, args, optlist, glob): """[--capability=] [] @@ -74,12 +77,13 @@ class User(callbacks.Plugin): irc.reply(format('%L', users)) else: if predicates: - irc.reply('There are no matching registered users.') + irc.reply(_('There are no matching registered users.')) else: - irc.reply('There are no registered users.') + irc.reply(_('There are no registered users.')) list = wrap(list, [getopts({'capability':'capability'}), additional('glob')]) + @internationalizeDocstring def register(self, irc, msg, args, name, password): """ @@ -94,18 +98,21 @@ class User(callbacks.Plugin): addHostmask = True try: ircdb.users.getUserId(name) - irc.error('That name is already assigned to someone.', Raise=True) + irc.error(_('That name is already assigned to someone.'), + Raise=True) except KeyError: pass if ircutils.isUserHostmask(name): - irc.errorInvalid('username', name, - 'Hostmasks are not valid usernames.', Raise=True) + irc.errorInvalid(_('username'), name, + _('Hostmasks are not valid usernames.'), + Raise=True) try: u = ircdb.users.getUser(msg.prefix) if u._checkCapability('owner'): addHostmask = False else: - irc.error('Your hostmask is already registered to %s' % u.name) + irc.error(_('Your hostmask is already registered to %s') % + u.name) return except KeyError: pass @@ -118,6 +125,7 @@ class User(callbacks.Plugin): irc.replySuccess() register = wrap(register, ['private', 'something', 'something']) + @internationalizeDocstring def unregister(self, irc, msg, args, user, password): """ [] @@ -134,9 +142,9 @@ class User(callbacks.Plugin): if not caller or not isOwner: self.log.warning('%s tried to unregister user %s.', msg.prefix, user.name) - irc.error('This command has been disabled. You\'ll have to ' - 'ask the owner of this bot to unregister your user.', - Raise=True) + irc.error(_('This command has been disabled. You\'ll have to ' + 'ask the owner of this bot to unregister your ' + 'user.'), Raise=True) if isOwner or user.checkPassword(password): ircdb.users.delUser(user.id) irc.replySuccess() @@ -145,6 +153,7 @@ class User(callbacks.Plugin): unregister = wrap(unregister, ['private', 'otherUser', additional('anything')]) + @internationalizeDocstring def changename(self, irc, msg, args, user, newname, password): """ [] @@ -155,7 +164,7 @@ class User(callbacks.Plugin): """ try: id = ircdb.users.getUserId(newname) - irc.error(format('%q is already registered.', newname)) + irc.error(format(_('%q is already registered.'), newname)) return except KeyError: pass @@ -167,6 +176,7 @@ class User(callbacks.Plugin): additional('something', '')]) class set(callbacks.Commands): + @internationalizeDocstring def password(self, irc, msg, args, user, password, newpassword): """[] @@ -194,6 +204,7 @@ class User(callbacks.Plugin): password = wrap(password, ['private', optional('otherUser'), 'something', 'something']) + @internationalizeDocstring def secure(self, irc, msg, args, user, password, value): """ [] @@ -210,12 +221,13 @@ class User(callbacks.Plugin): user.checkHostmask(msg.prefix, useAuth=False): user.secure = value ircdb.users.setUser(user) - irc.reply('Secure flag set to %s' % value) + irc.reply(_('Secure flag set to %s') % value) else: irc.error(conf.supybot.replies.incorrectAuthentication()) secure = wrap(secure, ['private', 'user', 'something', additional('boolean')]) + @internationalizeDocstring def username(self, irc, msg, args, hostmask): """ @@ -226,15 +238,16 @@ class User(callbacks.Plugin): try: hostmask = irc.state.nickToHostmask(hostmask) except KeyError: - irc.error('I haven\'t seen %s.' % hostmask, Raise=True) + irc.error(_('I haven\'t seen %s.') % hostmask, Raise=True) try: user = ircdb.users.getUser(hostmask) irc.reply(user.name) except KeyError: - irc.error('I don\'t know who that is.') + irc.error(_('I don\'t know who that is.')) username = wrap(username, [first('nick', 'hostmask')]) class hostmask(callbacks.Commands): + @internationalizeDocstring def hostmask(self, irc, msg, args, nick): """[] @@ -246,6 +259,7 @@ class User(callbacks.Plugin): irc.reply(irc.state.nickToHostmask(nick)) hostmask = wrap(hostmask, [additional('seenNick')]) + @internationalizeDocstring def list(self, irc, msg, args, name): """[] @@ -259,14 +273,15 @@ class User(callbacks.Plugin): hostmasks.sort() return format('%L', hostmasks) else: - return format('%s has no registered hostmasks.', user.name) + return format(_('%s has no registered hostmasks.'), + user.name) try: user = ircdb.users.getUser(msg.prefix) if name: if name != user.name and \ not ircdb.checkCapability(msg.prefix, 'owner'): - irc.error('You may only retrieve your own hostmasks.', - Raise=True) + irc.error(_('You may only retrieve your own ' + '(hostmasks.'), Raise=True) else: try: user = ircdb.users.getUser(name) @@ -279,6 +294,7 @@ class User(callbacks.Plugin): irc.errorNotRegistered() list = wrap(list, ['private', additional('something')]) + @internationalizeDocstring def add(self, irc, msg, args, user, hostmask, password): """[] [] [] @@ -294,18 +310,18 @@ class User(callbacks.Plugin): if not hostmask: hostmask = msg.prefix if not ircutils.isUserHostmask(hostmask): - irc.errorInvalid('hostmask', hostmask, - 'Make sure your hostmask includes a nick, ' + irc.errorInvalid(_('hostmask'), hostmask, + _('Make sure your hostmask includes a nick, ' 'then an exclamation point (!), then a user, ' 'then an at symbol (@), then a host. Feel ' 'free to use wildcards (* and ?, which work ' 'just like they do on the command line) in ' - 'any of these parts.', + 'any of these parts.'), Raise=True) try: otherId = ircdb.users.getUserId(hostmask) if otherId != user.id: - irc.error('That hostmask is already registered.', + irc.error(_('That hostmask is already registered.'), Raise=True) except KeyError: pass @@ -328,11 +344,13 @@ class User(callbacks.Plugin): except ValueError, e: irc.error(str(e), Raise=True) except ircdb.DuplicateHostmask: - irc.error('That hostmask is already registered.', Raise=True) + irc.error(_('That hostmask is already registered.'), + Raise=True) irc.replySuccess() add = wrap(add, ['private', first('otherUser', 'user'), optional('something'), additional('something', '')]) + @internationalizeDocstring def remove(self, irc, msg, args, user, hostmask, password): """ [] @@ -353,17 +371,18 @@ class User(callbacks.Plugin): s = '' if hostmask == 'all': user.hostmasks.clear() - s = 'All hostmasks removed.' + s = _('All hostmasks removed.') else: user.removeHostmask(hostmask) except KeyError: - irc.error('There was no such hostmask.') + irc.error(_('There was no such hostmask.')) return ircdb.users.setUser(user) irc.replySuccess(s) remove = wrap(remove, ['private', 'otherUser', 'something', additional('something', '')]) + @internationalizeDocstring def capabilities(self, irc, msg, args, user): """[] @@ -383,6 +402,7 @@ class User(callbacks.Plugin): Raise=True) capabilities = wrap(capabilities, [first('otherUser', 'user')]) + @internationalizeDocstring def identify(self, irc, msg, args, user, password): """ @@ -396,14 +416,15 @@ class User(callbacks.Plugin): ircdb.users.setUser(user, flush=False) irc.replySuccess() except ValueError: - irc.error('Your secure flag is true and your hostmask ' - 'doesn\'t match any of your known hostmasks.') + irc.error(_('Your secure flag is true and your hostmask ' + 'doesn\'t match any of your known hostmasks.')) else: self.log.warning('Failed identification attempt by %s (password ' 'did not match for %s).', msg.prefix, user.name) irc.error(conf.supybot.replies.incorrectAuthentication()) identify = wrap(identify, ['private', 'otherUser', 'something']) + @internationalizeDocstring def unidentify(self, irc, msg, args, user): """takes no arguments @@ -421,6 +442,7 @@ class User(callbacks.Plugin): 'recognized.') unidentify = wrap(unidentify, ['user']) + @internationalizeDocstring def whoami(self, irc, msg, args): """takes no arguments @@ -430,9 +452,10 @@ class User(callbacks.Plugin): user = ircdb.users.getUser(msg.prefix) irc.reply(user.name) except KeyError: - irc.reply('I don\'t recognize you.') + irc.reply(_('I don\'t recognize you.')) whoami = wrap(whoami) + @internationalizeDocstring def stats(self, irc, msg, args): """takes no arguments @@ -452,9 +475,9 @@ class User(callbacks.Plugin): admins += 1 except KeyError: pass - irc.reply(format('I have %s registered users ' + irc.reply(format(_('I have %s registered users ' 'with %s registered hostmasks; ' - '%n and %n.', + '%n and %n.'), users, hostmasks, (owners, 'owner'), (admins, 'admin'))) stats = wrap(stats) From ca23f946e5f259c24b3a94a9ef7a2cd3bfdd2d0b Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Sat, 16 Oct 2010 18:54:18 +0200 Subject: [PATCH 03/10] Internationalize Alias, Anonymous, AutoMode, and BadWord --- plugins/Alias/config.py | 2 + plugins/Alias/messages.pot | 87 ++++++++++++++++++++++++++ plugins/Alias/plugin.py | 16 +++-- plugins/Anonymous/config.py | 22 ++++--- plugins/Anonymous/messages.pot | 79 +++++++++++++++++++++++ plugins/Anonymous/plugin.py | 5 ++ plugins/AutoMode/config.py | 35 ++++++----- plugins/AutoMode/messages.pot | 69 +++++++++++++++++++++ plugins/AutoMode/plugin.py | 2 + plugins/BadWords/config.py | 41 ++++++------ plugins/BadWords/messages.pot | 110 +++++++++++++++++++++++++++++++++ plugins/BadWords/plugin.py | 7 ++- 12 files changed, 425 insertions(+), 50 deletions(-) create mode 100644 plugins/Alias/messages.pot create mode 100644 plugins/Anonymous/messages.pot create mode 100644 plugins/AutoMode/messages.pot create mode 100644 plugins/BadWords/messages.pot diff --git a/plugins/Alias/config.py b/plugins/Alias/config.py index c83c30a58..4d37ed6a5 100644 --- a/plugins/Alias/config.py +++ b/plugins/Alias/config.py @@ -29,6 +29,8 @@ import supybot.conf as conf import supybot.registry as registry +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('Alias') def configure(advanced): # This will be called by supybot to configure this module. advanced is diff --git a/plugins/Alias/messages.pot b/plugins/Alias/messages.pot new file mode 100644 index 000000000..ab8d0ac06 --- /dev/null +++ b/plugins/Alias/messages.pot @@ -0,0 +1,87 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR ORGANIZATION +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2010-10-16 14:10+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:45 +#, docstring +msgid "" +"Returns the channel the msg came over or the channel given in args.\n" +"\n" +" If the channel was given in args, args is modified (the channel is\n" +" removed).\n" +" " +msgstr "" + +#: plugin.py:164 +msgid " at least" +msgstr "" + +#: plugin.py:165 +msgid "" +"\n" +"\n" +"Alias for %q." +msgstr "" + +#: plugin.py:220 +#, docstring +msgid "" +"\n" +"\n" +" Locks an alias so that no one else can change it.\n" +" " +msgstr "" + +#: plugin.py:229 plugin.py:243 +msgid "There is no such alias." +msgstr "" + +#: plugin.py:234 +#, docstring +msgid "" +"\n" +"\n" +" Unlocks an alias so that people can define new aliases over it.\n" +" " +msgstr "" + +#: plugin.py:254 +msgid "That name isn't valid. Try %q instead." +msgstr "" + +#: plugin.py:292 +#, docstring +msgid "" +" \n" +"\n" +" Defines an alias that executes . The \n" +" should be in the standard \"command argument [nestedcommand argument]\"\n" +" arguments to the alias; they'll be filled with the first, second, etc.\n" +" arguments. $1, $2, etc. can be used for required arguments. @1, @2,\n" +" etc. can be used for optional arguments. $* simply means \"all\n" +" remaining arguments,\" and cannot be combined with optional arguments.\n" +" " +msgstr "" + +#: plugin.py:315 +#, docstring +msgid "" +"\n" +"\n" +" Removes the given alias, if unlocked.\n" +" " +msgstr "" + diff --git a/plugins/Alias/plugin.py b/plugins/Alias/plugin.py index f90eb29cf..d43f22b4f 100644 --- a/plugins/Alias/plugin.py +++ b/plugins/Alias/plugin.py @@ -37,6 +37,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('Alias') # Copied from the old privmsgs.py. def getChannel(msg, args=()): @@ -159,8 +161,8 @@ def makeNewAlias(name, alias): self.Proxy(irc, msg, tokens) flexargs = '' if biggestDollar and (wildcard or biggestAt): - flexargs = ' at least' - doc =format('\n\nAlias for %q.', + flexargs = _(' at least') + doc =format(_('\n\nAlias for %q.'), flexargs, (biggestDollar, 'argument'), alias) f = utils.python.changeFunctionName(f, name, doc) return f @@ -213,6 +215,7 @@ class Alias(callbacks.Plugin): except AttributeError: return self.aliases[command[0]][2] + @internationalizeDocstring def lock(self, irc, msg, args, name): """ @@ -223,9 +226,10 @@ class Alias(callbacks.Plugin): conf.supybot.plugins.Alias.aliases.get(name).locked.setValue(True) irc.replySuccess() else: - irc.error('There is no such alias.') + irc.error(_('There is no such alias.')) lock = wrap(lock, [('checkCapability', 'admin'), 'commandName']) + @internationalizeDocstring def unlock(self, irc, msg, args, name): """ @@ -236,7 +240,7 @@ class Alias(callbacks.Plugin): conf.supybot.plugins.Alias.aliases.get(name).locked.setValue(False) irc.replySuccess() else: - irc.error('There is no such alias.') + irc.error(_('There is no such alias.')) unlock = wrap(unlock, [('checkCapability', 'admin'), 'commandName']) _invalidCharsRe = re.compile(r'[\[\]\s]') @@ -247,7 +251,7 @@ class Alias(callbacks.Plugin): raise AliasError, 'Names cannot contain pipes.' realName = callbacks.canonicalName(name) if name != realName: - s = format('That name isn\'t valid. Try %q instead.', realName) + s = format(_('That name isn\'t valid. Try %q instead.'), realName) raise AliasError, s name = realName if self.isCommandMethod(name): @@ -283,6 +287,7 @@ class Alias(callbacks.Plugin): else: raise AliasError, 'There is no such alias.' + @internationalizeDocstring def add(self, irc, msg, args, name, alias): """ @@ -305,6 +310,7 @@ class Alias(callbacks.Plugin): irc.error(str(e)) add = wrap(add, ['commandName', 'text']) + @internationalizeDocstring def remove(self, irc, msg, args, name): """ diff --git a/plugins/Anonymous/config.py b/plugins/Anonymous/config.py index 6fbd75829..51e6ba70b 100644 --- a/plugins/Anonymous/config.py +++ b/plugins/Anonymous/config.py @@ -29,6 +29,8 @@ import supybot.conf as conf import supybot.registry as registry +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('Anonymous') def configure(advanced): # This will be called by supybot to configure this module. advanced is @@ -44,20 +46,20 @@ Anonymous = conf.registerPlugin('Anonymous') # conf.registerGlobalValue(Anonymous, 'someConfigVariableName', # registry.Boolean(False, """Help for someConfigVariableName.""")) conf.registerChannelValue(conf.supybot.plugins.Anonymous, - 'requirePresenceInChannel', registry.Boolean(True, """Determines whether + 'requirePresenceInChannel', registry.Boolean(True, _("""Determines whether the bot should require people trying to use this plugin to be in the - channel they wish to anonymously send to.""")) + channel they wish to anonymously send to."""))) conf.registerGlobalValue(conf.supybot.plugins.Anonymous, 'requireRegistration', - registry.Boolean(True, """Determines whether the bot should require people - trying to use this plugin to be registered.""")) + registry.Boolean(True, _("""Determines whether the bot should require + people trying to use this plugin to be registered."""))) conf.registerGlobalValue(conf.supybot.plugins.Anonymous, 'requireCapability', - registry.String('', """Determines what capability (if any) the bot should - require people trying to use this plugin to have.""")) + registry.String('', _("""Determines what capability (if any) the bot should + require people trying to use this plugin to have."""))) conf.registerGlobalValue(conf.supybot.plugins.Anonymous, 'allowPrivateTarget', - registry.Boolean(False, """Determines whether the bot will require targets - of the "say" command to be public (i.e., channels). If this is True, the - bot will allow people to use the "say" command to send private messages to - other users.""")) + registry.Boolean(False, _("""Determines whether the bot will require + targets of the "say" command to be public (i.e., channels). If this is + True, the bot will allow people to use the "say" command to send private + messages to other users."""))) # vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: diff --git a/plugins/Anonymous/messages.pot b/plugins/Anonymous/messages.pot new file mode 100644 index 000000000..53bc52bb4 --- /dev/null +++ b/plugins/Anonymous/messages.pot @@ -0,0 +1,79 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR ORGANIZATION +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2010-10-16 15:14+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\n" +" the bot should require people trying to use this plugin to be in the\n" +" channel they wish to anonymously send to." +msgstr "" + +#: config.py:53 +msgid "" +"Determines whether the bot should require\n" +" people trying to use this plugin to be registered." +msgstr "" + +#: config.py:56 +msgid "" +"Determines what capability (if any) the bot should\n" +" require people trying to use this plugin to have." +msgstr "" + +#: config.py:59 +msgid "" +"Determines whether the bot will require \n" +" targets of the \"say\" command to be public (i.e., channels). If this is\n" +" True, the bot will allow people to use the \"say\" command to send private\n" +" messages to other users." +msgstr "" + +#: plugin.py:41 +#, docstring +msgid "" +"This plugin allows users to act through the bot anonymously. The 'do'\n" +" command has the bot perform an anonymous action in a given channel, and\n" +" the 'say' command allows other people to speak through the bot. Since\n" +" this can be fairly well abused, you might want to set\n" +" supybot.plugins.Anonymous.requireCapability so only users with that\n" +" capability can use this plugin. For extra security, you can require that\n" +" the user be *in* the channel they are trying to address anonymously with\n" +" supybot.plugins.Anonymous.requirePresenceInChannel, or you can require\n" +" that the user be registered by setting\n" +" supybot.plugins.Anonymous.requireRegistration.\n" +" " +msgstr "" + +#: plugin.py:81 +#, docstring +msgid "" +" \n" +"\n" +" Sends to . Can only send to if\n" +" supybot.plugins.Anonymous.allowPrivateTarget is True.\n" +" " +msgstr "" + +#: plugin.py:95 +#, docstring +msgid "" +" \n" +"\n" +" Performs in .\n" +" " +msgstr "" + diff --git a/plugins/Anonymous/plugin.py b/plugins/Anonymous/plugin.py index 9eb95260d..4588ee451 100644 --- a/plugins/Anonymous/plugin.py +++ b/plugins/Anonymous/plugin.py @@ -33,7 +33,10 @@ import supybot.utils as utils from supybot.commands import * import supybot.ircmsgs as ircmsgs import supybot.callbacks as callbacks +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('Anonymous') +@internationalizeDocstring class Anonymous(callbacks.Plugin): """This plugin allows users to act through the bot anonymously. The 'do' command has the bot perform an anonymous action in a given channel, and @@ -73,6 +76,7 @@ class Anonymous(callbacks.Plugin): action), Raise=True) + @internationalizeDocstring def say(self, irc, msg, args, target, text): """ @@ -86,6 +90,7 @@ class Anonymous(callbacks.Plugin): irc.noReply() say = wrap(say, [first('nick', 'inChannel'), 'text']) + @internationalizeDocstring def do(self, irc, msg, args, channel, text): """ diff --git a/plugins/AutoMode/config.py b/plugins/AutoMode/config.py index 98f61349f..052bed457 100644 --- a/plugins/AutoMode/config.py +++ b/plugins/AutoMode/config.py @@ -29,6 +29,8 @@ import supybot.conf as conf import supybot.registry as registry +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('AutoMode') def configure(advanced): # This will be called by supybot to configure this module. advanced is @@ -41,30 +43,33 @@ def configure(advanced): AutoMode = conf.registerPlugin('AutoMode') conf.registerChannelValue(AutoMode, 'enable', - registry.Boolean(True, """Determines whether this plugin is enabled.""")) + registry.Boolean(True, _("""Determines whether this plugin is enabled. + """))) conf.registerGlobalValue(AutoMode, 'owner', - registry.Boolean(True, """Determines whether this plugin will automode owners.""")) + registry.Boolean(True, _("""Determines whether this plugin will automode + owners."""))) conf.registerChannelValue(AutoMode, 'fallthrough', - registry.Boolean(False, """Determines whether the bot will "fall through" to - halfop/voicing when auto-opping is turned off but auto-halfopping/voicing - are turned on.""")) + registry.Boolean(False, _("""Determines whether the bot will "fall through + to halfop/voicing when auto-opping is turned off but + auto-halfopping/voicing are turned on."""))) conf.registerChannelValue(AutoMode, 'op', - registry.Boolean(True, """Determines whether the bot will automatically op - people with the ,op capability when they join the channel.""")) + registry.Boolean(True, _("""Determines whether the bot will automatically + op people with the ,op capability when they join the channel. + """))) conf.registerChannelValue(AutoMode, 'halfop', - registry.Boolean(True, """Determines whether the bot will automatically + registry.Boolean(True, _("""Determines whether the bot will automatically halfop people with the ,halfop capability when they join the - channel.""")) + channel."""))) conf.registerChannelValue(AutoMode, 'voice', - registry.Boolean(True, """Determines whether the bot will automatically + registry.Boolean(True, _("""Determines whether the bot will automatically voice people with the ,voice capability when they join the - channel.""")) + channel."""))) conf.registerChannelValue(AutoMode, 'ban', - registry.Boolean(True, """Determines whether the bot will automatically ban - people who join the channel and are on the banlist.""")) + registry.Boolean(True, _("""Determines whether the bot will automatically + ban people who join the channel and are on the banlist."""))) conf.registerChannelValue(AutoMode.ban, 'period', - registry.PositiveInteger(86400, """Determines how many seconds the bot will - automatically ban a person when banning.""")) + registry.PositiveInteger(86400, _("""Determines how many seconds the bot + will automatically ban a person when banning."""))) diff --git a/plugins/AutoMode/messages.pot b/plugins/AutoMode/messages.pot new file mode 100644 index 000000000..d1330c69b --- /dev/null +++ b/plugins/AutoMode/messages.pot @@ -0,0 +1,69 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR ORGANIZATION +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2010-10-16 18:48+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 this plugin is enabled.\n" +" " +msgstr "" + +#: config.py:49 +msgid "" +"Determines whether this plugin will automode\n" +" owners." +msgstr "" + +#: config.py:52 +msgid "" +"Determines whether the bot will \"fall through\n" +" to halfop/voicing when auto-opping is turned off but\n" +" auto-halfopping/voicing are turned on." +msgstr "" + +#: config.py:56 +msgid "" +"Determines whether the bot will automatically\n" +" op people with the ,op capability when they join the channel.\n" +" " +msgstr "" + +#: config.py:60 +msgid "" +"Determines whether the bot will automatically\n" +" halfop people with the ,halfop capability when they join the\n" +" channel." +msgstr "" + +#: config.py:64 +msgid "" +"Determines whether the bot will automatically\n" +" voice people with the ,voice capability when they join the\n" +" channel." +msgstr "" + +#: config.py:68 +msgid "" +"Determines whether the bot will automatically\n" +" ban people who join the channel and are on the banlist." +msgstr "" + +#: config.py:71 +msgid "" +"Determines how many seconds the bot\n" +" will automatically ban a person when banning." +msgstr "" + diff --git a/plugins/AutoMode/plugin.py b/plugins/AutoMode/plugin.py index 8c7fd1a69..73f1a64bb 100644 --- a/plugins/AutoMode/plugin.py +++ b/plugins/AutoMode/plugin.py @@ -35,6 +35,8 @@ 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('AutoMode') class Continue(Exception): pass # Used below, look in the "do" function nested in doJoin. diff --git a/plugins/BadWords/config.py b/plugins/BadWords/config.py index d88d0a5f4..a2b130a4a 100644 --- a/plugins/BadWords/config.py +++ b/plugins/BadWords/config.py @@ -31,12 +31,15 @@ import time import supybot.conf as conf import supybot.registry as registry +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('BadWords') def configure(advanced): from supybot.questions import output, expect, anything, something, yn conf.registerPlugin('BadWords', True) - if yn('Would you like to add some bad words?'): - words = anything('What words? (separate individual words by spaces)') + if yn(_('Would you like to add some bad words?')): + words = anything(_('What words? (separate individual words by ' + 'spaces)')) conf.supybot.plugins.BadWords.words.set(words) class LastModifiedSetOfStrings(registry.SpaceSeparatedSetOfStrings): @@ -47,14 +50,14 @@ class LastModifiedSetOfStrings(registry.SpaceSeparatedSetOfStrings): BadWords = conf.registerPlugin('BadWords') conf.registerGlobalValue(BadWords, 'words', - LastModifiedSetOfStrings([], """Determines what words are - considered to be 'bad' so the bot won't say them.""")) + LastModifiedSetOfStrings([], _("""Determines what words are + considered to be 'bad' so the bot won't say them."""))) conf.registerGlobalValue(BadWords,'requireWordBoundaries', - registry.Boolean(False, """Determines whether the bot will require bad + registry.Boolean(False, _("""Determines whether the bot will require bad words to be independent words, or whether it will censor them within other words. For instance, if 'darn' is a bad word, then if this is true, 'darn' will be censored, but 'darnit' will not. You probably want this to be - false.""")) + false."""))) class String256(registry.String): def __call__(self): @@ -65,39 +68,39 @@ class String256(registry.String): return self.value conf.registerGlobalValue(BadWords, 'nastyChars', - String256('!@#&', """Determines what characters will replace bad words; a + String256('!@#&', _("""Determines what characters will replace bad words; a chunk of these characters matching the size of the replaced bad word will - be used to replace the bad words you've configured.""")) + be used to replace the bad words you've configured."""))) class ReplacementMethods(registry.OnlySomeStrings): validStrings = ('simple', 'nastyCharacters') conf.registerGlobalValue(BadWords, 'replaceMethod', - ReplacementMethods('nastyCharacters', """Determines the manner in which + ReplacementMethods('nastyCharacters', _("""Determines the manner in which bad words will be replaced. 'nastyCharacters' (the default) will replace a bad word with the same number of 'nasty characters' (like those used in comic books; configurable by supybot.plugins.BadWords.nastyChars). 'simple' will replace a bad word with a simple strings (regardless of the length of the bad word); this string is configurable via - supybot.plugins.BadWords.simpleReplacement.""")) + supybot.plugins.BadWords.simpleReplacement."""))) conf.registerGlobalValue(BadWords,'simpleReplacement', - registry.String('[CENSORED]', """Determines what word will replace bad - words if the replacement method is 'simple'.""")) + registry.String('[CENSORED]', _("""Determines what word will replace bad + words if the replacement method is 'simple'."""))) conf.registerGlobalValue(BadWords, 'stripFormatting', - registry.Boolean(True, """Determines whether the bot will strip + registry.Boolean(True, _("""Determines whether the bot will strip formatting characters from messages before it checks them for bad words. If this is False, it will be relatively trivial to circumvent this plugin's filtering. If it's True, however, it will interact poorly with other - plugins that do coloring or bolding of text.""")) + plugins that do coloring or bolding of text."""))) conf.registerChannelValue(BadWords, 'kick', - registry.Boolean(False, """Determines whether the bot will kick people with - a warning when they use bad words.""")) + registry.Boolean(False, _("""Determines whether the bot will kick people with + a warning when they use bad words."""))) conf.registerChannelValue(BadWords.kick, 'message', - registry.NormalizedString("""You have been kicked for using a word + registry.NormalizedString(_("""You have been kicked for using a word prohibited in the presence of this bot. Please use more appropriate - language in the future.""", """Determines the kick message used by the bot - when kicking users for saying bad words.""")) + language in the future."""), _("""Determines the kick message used by the + bot when kicking users for saying bad words."""))) # vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: diff --git a/plugins/BadWords/messages.pot b/plugins/BadWords/messages.pot new file mode 100644 index 000000000..8363e3e24 --- /dev/null +++ b/plugins/BadWords/messages.pot @@ -0,0 +1,110 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR ORGANIZATION +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2010-10-16 18:51+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:40 +msgid "Would you like to add some bad words?" +msgstr "" + +#: config.py:41 +msgid "What words? (separate individual words by spaces)" +msgstr "" + +#: config.py:53 +msgid "" +"Determines what words are\n" +" considered to be 'bad' so the bot won't say them." +msgstr "" + +#: config.py:56 +msgid "" +"Determines whether the bot will require bad\n" +" words to be independent words, or whether it will censor them within other\n" +" words. For instance, if 'darn' is a bad word, then if this is true, 'darn'\n" +" will be censored, but 'darnit' will not. You probably want this to be\n" +" false." +msgstr "" + +#: config.py:71 +msgid "" +"Determines what characters will replace bad words; a\n" +" chunk of these characters matching the size of the replaced bad word will\n" +" be used to replace the bad words you've configured." +msgstr "" + +#: config.py:79 +msgid "" +"Determines the manner in which\n" +" bad words will be replaced. 'nastyCharacters' (the default) will replace a\n" +" bad word with the same number of 'nasty characters' (like those used in\n" +" comic books; configurable by supybot.plugins.BadWords.nastyChars).\n" +" 'simple' will replace a bad word with a simple strings (regardless of the\n" +" length of the bad word); this string is configurable via\n" +" supybot.plugins.BadWords.simpleReplacement." +msgstr "" + +#: config.py:87 +msgid "" +"Determines what word will replace bad\n" +" words if the replacement method is 'simple'." +msgstr "" + +#: config.py:90 +msgid "" +"Determines whether the bot will strip\n" +" formatting characters from messages before it checks them for bad words.\n" +" If this is False, it will be relatively trivial to circumvent this plugin's\n" +" filtering. If it's True, however, it will interact poorly with other\n" +" plugins that do coloring or bolding of text." +msgstr "" + +#: config.py:97 +msgid "" +"Determines whether the bot will kick people with\n" +" a warning when they use bad words." +msgstr "" + +#: plugin.py:110 +#, docstring +msgid "" +"takes no arguments\n" +"\n" +" Returns the list of words being censored.\n" +" " +msgstr "" + +#: plugin.py:120 +msgid "I'm not currently censoring any bad words." +msgstr "" + +#: plugin.py:125 +#, docstring +msgid "" +" [ ...]\n" +"\n" +" Adds all s to the list of words the bot isn't to say.\n" +" " +msgstr "" + +#: plugin.py:137 +#, docstring +msgid "" +" [ ...]\n" +"\n" +" Removes a s from the list of words the bot isn't to say.\n" +" " +msgstr "" + diff --git a/plugins/BadWords/plugin.py b/plugins/BadWords/plugin.py index e373567a4..5ea306b00 100644 --- a/plugins/BadWords/plugin.py +++ b/plugins/BadWords/plugin.py @@ -39,6 +39,8 @@ import supybot.ircmsgs as ircmsgs from supybot.commands import * import supybot.ircutils as ircutils import supybot.callbacks as callbacks +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('BadWords') class BadWords(callbacks.Privmsg): def __init__(self, irc): @@ -103,6 +105,7 @@ class BadWords(callbacks.Privmsg): s = r'\b%s\b' % s self.regexp = re.compile(s, re.I) + @internationalizeDocstring def list(self, irc, msg, args): """takes no arguments @@ -114,9 +117,10 @@ class BadWords(callbacks.Privmsg): utils.sortBy(str.lower, L) irc.reply(format('%L', L)) else: - irc.reply('I\'m not currently censoring any bad words.') + irc.reply(_('I\'m not currently censoring any bad words.')) list = wrap(list, ['admin']) + @internationalizeDocstring def add(self, irc, msg, args, words): """ [ ...] @@ -128,6 +132,7 @@ class BadWords(callbacks.Privmsg): irc.replySuccess() add = wrap(add, ['admin', many('something')]) + @internationalizeDocstring def remove(self, irc, msg, args, words): """ [ ...] From d14bb0cc166aebedb67bc218e6cf171347733d26 Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Sun, 17 Oct 2010 11:22:07 +0200 Subject: [PATCH 04/10] Internationalize ChannelLogger, Ctcp, Dict, Dunno, Factoids --- plugins/ChannelLogger/config.py | 48 +++---- plugins/ChannelLogger/messages.pot | 97 ++++++++++++++ plugins/ChannelLogger/plugin.py | 2 + plugins/Ctcp/config.py | 2 + plugins/Ctcp/messages.pot | 64 ++++++++++ plugins/Ctcp/plugin.py | 5 +- plugins/Dict/config.py | 14 +- plugins/Dict/messages.pot | 82 ++++++++++++ plugins/Dict/plugin.py | 16 ++- plugins/Dunno/config.py | 6 +- plugins/Dunno/messages.pot | 33 +++++ plugins/Dunno/plugin.py | 3 + plugins/Factoids/config.py | 18 +-- plugins/Factoids/messages.pot | 198 +++++++++++++++++++++++++++++ plugins/Factoids/plugin.py | 46 ++++--- 15 files changed, 571 insertions(+), 63 deletions(-) create mode 100644 plugins/ChannelLogger/messages.pot create mode 100644 plugins/Ctcp/messages.pot create mode 100644 plugins/Dict/messages.pot create mode 100644 plugins/Dunno/messages.pot create mode 100644 plugins/Factoids/messages.pot diff --git a/plugins/ChannelLogger/config.py b/plugins/ChannelLogger/config.py index eae2ac7a4..f9935e4f4 100644 --- a/plugins/ChannelLogger/config.py +++ b/plugins/ChannelLogger/config.py @@ -30,6 +30,8 @@ import supybot.conf as conf import supybot.registry as registry +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('ChannelLogger') def configure(advanced): # This will be called by supybot to configure this module. advanced is @@ -41,50 +43,50 @@ def configure(advanced): ChannelLogger = conf.registerPlugin('ChannelLogger') conf.registerChannelValue(ChannelLogger, 'enable', - registry.Boolean(True, """Determines whether logging is enabled.""")) + registry.Boolean(True, _("""Determines whether logging is enabled."""))) conf.registerGlobalValue(ChannelLogger, 'flushImmediately', - registry.Boolean(False, """Determines whether channel logfiles will be + registry.Boolean(False, _("""Determines whether channel logfiles will be flushed anytime they're written to, rather than being buffered by the - operating system.""")) + operating system."""))) conf.registerChannelValue(ChannelLogger, 'stripFormatting', - registry.Boolean(True, """Determines whether formatting characters (such - as bolding, color, etc.) are removed when writing the logs to disk.""")) + registry.Boolean(True, _("""Determines whether formatting characters (such + as bolding, color, etc.) are removed when writing the logs to disk."""))) conf.registerChannelValue(ChannelLogger, 'timestamp', - registry.Boolean(True, """Determines whether the logs for this channel are - timestamped with the timestamp in supybot.log.timestampFormat.""")) + registry.Boolean(True, _("""Determines whether the logs for this channel are + timestamped with the timestamp in supybot.log.timestampFormat."""))) conf.registerChannelValue(ChannelLogger, 'noLogPrefix', - registry.String('[nolog]', """Determines what string a message should be + registry.String('[nolog]', _("""Determines what string a message should be prefixed with in order not to be logged. If you don't want any such - prefix, just set it to the empty string.""")) + prefix, just set it to the empty string."""))) conf.registerChannelValue(ChannelLogger, 'rotateLogs', - registry.Boolean(False, """Determines whether the bot will automatically + registry.Boolean(False, _("""Determines whether the bot will automatically rotate the logs for this channel. The bot will rotate logs when the timestamp for the log changes. The timestamp is set according to - the 'filenameTimestamp' configuration variable.""")) + the 'filenameTimestamp' configuration variable."""))) conf.registerChannelValue(ChannelLogger, 'filenameTimestamp', - registry.String('%Y-%m-%d', """Determines how to represent the timestamp + registry.String('%Y-%m-%d', _("""Determines how to represent the timestamp used for the filename in rotated logs. When this timestamp changes, the old logfiles will be closed and a new one started. The format characters for the timestamp are in the time.strftime docs at python.org. In order for your logs to be rotated, you'll also have to enable - supybot.plugins.ChannelLogger.rotateLogs.""")) + supybot.plugins.ChannelLogger.rotateLogs."""))) conf.registerGlobalValue(ChannelLogger, 'directories', - registry.Boolean(True, """Determines whether the bot will partition its - channel logs into separate directories based on different criteria.""")) + registry.Boolean(True, _("""Determines whether the bot will partition its + channel logs into separate directories based on different criteria."""))) conf.registerGlobalValue(ChannelLogger.directories, 'network', - registry.Boolean(True, """Determines whether the bot will use a network - directory if using directories.""")) + registry.Boolean(True, _("""Determines whether the bot will use a network + directory if using directories."""))) conf.registerGlobalValue(ChannelLogger.directories, 'channel', - registry.Boolean(True, """Determines whether the bot will use a channel - directory if using directories.""")) + registry.Boolean(True, _("""Determines whether the bot will use a channel + directory if using directories."""))) conf.registerGlobalValue(ChannelLogger.directories, 'timestamp', - registry.Boolean(False, """Determines whether the bot will use a timestamp + registry.Boolean(False, _("""Determines whether the bot will use a timestamp (determined by supybot.plugins.ChannelLogger.directories.timestamp.format) - if using directories.""")) + if using directories."""))) conf.registerGlobalValue(ChannelLogger.directories.timestamp, 'format', - registry.String('%B', """Determines what timestamp format will be used in + registry.String('%B', _("""Determines what timestamp format will be used in the directory stucture for channel logs if - supybot.plugins.ChannelLogger.directories.timestamp is True.""")) + supybot.plugins.ChannelLogger.directories.timestamp is True."""))) # vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: diff --git a/plugins/ChannelLogger/messages.pot b/plugins/ChannelLogger/messages.pot new file mode 100644 index 000000000..57b359a3c --- /dev/null +++ b/plugins/ChannelLogger/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-17 10:02+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 logging is enabled." +msgstr "" + +#: config.py:48 +msgid "" +"Determines whether channel logfiles will be\n" +" flushed anytime they're written to, rather than being buffered by the\n" +" operating system." +msgstr "" + +#: config.py:52 +msgid "" +"Determines whether formatting characters (such\n" +" as bolding, color, etc.) are removed when writing the logs to disk." +msgstr "" + +#: config.py:55 +msgid "" +"Determines whether the logs for this channel are\n" +" timestamped with the timestamp in supybot.log.timestampFormat." +msgstr "" + +#: config.py:58 +msgid "" +"Determines what string a message should be\n" +" prefixed with in order not to be logged. If you don't want any such\n" +" prefix, just set it to the empty string." +msgstr "" + +#: config.py:62 +msgid "" +"Determines whether the bot will automatically\n" +" rotate the logs for this channel. The bot will rotate logs when the\n" +" timestamp for the log changes. The timestamp is set according to\n" +" the 'filenameTimestamp' configuration variable." +msgstr "" + +#: config.py:67 +msgid "" +"Determines how to represent the timestamp\n" +" used for the filename in rotated logs. When this timestamp changes, the\n" +" old logfiles will be closed and a new one started. The format characters\n" +" for the timestamp are in the time.strftime docs at python.org. In order\n" +" for your logs to be rotated, you'll also have to enable\n" +" supybot.plugins.ChannelLogger.rotateLogs." +msgstr "" + +#: config.py:75 +msgid "" +"Determines whether the bot will partition its\n" +" channel logs into separate directories based on different criteria." +msgstr "" + +#: config.py:78 +msgid "" +"Determines whether the bot will use a network\n" +" directory if using directories." +msgstr "" + +#: config.py:81 +msgid "" +"Determines whether the bot will use a channel\n" +" directory if using directories." +msgstr "" + +#: config.py:84 +msgid "" +"Determines whether the bot will use a timestamp\n" +" (determined by supybot.plugins.ChannelLogger.directories.timestamp.format)\n" +" if using directories." +msgstr "" + +#: config.py:88 +msgid "" +"Determines what timestamp format will be used in\n" +" the directory stucture for channel logs if\n" +" supybot.plugins.ChannelLogger.directories.timestamp is True." +msgstr "" + diff --git a/plugins/ChannelLogger/plugin.py b/plugins/ChannelLogger/plugin.py index 93f9b3c06..6296cccbc 100644 --- a/plugins/ChannelLogger/plugin.py +++ b/plugins/ChannelLogger/plugin.py @@ -39,6 +39,8 @@ import supybot.ircmsgs as ircmsgs import supybot.ircutils as ircutils import supybot.registry as registry import supybot.callbacks as callbacks +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('ChannelLogger') class FakeLog(object): def flush(self): diff --git a/plugins/Ctcp/config.py b/plugins/Ctcp/config.py index 3f1f49dc0..8e19f3273 100644 --- a/plugins/Ctcp/config.py +++ b/plugins/Ctcp/config.py @@ -29,6 +29,8 @@ import supybot.conf as conf import supybot.registry as registry +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('Ctcp') def configure(advanced): # This will be called by supybot to configure this module. advanced is diff --git a/plugins/Ctcp/messages.pot b/plugins/Ctcp/messages.pot new file mode 100644 index 000000000..82cf6a28c --- /dev/null +++ b/plugins/Ctcp/messages.pot @@ -0,0 +1,64 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR ORGANIZATION +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2010-10-17 10:16+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:77 +#, docstring +msgid "\001PING ?(.*)\001" +msgstr "" + +#: plugin.py:86 +#, docstring +msgid "\001VERSION\001" +msgstr "" + +#: plugin.py:91 +#, docstring +msgid "\001USERINFO\001" +msgstr "" + +#: plugin.py:96 +#, docstring +msgid "\001TIME\001" +msgstr "" + +#: plugin.py:101 +#, docstring +msgid "\001FINGER\001" +msgstr "" + +#: plugin.py:104 +msgid "FINGER Supybot, the best Python IRC bot in existence!" +msgstr "" + +#: plugin.py:107 +#, docstring +msgid "\001SOURCE\001" +msgstr "" + +#: plugin.py:123 +#, docstring +msgid "" +"[] [--nicks]\n" +"\n" +" Sends a CTCP VERSION to , returning the various\n" +" version strings returned. It waits for 10 seconds before returning\n" +" the versions received at that point. If --nicks is given, nicks are\n" +" associated with the version strings; otherwise, only the version\n" +" strings are given.\n" +" " +msgstr "" + diff --git a/plugins/Ctcp/plugin.py b/plugins/Ctcp/plugin.py index e62404083..fb9b89b03 100644 --- a/plugins/Ctcp/plugin.py +++ b/plugins/Ctcp/plugin.py @@ -36,6 +36,8 @@ 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('Ctcp') class Ctcp(callbacks.PluginRegexp): public = False @@ -99,7 +101,7 @@ class Ctcp(callbacks.PluginRegexp): "\x01FINGER\x01" self.log.info('Received CTCP FINGER from %s', msg.prefix) self._reply(irc, msg, - 'FINGER Supybot, the best Python IRC bot in existence!') + _('FINGER Supybot, the best Python IRC bot in existence!')) def ctcpSource(self, irc, msg, match): "\x01SOURCE\x01" @@ -116,6 +118,7 @@ class Ctcp(callbacks.PluginRegexp): if version == 'VERSION': self.versions.setdefault(payload, []).append(msg.nick) + @internationalizeDocstring def version(self, irc, msg, args, channel, optlist): """[] [--nicks] diff --git a/plugins/Dict/config.py b/plugins/Dict/config.py index d69bd0f28..4ac2452d3 100644 --- a/plugins/Dict/config.py +++ b/plugins/Dict/config.py @@ -29,22 +29,24 @@ import supybot.conf as conf import supybot.registry as registry +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('Dict') def configure(advanced): from supybot.questions import output, expect, anything, something, yn conf.registerPlugin('Dict', True) - output('The default dictd server is dict.org.') - if yn('Would you like to specify a different dictd server?'): + output(_('The default dictd server is dict.org.')) + if yn(_('Would you like to specify a different dictd server?')): server = something('What server?') conf.supybot.plugins.Dict.server.set(server) Dict = conf.registerPlugin('Dict') conf.registerGlobalValue(Dict, 'server', - registry.String('dict.org', """Determines what server the bot will - retrieve definitions from.""")) + registry.String('dict.org', _("""Determines what server the bot will + retrieve definitions from."""))) conf.registerChannelValue(Dict, 'default', - registry.String('', """Determines the default dictionary the bot will + registry.String('', _("""Determines the default dictionary the bot will ask for definitions in. If this value is '*' (without the quotes) the bot - will use all dictionaries to define words.""")) + will use all dictionaries to define words."""))) # vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: diff --git a/plugins/Dict/messages.pot b/plugins/Dict/messages.pot new file mode 100644 index 000000000..86e447f6f --- /dev/null +++ b/plugins/Dict/messages.pot @@ -0,0 +1,82 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR ORGANIZATION +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2010-10-17 10:39+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:38 +msgid "The default dictd server is dict.org." +msgstr "" + +#: config.py:39 +msgid "Would you like to specify a different dictd server?" +msgstr "" + +#: config.py:45 +msgid "" +"Determines what server the bot will\n" +" retrieve definitions from." +msgstr "" + +#: config.py:48 +msgid "" +"Determines the default dictionary the bot will\n" +" ask for definitions in. If this value is '*' (without the quotes) the bot\n" +" will use all dictionaries to define words." +msgstr "" + +#: plugin.py:52 +#, docstring +msgid "" +"takes no arguments\n" +"\n" +" Returns the dictionaries valid for the dict command.\n" +" " +msgstr "" + +#: plugin.py:68 +#, docstring +msgid "" +"takes no arguments\n" +"\n" +" Returns a random valid dictionary.\n" +" " +msgstr "" + +#: plugin.py:83 +#, docstring +msgid "" +"[] \n" +"\n" +" Looks up the definition of on the dictd server specified by\n" +" the supybot.plugins.Dict.server config variable.\n" +" " +msgstr "" + +#: plugin.py:106 +msgid "You must give a word to define." +msgstr "" + +#: plugin.py:112 +msgid "No definition for %q could be found." +msgstr "" + +#: plugin.py:115 +msgid "No definition for %q could be found in %s" +msgstr "" + +#: plugin.py:127 +msgid "%L responded: %s" +msgstr "" + diff --git a/plugins/Dict/plugin.py b/plugins/Dict/plugin.py index 989ee687b..080edd2d5 100644 --- a/plugins/Dict/plugin.py +++ b/plugins/Dict/plugin.py @@ -35,6 +35,8 @@ import supybot.utils as utils from supybot.commands import * import supybot.ircutils as ircutils import supybot.callbacks as callbacks +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('Dict') try: dictclient = utils.python.universalImport('dictclient', 'local.dictclient') @@ -45,6 +47,7 @@ except ImportError: class Dict(callbacks.Plugin): threaded = True + @internationalizeDocstring def dictionaries(self, irc, msg, args): """takes no arguments @@ -60,6 +63,7 @@ class Dict(callbacks.Plugin): irc.error(utils.web.strError(e)) dictionaries = wrap(dictionaries) + @internationalizeDocstring def random(self, irc, msg, args): """takes no arguments @@ -74,6 +78,7 @@ class Dict(callbacks.Plugin): irc.error(utils.web.strError(e)) random = wrap(random) + @internationalizeDocstring def dict(self, irc, msg, args, words): """[] @@ -98,16 +103,17 @@ class Dict(callbacks.Plugin): 'dictionary: %s.', msg.args[0], default) dictionary = '*' if not words: - irc.error('You must give a word to define.', Raise=True) + irc.error(_('You must give a word to define.'), Raise=True) word = ' '.join(words) definitions = conn.define(dictionary, word) dbs = set() if not definitions: if dictionary == '*': - irc.reply(format('No definition for %q could be found.', word)) + irc.reply(format(_('No definition for %q could be found.'), + word)) else: - irc.reply(format('No definition for %q could be found in %s', - word, ircutils.bold(dictionary))) + irc.reply(format(_('No definition for %q could be found in ' + '%s'), word, ircutils.bold(dictionary))) return L = [] for d in definitions: @@ -118,7 +124,7 @@ class Dict(callbacks.Plugin): L.append('%s: %s' % (db, s)) utils.sortBy(len, L) if dictionary == '*' and len(dbs) > 1: - s = format('%L responded: %s', list(dbs), '; '.join(L)) + s = format(_('%L responded: %s'), list(dbs), '; '.join(L)) else: s = '; '.join(L) irc.reply(s) diff --git a/plugins/Dunno/config.py b/plugins/Dunno/config.py index 8288c806b..819d888ce 100644 --- a/plugins/Dunno/config.py +++ b/plugins/Dunno/config.py @@ -29,6 +29,8 @@ import supybot.conf as conf import supybot.registry as registry +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('Dunno') def configure(advanced): # This will be called by supybot to configure this module. advanced is @@ -41,8 +43,8 @@ def configure(advanced): Dunno = conf.registerPlugin('Dunno') conf.registerChannelValue(Dunno, 'prefixNick', - registry.Boolean(True, """Determines whether the bot will prefix the nick - of the user giving an invalid command to the "dunno" response.""")) + registry.Boolean(True, _("""Determines whether the bot will prefix the nick + of the user giving an invalid command to the "dunno" response."""))) # vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: diff --git a/plugins/Dunno/messages.pot b/plugins/Dunno/messages.pot new file mode 100644 index 000000000..96ba98add --- /dev/null +++ b/plugins/Dunno/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-17 10:48+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 bot will prefix the nick\n" +" of the user giving an invalid command to the \"dunno\" response." +msgstr "" + +#: plugin.py:38 +#, 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 'Error: is not a valid command.'\n" +" messages with messages kept in a database, able to give more personable\n" +" responses." +msgstr "" + diff --git a/plugins/Dunno/plugin.py b/plugins/Dunno/plugin.py index 4f2f040de..189f14144 100644 --- a/plugins/Dunno/plugin.py +++ b/plugins/Dunno/plugin.py @@ -30,7 +30,10 @@ from supybot.commands import * import supybot.plugins as plugins import supybot.ircutils as ircutils +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('Dunno') +@internationalizeDocstring class Dunno(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. diff --git a/plugins/Factoids/config.py b/plugins/Factoids/config.py index 79b43b654..6fdce802f 100644 --- a/plugins/Factoids/config.py +++ b/plugins/Factoids/config.py @@ -30,6 +30,8 @@ import supybot.conf as conf import supybot.registry as registry +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('Factoids') def configure(advanced): # This will be called by supybot to configure this module. advanced is @@ -46,22 +48,22 @@ class FactoidFormat(registry.TemplatedString): Factoids = conf.registerPlugin('Factoids') conf.registerChannelValue(Factoids, 'learnSeparator', - registry.String('as', """Determines what separator must be used in the + registry.String('as', _("""Determines what separator must be used in the learn command. Defaults to 'as' -- learn as . Users might feel more comfortable with 'is' or something else, so it's - configurable.""")) + configurable."""))) conf.registerChannelValue(Factoids, 'showFactoidIfOnlyOneMatch', - registry.Boolean(True, """Determines whether the bot will reply with the + registry.Boolean(True, _("""Determines whether the bot will reply with the single matching factoid if only one factoid matches when using the search - command.""")) + command."""))) conf.registerChannelValue(Factoids, 'replyWhenInvalidCommand', - registry.Boolean(True, """Determines whether the bot will reply to invalid + registry.Boolean(True, _("""Determines whether the bot will reply to invalid commands by searching for a factoid; basically making the whatis - unnecessary when you want all factoids for a given key.""")) + unnecessary when you want all factoids for a given key."""))) conf.registerChannelValue(Factoids, 'format', - FactoidFormat('$key could be $value.', """Determines the format of + FactoidFormat('$key could be $value.', _("""Determines the format of the response given when a factoid's value is requested. All the standard substitutes apply, in addition to "$key" for the factoid's key and "$value" - for the factoid's value.""")) + for the factoid's value."""))) # vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: diff --git a/plugins/Factoids/messages.pot b/plugins/Factoids/messages.pot new file mode 100644 index 000000000..2c40af2e8 --- /dev/null +++ b/plugins/Factoids/messages.pot @@ -0,0 +1,198 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR ORGANIZATION +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2010-10-17 10:59+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 +#, docstring +msgid "" +"Value must include $value, otherwise the factoid's value would be left\n" +" out." +msgstr "" + +#: config.py:51 +msgid "" +"Determines what separator must be used in the\n" +" learn command. Defaults to 'as' -- learn as . Users might\n" +" feel more comfortable with 'is' or something else, so it's\n" +" configurable." +msgstr "" + +#: config.py:56 +msgid "" +"Determines whether the bot will reply with the\n" +" single matching factoid if only one factoid matches when using the search\n" +" command." +msgstr "" + +#: config.py:60 +msgid "" +"Determines whether the bot will reply to invalid\n" +" commands by searching for a factoid; basically making the whatis\n" +" unnecessary when you want all factoids for a given key." +msgstr "" + +#: config.py:64 +msgid "" +"Determines the format of\n" +" the response given when a factoid's value is requested. All the standard\n" +" substitutes apply, in addition to \"$key\" for the factoid's key and \"$value\"\n" +" for the factoid's value." +msgstr "" + +#: plugin.py:153 +msgid "" +"[] %s \n" +"\n" +" Associates with . is only\n" +" necessary if the message isn't sent on the channel\n" +" itself. The word '%s' is necessary to separate the\n" +" key from the value. It can be changed to another word\n" +" via the learnSeparator registry value.\n" +" " +msgstr "" + +#: plugin.py:179 +msgid "That's not a valid number for that key." +msgstr "" + +#: plugin.py:199 plugin.py:345 +msgid "No factoid matches that key." +msgstr "" + +#: plugin.py:211 +#, docstring +msgid "" +"[] []\n" +"\n" +" Looks up the value of in the factoid database. If given a\n" +" number, will return only that exact factoid. is only\n" +" necessary if the message isn't sent in the channel itself.\n" +" " +msgstr "" + +#: plugin.py:222 plugin.py:273 plugin.py:384 +msgid "key id" +msgstr "" + +#: plugin.py:230 +#, docstring +msgid "" +"[] \n" +"\n" +" Locks the factoid(s) associated with so that they cannot be\n" +" removed or added to. is only necessary if the message isn't\n" +" sent in the channel itself.\n" +" " +msgstr "" + +#: plugin.py:245 +#, docstring +msgid "" +"[] \n" +"\n" +" Unlocks the factoid(s) associated with so that they can be\n" +" removed or added to. is only necessary if the message isn't\n" +" sent in the channel itself.\n" +" " +msgstr "" + +#: plugin.py:260 +#, docstring +msgid "" +"[] [|*]\n" +"\n" +" Removes the factoid from the factoids database. If there are\n" +" more than one factoid with such a key, a number is necessary to\n" +" determine which one should be removed. A * can be used to remove all\n" +" factoids associated with a key. is only necessary if\n" +" the message isn't sent in the channel itself.\n" +" " +msgstr "" + +#: plugin.py:285 +msgid "There is no such factoid." +msgstr "" + +#: plugin.py:298 +msgid "Invalid factoid number." +msgstr "" + +#: plugin.py:304 +msgid "%s factoids have that key. Please specify which one to remove, or use * to designate all of them." +msgstr "" + +#: plugin.py:312 +#, docstring +msgid "" +"[]\n" +"\n" +" Returns a random factoid from the database for . \n" +" is only necessary if the message isn't sent in the channel itself.\n" +" " +msgstr "" + +#: plugin.py:330 +msgid "I couldn't find a factoid." +msgstr "" + +#: plugin.py:335 +#, docstring +msgid "" +"[] \n" +"\n" +" Gives information about the factoid(s) associated with .\n" +" is only necessary if the message isn't sent in the channel\n" +" itself.\n" +" " +msgstr "" + +#: plugin.py:358 +msgid "#%i was added by %s at %s" +msgstr "" + +#: plugin.py:369 +#, docstring +msgid "" +"[] \n" +"\n" +" Changes the factoid # associated with according to\n" +" .\n" +" " +msgstr "" + +#: plugin.py:381 +msgid "I couldn't find any key %q" +msgstr "" + +#: plugin.py:396 +#, docstring +msgid "" +"[] [--values] [--{regexp} ] [ ...]\n" +"\n" +" Searches the keyspace for keys matching . If --regexp is given,\n" +" it associated value is taken as a regexp and matched against the keys.\n" +" If --values is given, search the value space instead of the keyspace.\n" +" " +msgstr "" + +#: plugin.py:431 +msgid "No keys matched that query." +msgstr "" + +#: plugin.py:436 +msgid "More than 100 keys matched that query; please narrow your query." +msgstr "" + diff --git a/plugins/Factoids/plugin.py b/plugins/Factoids/plugin.py index c375d16c8..bb4c68452 100644 --- a/plugins/Factoids/plugin.py +++ b/plugins/Factoids/plugin.py @@ -39,6 +39,8 @@ 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('Factoids') try: import sqlite @@ -148,14 +150,14 @@ class Factoids(callbacks.Plugin, plugins.ChannelDBHandler): else: irc.error('That factoid is locked.') learn = wrap(learn, ['factoid']) - learn._fake__doc__ = """[] %s + learn._fake__doc__ = _("""[] %s Associates with . is only necessary if the message isn't sent on the channel itself. The word '%s' is necessary to separate the key from the value. It can be changed to another word via the learnSeparator registry value. - """ + """) def _lookupFactoid(self, channel, key): @@ -174,7 +176,7 @@ class Factoids(callbacks.Plugin, plugins.ChannelDBHandler): try: irc.reply(factoids[number-1]) except IndexError: - irc.error('That\'s not a valid number for that key.') + irc.error(_('That\'s not a valid number for that key.')) return else: env = {'key': key} @@ -194,7 +196,7 @@ class Factoids(callbacks.Plugin, plugins.ChannelDBHandler): irc.replies(factoidsS, prefixer=prefixer, joiner=', or ', onlyPrefixFirst=True) elif error: - irc.error('No factoid matches that key.') + irc.error(_('No factoid matches that key.')) def invalidCommand(self, irc, msg, tokens): if irc.isChannel(msg.args[0]): @@ -204,6 +206,7 @@ class Factoids(callbacks.Plugin, plugins.ChannelDBHandler): factoids = self._lookupFactoid(channel, key) self._replyFactoids(irc, msg, key, factoids, error=False) + @internationalizeDocstring def whatis(self, irc, msg, args, channel, words): """[] [] @@ -216,12 +219,13 @@ class Factoids(callbacks.Plugin, plugins.ChannelDBHandler): if words[-1].isdigit(): number = int(words.pop()) if number <= 0: - irc.errorInvalid('key id') + irc.errorInvalid(_('key id')) key = ' '.join(words) factoids = self._lookupFactoid(channel, key) self._replyFactoids(irc, msg, key, factoids, number) whatis = wrap(whatis, ['channel', many('something')]) + @internationalizeDocstring def lock(self, irc, msg, args, channel, key): """[] @@ -236,6 +240,7 @@ class Factoids(callbacks.Plugin, plugins.ChannelDBHandler): irc.replySuccess() lock = wrap(lock, ['channel', 'text']) + @internationalizeDocstring def unlock(self, irc, msg, args, channel, key): """[] @@ -250,6 +255,7 @@ class Factoids(callbacks.Plugin, plugins.ChannelDBHandler): irc.replySuccess() unlock = wrap(unlock, ['channel', 'text']) + @internationalizeDocstring def forget(self, irc, msg, args, channel, words): """[] [|*] @@ -264,7 +270,7 @@ class Factoids(callbacks.Plugin, plugins.ChannelDBHandler): if words[-1].isdigit(): number = int(words.pop()) if number <= 0: - irc.errorInvalid('key id') + irc.errorInvalid(_('key id')) elif words[-1] == '*': words.pop() number = True @@ -276,7 +282,7 @@ class Factoids(callbacks.Plugin, plugins.ChannelDBHandler): WHERE key LIKE %s AND factoids.key_id=keys.id""", key) if cursor.rowcount == 0: - irc.error('There is no such factoid.') + irc.error(_('There is no such factoid.')) elif cursor.rowcount == 1 or number is True: (id, _) = cursor.fetchone() cursor.execute("""DELETE FROM factoids WHERE key_id=%s""", id) @@ -289,18 +295,19 @@ class Factoids(callbacks.Plugin, plugins.ChannelDBHandler): try: (_, id) = results[number-1] except IndexError: - irc.error('Invalid factoid number.') + irc.error(_('Invalid factoid number.')) return cursor.execute("DELETE FROM factoids WHERE id=%s", id) db.commit() irc.replySuccess() else: - irc.error('%s factoids have that key. ' + irc.error(_('%s factoids have that key. ' 'Please specify which one to remove, ' - 'or use * to designate all of them.' % + 'or use * to designate all of them.') % cursor.rowcount) forget = wrap(forget, ['channel', many('something')]) + @internationalizeDocstring def random(self, irc, msg, args, channel): """[] @@ -320,9 +327,10 @@ class Factoids(callbacks.Plugin, plugins.ChannelDBHandler): L.append('"%s": %s' % (ircutils.bold(key), factoid)) irc.reply('; '.join(L)) else: - irc.error('I couldn\'t find a factoid.') + irc.error(_('I couldn\'t find a factoid.')) random = wrap(random, ['channel']) + @internationalizeDocstring def info(self, irc, msg, args, channel, key): """[] @@ -334,7 +342,7 @@ class Factoids(callbacks.Plugin, plugins.ChannelDBHandler): cursor = db.cursor() cursor.execute("SELECT id, locked FROM keys WHERE key LIKE %s", key) if cursor.rowcount == 0: - irc.error('No factoid matches that key.') + irc.error(_('No factoid matches that key.')) return (id, locked) = map(int, cursor.fetchone()) cursor.execute("""SELECT added_by, added_at FROM factoids @@ -347,7 +355,7 @@ class Factoids(callbacks.Plugin, plugins.ChannelDBHandler): counter += 1 added_at = time.strftime(conf.supybot.reply.format.time(), time.localtime(int(added_at))) - L.append(format('#%i was added by %s at %s', + L.append(format(_('#%i was added by %s at %s'), counter, added_by, added_at)) factoids = '; '.join(L) s = format('Key %q is %s and has %n associated with it: %s', @@ -356,6 +364,7 @@ class Factoids(callbacks.Plugin, plugins.ChannelDBHandler): irc.reply(s) info = wrap(info, ['channel', 'text']) + @internationalizeDocstring def change(self, irc, msg, args, channel, key, number, replacer): """[] @@ -369,10 +378,10 @@ class Factoids(callbacks.Plugin, plugins.ChannelDBHandler): WHERE keys.key LIKE %s AND keys.id=factoids.key_id""", key) if cursor.rowcount == 0: - irc.error(format('I couldn\'t find any key %q', key)) + irc.error(format(_('I couldn\'t find any key %q'), key)) return elif cursor.rowcount < number: - irc.errorInvalid('key id') + irc.errorInvalid(_('key id')) (id, fact) = cursor.fetchall()[number-1] newfact = replacer(fact) cursor.execute("UPDATE factoids SET fact=%s WHERE id=%s", newfact, id) @@ -382,6 +391,7 @@ class Factoids(callbacks.Plugin, plugins.ChannelDBHandler): 'factoidId', 'regexpReplacer']) _sqlTrans = string.maketrans('*?', '%_') + @internationalizeDocstring def search(self, irc, msg, args, channel, optlist, globs): """[] [--values] [--{regexp} ] [ ...] @@ -418,13 +428,13 @@ class Factoids(callbacks.Plugin, plugins.ChannelDBHandler): sql = sql.replace('TARGET', target) cursor.execute(sql, formats) if cursor.rowcount == 0: - irc.reply('No keys matched that query.') + irc.reply(_('No keys matched that query.')) elif cursor.rowcount == 1 and \ self.registryValue('showFactoidIfOnlyOneMatch', channel): self.whatis(irc, msg, [channel, cursor.fetchone()[0]]) elif cursor.rowcount > 100: - irc.reply('More than 100 keys matched that query; ' - 'please narrow your query.') + irc.reply(_('More than 100 keys matched that query; ' + 'please narrow your query.')) else: keys = [repr(t[0]) for t in cursor.fetchall()] s = format('%L', keys) From 9917232d9aa535f202e63c967ffb55ace9bb1918 Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Sun, 17 Oct 2010 14:50:31 +0200 Subject: [PATCH 05/10] Internationalize Filter, Format, Games, and Google --- plugins/Filter/config.py | 18 +- plugins/Filter/messages.pot | 568 ++++++++++++++++++++++++++++++++++++ plugins/Filter/plugin.py | 114 +++++--- plugins/Format/config.py | 2 + plugins/Format/messages.pot | 170 +++++++++++ plugins/Format/plugin.py | 24 +- plugins/Games/config.py | 2 + plugins/Games/messages.pot | 128 ++++++++ plugins/Games/plugin.py | 68 +++-- plugins/Google/config.py | 34 ++- plugins/Google/messages.pot | 206 +++++++++++++ plugins/Google/plugin.py | 32 +- 12 files changed, 1255 insertions(+), 111 deletions(-) create mode 100644 plugins/Filter/messages.pot create mode 100644 plugins/Format/messages.pot create mode 100644 plugins/Games/messages.pot create mode 100644 plugins/Google/messages.pot diff --git a/plugins/Filter/config.py b/plugins/Filter/config.py index dee646c16..cd45fa9cb 100644 --- a/plugins/Filter/config.py +++ b/plugins/Filter/config.py @@ -29,22 +29,24 @@ import supybot.conf as conf import supybot.registry as registry +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('Filter') Filter = conf.registerPlugin('Filter') conf.registerGroup(Filter, 'spellit') conf.registerGlobalValue(Filter.spellit, - 'replaceLetters', registry.Boolean(True, """Determines whether or not to - replace letters in the output of spellit.""")) + 'replaceLetters', registry.Boolean(True, _("""Determines whether or not to + replace letters in the output of spellit."""))) conf.registerGlobalValue(Filter.spellit, - 'replacePunctuation', registry.Boolean(True, """Determines whether or not - to replace punctuation in the output of spellit.""")) + 'replacePunctuation', registry.Boolean(True, _("""Determines whether or not + to replace punctuation in the output of spellit."""))) conf.registerGlobalValue(Filter.spellit, - 'replaceNumbers', registry.Boolean(True, """Determines whether or not to - replace numbers in the output of spellit.""")) + 'replaceNumbers', registry.Boolean(True, _("""Determines whether or not to + replace numbers in the output of spellit."""))) conf.registerGroup(Filter, 'shrink') conf.registerChannelValue(Filter.shrink, 'minimum', - registry.PositiveInteger(4, """Determines the minimum number of a letters - in a word before it will be shrunken by the shrink command/filter.""")) + registry.PositiveInteger(4, _("""Determines the minimum number of a letters + in a word before it will be shrunken by the shrink command/filter."""))) def configure(advanced): # This will be called by supybot to configure this module. advanced is diff --git a/plugins/Filter/messages.pot b/plugins/Filter/messages.pot new file mode 100644 index 000000000..ffde04b05 --- /dev/null +++ b/plugins/Filter/messages.pot @@ -0,0 +1,568 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR ORGANIZATION +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2010-10-17 11:48+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:38 +msgid "" +"Determines whether or not to\n" +" replace letters in the output of spellit." +msgstr "" + +#: config.py:41 +msgid "" +"Determines whether or not\n" +" to replace punctuation in the output of spellit." +msgstr "" + +#: config.py:44 +msgid "" +"Determines whether or not to\n" +" replace numbers in the output of spellit." +msgstr "" + +#: config.py:48 +msgid "" +"Determines the minimum number of a letters\n" +" in a word before it will be shrunken by the shrink command/filter." +msgstr "" + +#: plugin.py:51 +#, docstring +msgid "" +"This plugin offers several commands which transform text in some way.\n" +" It also provides the capability of using such commands to 'filter' the\n" +" output of the bot -- for instance, you could make everything the bot says\n" +" be in leetspeak, or Morse code, or any number of other kinds of filters.\n" +" Not very useful, but definitely quite fun :)" +msgstr "" + +#: plugin.py:85 +#, docstring +msgid "" +"[] []\n" +"\n" +" Sets the outFilter of this plugin to be . If no command is\n" +" given, unsets the outFilter. is only necessary if the\n" +" message isn't sent in the channel itself.\n" +" " +msgstr "" + +#: plugin.py:98 +msgid "That's not a valid filter command." +msgstr "" + +#: plugin.py:108 +#, docstring +msgid "" +"\n" +"\n" +" Removes all the vowels from . (If you're curious why this is\n" +" named 'hebrew' it's because I (jemfinch) thought of it in Hebrew class,\n" +" and printed Hebrew often elides the vowels.)\n" +" " +msgstr "" + +#: plugin.py:120 +#, docstring +msgid "" +"\n" +"\n" +" Removes all the spaces from .\n" +" " +msgstr "" + +#: plugin.py:130 +#, docstring +msgid "" +"\n" +"\n" +" Returns , with all consecutive duplicated letters removed.\n" +" " +msgstr "" + +#: plugin.py:143 +#, docstring +msgid "" +"\n" +"\n" +" Returns the binary representation of .\n" +" " +msgstr "" + +#: plugin.py:169 +#, docstring +msgid "" +"\n" +"\n" +" Returns a hexstring from the given string; a hexstring is a string\n" +" composed of the hexadecimal value of each character in the string\n" +" " +msgstr "" + +#: plugin.py:179 +#, docstring +msgid "" +"\n" +"\n" +" Returns the string corresponding to . Obviously,\n" +" must be a string of hexadecimal digits.\n" +" " +msgstr "" + +#: plugin.py:187 +msgid "Invalid input." +msgstr "" + +#: plugin.py:192 +#, docstring +msgid "" +"\n" +"\n" +" Rotates 13 characters to the right in the alphabet. Rot13 is\n" +" commonly used for text that simply needs to be hidden from inadvertent\n" +" reading by roaming eyes, since it's easily reversible.\n" +" " +msgstr "" + +#: plugin.py:203 +#, docstring +msgid "" +"\n" +"\n" +" Returns the lisping version of \n" +" " +msgstr "" + +#: plugin.py:234 +#, docstring +msgid "" +"\n" +"\n" +" Returns the l33tspeak version of \n" +" " +msgstr "" + +#: plugin.py:254 +#, docstring +msgid "" +"\n" +"\n" +" Replies with an especially k-rad translation of .\n" +" " +msgstr "" + +#: plugin.py:270 +#, docstring +msgid "" +"\n" +"\n" +" Replies with a string where each word is scrambled; i.e., each internal\n" +" letter (that is, all letters but the first and last) are shuffled.\n" +" " +msgstr "" + +#: plugin.py:335 +#, docstring +msgid "" +"\n" +"\n" +" Does the reverse of the morse command.\n" +" " +msgstr "" + +#: plugin.py:352 +#, docstring +msgid "" +"\n" +"\n" +" Gives the Morse code equivalent of a given string.\n" +" " +msgstr "" + +#: plugin.py:364 +#, docstring +msgid "" +"\n" +"\n" +" Reverses .\n" +" " +msgstr "" + +#: plugin.py:381 +#, docstring +msgid "" +"\n" +"\n" +" Returns with each character randomly colorized.\n" +" " +msgstr "" + +#: plugin.py:391 +#, docstring +msgid "" +"\n" +"\n" +" Returns colorized like a rainbow.\n" +" " +msgstr "" + +#: plugin.py:402 +#, docstring +msgid "" +"\n" +"\n" +" Returns stripped of all color codes.\n" +" " +msgstr "" + +#: plugin.py:411 +#, docstring +msgid "" +"\n" +"\n" +" Returns as if an AOLuser had said it.\n" +" " +msgstr "" + +#: plugin.py:438 +#, docstring +msgid "" +"\n" +"\n" +" Returns as if JeffK had said it himself.\n" +" " +msgstr "" + +#: plugin.py:534 +msgid "ay" +msgstr "" + +#: plugin.py:534 +msgid "bee" +msgstr "" + +#: plugin.py:534 +msgid "dee" +msgstr "" + +#: plugin.py:534 +msgid "see" +msgstr "" + +#: plugin.py:535 +msgid "aych" +msgstr "" + +#: plugin.py:535 +msgid "ee" +msgstr "" + +#: plugin.py:535 +msgid "eff" +msgstr "" + +#: plugin.py:535 +msgid "gee" +msgstr "" + +#: plugin.py:536 +msgid "ell" +msgstr "" + +#: plugin.py:536 +msgid "eye" +msgstr "" + +#: plugin.py:536 +msgid "jay" +msgstr "" + +#: plugin.py:536 +msgid "kay" +msgstr "" + +#: plugin.py:537 +msgid "cue" +msgstr "" + +#: plugin.py:537 +msgid "em" +msgstr "" + +#: plugin.py:537 +msgid "en" +msgstr "" + +#: plugin.py:537 +msgid "oh" +msgstr "" + +#: plugin.py:537 +msgid "pee" +msgstr "" + +#: plugin.py:538 +msgid "arr" +msgstr "" + +#: plugin.py:538 +msgid "ess" +msgstr "" + +#: plugin.py:538 +msgid "tee" +msgstr "" + +#: plugin.py:538 +msgid "you" +msgstr "" + +#: plugin.py:539 +msgid "double-you" +msgstr "" + +#: plugin.py:539 +msgid "ecks" +msgstr "" + +#: plugin.py:539 +msgid "vee" +msgstr "" + +#: plugin.py:539 +msgid "why" +msgstr "" + +#: plugin.py:540 +msgid "zee" +msgstr "" + +#: plugin.py:545 +msgid "exclamation point" +msgstr "" + +#: plugin.py:546 +msgid "quote" +msgstr "" + +#: plugin.py:547 +msgid "pound" +msgstr "" + +#: plugin.py:548 +msgid "dollar sign" +msgstr "" + +#: plugin.py:549 +msgid "percent" +msgstr "" + +#: plugin.py:550 +msgid "ampersand" +msgstr "" + +#: plugin.py:551 +msgid "single quote" +msgstr "" + +#: plugin.py:552 +msgid "left paren" +msgstr "" + +#: plugin.py:553 +msgid "right paren" +msgstr "" + +#: plugin.py:554 +msgid "asterisk" +msgstr "" + +#: plugin.py:555 +msgid "plus" +msgstr "" + +#: plugin.py:556 +msgid "comma" +msgstr "" + +#: plugin.py:557 +msgid "minus" +msgstr "" + +#: plugin.py:558 +msgid "period" +msgstr "" + +#: plugin.py:559 +msgid "slash" +msgstr "" + +#: plugin.py:560 +msgid "colon" +msgstr "" + +#: plugin.py:561 +msgid "semicolon" +msgstr "" + +#: plugin.py:562 +msgid "less than" +msgstr "" + +#: plugin.py:563 +msgid "equals" +msgstr "" + +#: plugin.py:564 +msgid "greater than" +msgstr "" + +#: plugin.py:565 +msgid "question mark" +msgstr "" + +#: plugin.py:566 +msgid "at" +msgstr "" + +#: plugin.py:567 +msgid "left bracket" +msgstr "" + +#: plugin.py:568 +msgid "backslash" +msgstr "" + +#: plugin.py:569 +msgid "right bracket" +msgstr "" + +#: plugin.py:570 +msgid "caret" +msgstr "" + +#: plugin.py:571 +msgid "underscore" +msgstr "" + +#: plugin.py:572 +msgid "backtick" +msgstr "" + +#: plugin.py:573 +msgid "left brace" +msgstr "" + +#: plugin.py:574 +msgid "pipe" +msgstr "" + +#: plugin.py:575 +msgid "right brace" +msgstr "" + +#: plugin.py:576 +msgid "tilde" +msgstr "" + +#: plugin.py:579 +msgid "one" +msgstr "" + +#: plugin.py:579 +msgid "three" +msgstr "" + +#: plugin.py:579 +msgid "two" +msgstr "" + +#: plugin.py:579 +msgid "zero" +msgstr "" + +#: plugin.py:580 +msgid "five" +msgstr "" + +#: plugin.py:580 +msgid "four" +msgstr "" + +#: plugin.py:580 +msgid "seven" +msgstr "" + +#: plugin.py:580 +msgid "six" +msgstr "" + +#: plugin.py:581 +msgid "eight" +msgstr "" + +#: plugin.py:581 +msgid "nine" +msgstr "" + +#: plugin.py:585 +#, docstring +msgid "" +"\n" +"\n" +" Returns , phonetically spelled out.\n" +" " +msgstr "" + +#: plugin.py:615 +#, docstring +msgid "" +"\n" +"\n" +" Returns as GNU/RMS would say it.\n" +" " +msgstr "" + +#: plugin.py:624 +#, docstring +msgid "" +"\n" +"\n" +" Returns with each word longer than\n" +" supybot.plugins.Filter.shrink.minimum being shrunken (i.e., like\n" +" \"internationalization\" becomes \"i18n\").\n" +" " +msgstr "" + +#: plugin.py:643 +#, docstring +msgid "" +"\n" +"\n" +" Returns with the l's made into r's and r's made into l's.\n" +" " +msgstr "" + +#: plugin.py:692 +#, docstring +msgid "" +"\n" +"\n" +" Returns rotated 180 degrees. Only really works for ASCII\n" +" printable characters.\n" +" " +msgstr "" + diff --git a/plugins/Filter/plugin.py b/plugins/Filter/plugin.py index 23b6277ff..28c302b7e 100644 --- a/plugins/Filter/plugin.py +++ b/plugins/Filter/plugin.py @@ -39,11 +39,14 @@ from supybot.commands import * import supybot.ircmsgs as ircmsgs import supybot.ircutils as ircutils import supybot.callbacks as callbacks +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('Filter') class MyFilterProxy(object): def reply(self, s): self.s = s +@internationalizeDocstring class Filter(callbacks.Plugin): """This plugin offers several commands which transform text in some way. It also provides the capability of using such commands to 'filter' the @@ -77,6 +80,7 @@ class Filter(callbacks.Plugin): 'scramble', 'morse', 'reverse', 'colorize', 'squish', 'supa1337', 'colorstrip', 'aol', 'rainbow', 'spellit', 'hebrew', 'undup', 'gnu', 'shrink', 'azn', 'uniud'] + @internationalizeDocstring def outfilter(self, irc, msg, args, channel, command): """[] [] @@ -91,7 +95,7 @@ class Filter(callbacks.Plugin): self.outFilters.setdefault(channel, []).append(method) irc.replySuccess() else: - irc.error('That\'s not a valid filter command.') + irc.error(_('That\'s not a valid filter command.')) else: self.outFilters[channel] = [] irc.replySuccess() @@ -99,6 +103,7 @@ class Filter(callbacks.Plugin): [('checkChannelCapability', 'op'), additional('commandName')]) + @internationalizeDocstring def hebrew(self, irc, msg, args, text): """ @@ -110,6 +115,7 @@ class Filter(callbacks.Plugin): irc.reply(text) hebrew = wrap(hebrew, ['text']) + @internationalizeDocstring def squish(self, irc, msg, args, text): """ @@ -119,6 +125,7 @@ class Filter(callbacks.Plugin): irc.reply(text) squish = wrap(squish, ['text']) + @internationalizeDocstring def undup(self, irc, msg, args, text): """ @@ -131,6 +138,7 @@ class Filter(callbacks.Plugin): irc.reply(''.join(L)) undup = wrap(undup, ['text']) + @internationalizeDocstring def binary(self, irc, msg, args, text): """ @@ -156,6 +164,7 @@ class Filter(callbacks.Plugin): irc.reply(''.join(L)) binary = wrap(binary, ['text']) + @internationalizeDocstring def hexlify(self, irc, msg, args, text): """ @@ -165,6 +174,7 @@ class Filter(callbacks.Plugin): irc.reply(text.encode('hex_codec')) hexlify = wrap(hexlify, ['text']) + @internationalizeDocstring def unhexlify(self, irc, msg, args, text): """ @@ -174,9 +184,10 @@ class Filter(callbacks.Plugin): try: irc.reply(text.decode('hex_codec')) except TypeError: - irc.error('Invalid input.') + irc.error(_('Invalid input.')) unhexlify = wrap(unhexlify, ['text']) + @internationalizeDocstring def rot13(self, irc, msg, args, text): """ @@ -187,6 +198,7 @@ class Filter(callbacks.Plugin): irc.reply(text.encode('rot13')) rot13 = wrap(rot13, ['text']) + @internationalizeDocstring def lithp(self, irc, msg, args, text): """ @@ -217,6 +229,7 @@ class Filter(callbacks.Plugin): (re.compile(r'[aA][tT]'), '@'), (re.compile(r'[sS]\b'), 'z'), (re.compile(r'x'), '><'),] + @internationalizeDocstring def leet(self, irc, msg, args, text): """ @@ -236,6 +249,7 @@ class Filter(callbacks.Plugin): ('D', '|)'), ('B', '|3'), ('I', ']['), ('Vv', '\\/'), ('wW', '\\/\\/'), ('d', 'c|'), ('b', '|>'), ('c', '<'), ('h', '|n'),] + @internationalizeDocstring def supa1337(self, irc, msg, args, text): """ @@ -251,6 +265,7 @@ class Filter(callbacks.Plugin): _scrambleRe = re.compile(r'(?:\b|(?![a-zA-Z]))([a-zA-Z])([a-zA-Z]*)' r'([a-zA-Z])(?:\b|(?![a-zA-Z]))') + @internationalizeDocstring def scramble(self, irc, msg, args, text): """ @@ -315,6 +330,7 @@ class Filter(callbacks.Plugin): } _revMorseCode = dict([(y, x) for (x, y) in _morseCode.items()]) _unmorsere = re.compile('([.-]+)') + @internationalizeDocstring def unmorse(self, irc, msg, args, text): """ @@ -331,6 +347,7 @@ class Filter(callbacks.Plugin): irc.reply(text) unmorse = wrap(unmorse, ['text']) + @internationalizeDocstring def morse(self, irc, msg, args, text): """ @@ -342,6 +359,7 @@ class Filter(callbacks.Plugin): irc.reply(' '.join(L)) morse = wrap(morse, ['text']) + @internationalizeDocstring def reverse(self, irc, msg, args, text): """ @@ -350,6 +368,7 @@ class Filter(callbacks.Plugin): irc.reply(text[::-1]) reverse = wrap(reverse, ['text']) + @internationalizeDocstring def _color(self, c, fg=None): if c == ' ': return c @@ -357,6 +376,7 @@ class Filter(callbacks.Plugin): fg = str(random.randint(2, 15)).zfill(2) return '\x03%s%s' % (fg, c) + @internationalizeDocstring def colorize(self, irc, msg, args, text): """ @@ -366,6 +386,7 @@ class Filter(callbacks.Plugin): irc.reply('%s%s' % (''.join(L), '\x03')) colorize = wrap(colorize, ['text']) + @internationalizeDocstring def rainbow(self, irc, msg, args, text): """ @@ -376,6 +397,7 @@ class Filter(callbacks.Plugin): irc.reply(''.join(L) + '\x03') rainbow = wrap(rainbow, ['text']) + @internationalizeDocstring def stripcolor(self, irc, msg, args, text): """ @@ -384,6 +406,7 @@ class Filter(callbacks.Plugin): irc.reply(ircutils.stripColor(text)) stripcolor = wrap(stripcolor, ['text']) + @internationalizeDocstring def aol(self, irc, msg, args, text): """ @@ -410,6 +433,7 @@ class Filter(callbacks.Plugin): irc.reply(text) aol = wrap(aol, ['text']) + @internationalizeDocstring def jeffk(self, irc, msg, args, text): """ @@ -507,52 +531,56 @@ class Filter(callbacks.Plugin): # Keeping these separate so people can just replace the alphabets for # whatever their language of choice _spellLetters = { - 'a': 'ay', 'b': 'bee', 'c': 'see', 'd': 'dee', 'e': 'ee', 'f': 'eff', - 'g': 'gee', 'h': 'aych', 'i': 'eye', 'j': 'jay', 'k': 'kay', 'l': - 'ell', 'm': 'em', 'n': 'en', 'o': 'oh', 'p': 'pee', 'q': 'cue', 'r': - 'arr', 's': 'ess', 't': 'tee', 'u': 'you', 'v': 'vee', 'w': - 'double-you', 'x': 'ecks', 'y': 'why', 'z': 'zee' + 'a': _('ay'), 'b': _('bee'), 'c': _('see'), 'd': _('dee'), + 'e': _('ee'), 'f': _('eff'), 'g': _('gee'), 'h': _('aych'), + 'i': _('eye'), 'j': _('jay'), 'k': _('kay'), 'l': _('ell'), + 'm': _('em'), 'n': _('en'), 'o': _('oh'), 'p': _('pee'), 'q': _('cue'), + 'r': _('arr'), 's': _('ess'), 't': _('tee'), 'u': _('you'), + 'v': _('vee'), 'w': _('double-you'), 'x': _('ecks'), 'y': _('why'), + 'z': _('zee') } for (k, v) in _spellLetters.items(): _spellLetters[k.upper()] = v _spellPunctuation = { - '!': 'exclamation point', - '"': 'quote', - '#': 'pound', - '$': 'dollar sign', - '%': 'percent', - '&': 'ampersand', - '\'': 'single quote', - '(': 'left paren', - ')': 'right paren', - '*': 'asterisk', - '+': 'plus', - ',': 'comma', - '-': 'minus', - '.': 'period', - '/': 'slash', - ':': 'colon', - ';': 'semicolon', - '<': 'less than', - '=': 'equals', - '>': 'greater than', - '?': 'question mark', - '@': 'at', - '[': 'left bracket', - '\\': 'backslash', - ']': 'right bracket', - '^': 'caret', - '_': 'underscore', - '`': 'backtick', - '{': 'left brace', - '|': 'pipe', - '}': 'right brace', - '~': 'tilde' + '!': _('exclamation point'), + '"': _('quote'), + '#': _('pound'), + '$': _('dollar sign'), + '%': _('percent'), + '&': _('ampersand'), + '\'': _('single quote'), + '(': _('left paren'), + ')': _('right paren'), + '*': _('asterisk'), + '+': _('plus'), + ',': _('comma'), + '-': _('minus'), + '.': _('period'), + '/': _('slash'), + ':': _('colon'), + ';': _('semicolon'), + '<': _('less than'), + '=': _('equals'), + '>': _('greater than'), + '?': _('question mark'), + '@': _('at'), + '[': _('left bracket'), + '\\': _('backslash'), + ']': _('right bracket'), + '^': _('caret'), + '_': _('underscore'), + '`': _('backtick'), + '{': _('left brace'), + '|': _('pipe'), + '}': _('right brace'), + '~': _('tilde') } _spellNumbers = { - '0': 'zero', '1': 'one', '2': 'two', '3': 'three', '4': 'four', - '5': 'five', '6': 'six', '7': 'seven', '8': 'eight', '9': 'nine' + '0': _('zero'), '1': _('one'), '2': _('two'), '3': _('three'), + '4': _('four'), '5': _('five'), '6': _('six'), '7': _('seven'), + '8': _('eight'), '9': _('nine') } + @internationalizeDocstring def spellit(self, irc, msg, args, text): """ @@ -582,6 +610,7 @@ class Filter(callbacks.Plugin): irc.reply(out.getvalue()) spellit = wrap(spellit, ['text']) + @internationalizeDocstring def gnu(self, irc, msg, args, text): """ @@ -590,6 +619,7 @@ class Filter(callbacks.Plugin): irc.reply(' '.join(['GNU/' + s for s in text.split()])) gnu = wrap(gnu, ['text']) + @internationalizeDocstring def shrink(self, irc, msg, args, text): """ @@ -608,6 +638,7 @@ class Filter(callbacks.Plugin): shrink = wrap(shrink, ['text']) _azn_trans = string.maketrans('rlRL', 'lrLR') + @internationalizeDocstring def azn(self, irc, msg, args, text): """ @@ -656,6 +687,7 @@ class Filter(callbacks.Plugin): '_': u'\u203e', 'o': u'o', } + @internationalizeDocstring def uniud(self, irc, msg, args, text): """ diff --git a/plugins/Format/config.py b/plugins/Format/config.py index d27e3b988..5a0645d4c 100644 --- a/plugins/Format/config.py +++ b/plugins/Format/config.py @@ -29,6 +29,8 @@ import supybot.conf as conf import supybot.registry as registry +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('Format') def configure(advanced): # This will be called by supybot to configure this module. advanced is diff --git a/plugins/Format/messages.pot b/plugins/Format/messages.pot new file mode 100644 index 000000000..960c03a14 --- /dev/null +++ b/plugins/Format/messages.pot @@ -0,0 +1,170 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR ORGANIZATION +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2010-10-17 12:46+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:43 +#, docstring +msgid "" +"\n" +"\n" +" Returns bolded.\n" +" " +msgstr "" + +#: plugin.py:52 +#, docstring +msgid "" +"\n" +"\n" +" Returns in reverse-video.\n" +" " +msgstr "" + +#: plugin.py:61 +#, docstring +msgid "" +"\n" +"\n" +" Returns underlined.\n" +" " +msgstr "" + +#: plugin.py:70 +#, docstring +msgid "" +" [] \n" +"\n" +" Returns with foreground color and background color\n" +" (if given)\n" +" " +msgstr "" + +#: plugin.py:80 +#, docstring +msgid "" +" [ ...]\n" +"\n" +" Joins all the arguments together with .\n" +" " +msgstr "" + +#: plugin.py:89 +#, docstring +msgid "" +" \n" +"\n" +" Replaces with in\n" +" . The first and second arguments must necessarily be the same\n" +" length.\n" +" " +msgstr "" + +#: plugin.py:96 +msgid " must be the same length as ." +msgstr "" + +#: plugin.py:103 +#, docstring +msgid "" +"\n" +"\n" +" Returns uppercased.\n" +" " +msgstr "" + +#: plugin.py:112 +#, docstring +msgid "" +"\n" +"\n" +" Returns lowercased.\n" +" " +msgstr "" + +#: plugin.py:121 +#, docstring +msgid "" +"\n" +"\n" +" Returns capitalized.\n" +" " +msgstr "" + +#: plugin.py:130 +#, docstring +msgid "" +"\n" +"\n" +" Returns titlecased.\n" +" " +msgstr "" + +#: plugin.py:139 +#, docstring +msgid "" +"\n" +"\n" +" Returns the text surrounded by double quotes.\n" +" " +msgstr "" + +#: plugin.py:148 +#, docstring +msgid "" +" \n" +"\n" +" Concatenates two strings. Do keep in mind that this is *not* the same\n" +" thing as join \"\", since if contains spaces, they won't be\n" +" removed by concat.\n" +" " +msgstr "" + +#: plugin.py:159 +#, docstring +msgid "" +" \n" +"\n" +" Cuts down to by chopping off the rightmost characters in\n" +" excess of . If is a negative number, it chops that many\n" +" characters off the end of .\n" +" " +msgstr "" + +#: plugin.py:170 +#, docstring +msgid "" +" \n" +"\n" +" Returns the th space-separated field of . I.e., if text\n" +" is \"foo bar baz\" and is 2, \"bar\" is returned.\n" +" " +msgstr "" + +#: plugin.py:183 +#, docstring +msgid "" +" [ ...]\n" +"\n" +" Expands a Python-style format string using the remaining args. Just be\n" +" sure always to use %s, not %d or %f or whatever, because all the args\n" +" are strings.\n" +" " +msgstr "" + +#: plugin.py:197 +msgid "Not enough arguments for the format string." +msgstr "" + diff --git a/plugins/Format/plugin.py b/plugins/Format/plugin.py index 83c19115d..5e3e4611a 100644 --- a/plugins/Format/plugin.py +++ b/plugins/Format/plugin.py @@ -34,8 +34,11 @@ import supybot.utils as utils from supybot.commands import * import supybot.ircutils as ircutils import supybot.callbacks as callbacks +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('Format') class Format(callbacks.Plugin): + @internationalizeDocstring def bold(self, irc, msg, args, text): """ @@ -44,6 +47,7 @@ class Format(callbacks.Plugin): irc.reply(ircutils.bold(text)) bold = wrap(bold, ['text']) + @internationalizeDocstring def reverse(self, irc, msg, args, text): """ @@ -52,6 +56,7 @@ class Format(callbacks.Plugin): irc.reply(ircutils.reverse(text)) reverse = wrap(reverse, ['text']) + @internationalizeDocstring def underline(self, irc, msg, args, text): """ @@ -60,6 +65,7 @@ class Format(callbacks.Plugin): irc.reply(ircutils.underline(text)) underline = wrap(underline, ['text']) + @internationalizeDocstring def color(self, irc, msg, args, fg, bg, text): """ [] @@ -69,6 +75,7 @@ class Format(callbacks.Plugin): irc.reply(ircutils.mircColor(text, fg=fg, bg=bg)) color = wrap(color, ['color', optional('color'), 'text']) + @internationalizeDocstring def join(self, irc, msg, args, sep): """ [ ...] @@ -77,6 +84,7 @@ class Format(callbacks.Plugin): irc.reply(sep.join(args)) join = wrap(join, ['anything'], allowExtra=True) + @internationalizeDocstring def translate(self, irc, msg, args, bad, good, text): """ @@ -85,11 +93,12 @@ class Format(callbacks.Plugin): length. """ if len(bad) != len(good): - irc.error(' must be the same length as ' - '.', Raise=True) + irc.error(_(' must be the same length as ' + '.'), Raise=True) irc.reply(text.translate(string.maketrans(bad, good))) translate = wrap(translate, ['something', 'something', 'text']) + @internationalizeDocstring def upper(self, irc, msg, args, text): """ @@ -98,6 +107,7 @@ class Format(callbacks.Plugin): irc.reply(text.upper()) upper = wrap(upper, ['text']) + @internationalizeDocstring def lower(self, irc, msg, args, text): """ @@ -106,6 +116,7 @@ class Format(callbacks.Plugin): irc.reply(text.lower()) lower = wrap(lower, ['text']) + @internationalizeDocstring def capitalize(self, irc, msg, args, text): """ @@ -114,6 +125,7 @@ class Format(callbacks.Plugin): irc.reply(text.capitalize()) capitalize = wrap(capitalize, ['text']) + @internationalizeDocstring def title(self, irc, msg, args, text): """ @@ -122,6 +134,7 @@ class Format(callbacks.Plugin): irc.reply(text.title()) title = wrap(title, ['text']) + @internationalizeDocstring def repr(self, irc, msg, args, text): """ @@ -130,6 +143,7 @@ class Format(callbacks.Plugin): irc.reply(utils.str.dqrepr(text)) repr = wrap(repr, ['text']) + @internationalizeDocstring def concat(self, irc, msg, args, first, second): """ @@ -140,6 +154,7 @@ class Format(callbacks.Plugin): irc.reply(first+second) concat = wrap(concat, ['something', 'text']) + @internationalizeDocstring def cut(self, irc, msg, args, size, text): """ @@ -150,6 +165,7 @@ class Format(callbacks.Plugin): irc.reply(text[:size]) cut = wrap(cut, ['int', 'text']) + @internationalizeDocstring def field(self, irc, msg, args, index, text): """ @@ -162,6 +178,7 @@ class Format(callbacks.Plugin): irc.errorInvalid('field') field = wrap(field, ['index', 'text']) + @internationalizeDocstring def format(self, irc, msg, args): """ [ ...] @@ -177,7 +194,8 @@ class Format(callbacks.Plugin): irc.reply(s) except TypeError, e: self.log.debug(utils.exnToString(e)) - irc.error('Not enough arguments for the format string.',Raise=True) + irc.error(_('Not enough arguments for the format string.'), + Raise=True) Class = Format diff --git a/plugins/Games/config.py b/plugins/Games/config.py index f5ec6bf7a..024d989d7 100644 --- a/plugins/Games/config.py +++ b/plugins/Games/config.py @@ -29,6 +29,8 @@ import supybot.conf as conf import supybot.registry as registry +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('Games') def configure(advanced): # This will be called by supybot to configure this module. advanced is diff --git a/plugins/Games/messages.pot b/plugins/Games/messages.pot new file mode 100644 index 000000000..98aa2cc61 --- /dev/null +++ b/plugins/Games/messages.pot @@ -0,0 +1,128 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR ORGANIZATION +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2010-10-17 13:16+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:46 +#, docstring +msgid "" +"takes no arguments\n" +"\n" +" Flips a coin and returns the result.\n" +" " +msgstr "" + +#: plugin.py:51 +msgid "heads" +msgstr "" + +#: plugin.py:53 +msgid "tails" +msgstr "" + +#: plugin.py:58 +#, docstring +msgid "" +"d\n" +"\n" +" Rolls a die with number of sides times.\n" +" For example, 2d6 will roll 2 six-sided dice; 10d10 will roll 10\n" +" ten-sided dice.\n" +" " +msgstr "" + +#: plugin.py:66 +msgid "You can't roll more than 1000 dice." +msgstr "" + +#: plugin.py:68 +msgid "Dice can't have more than 100 sides." +msgstr "" + +#: plugin.py:70 +msgid "Dice can't have fewer than 3 sides." +msgstr "" + +#: plugin.py:78 +msgid "Dice must be of the form d" +msgstr "" + +#: plugin.py:82 +msgid "It is possible.|Yes!|Of course.|Naturally.|Obviously.|It shall be.|The outlook is good.|It is so.|One would be wise to think so.|The answer is certainly yes." +msgstr "" + +#: plugin.py:86 +msgid "In your dreams.|I doubt it very much.|No chance.|The outlook is poor.|Unlikely.|About as likely as pigs flying.|You're kidding, right?|NO!|NO.|No.|The answer is a resounding no." +msgstr "" + +#: plugin.py:90 +msgid "Maybe...|No clue.|_I_ don't know.|The outlook is hazy, please ask again later.|What are you asking me for?|Come again?|You know the answer better than I.|The answer is def-- oooh! shiny thing!" +msgstr "" + +#: plugin.py:107 +#, docstring +msgid "" +"[]\n" +"\n" +" Ask a question and the answer shall be provided.\n" +" " +msgstr "" + +#: plugin.py:121 +#, docstring +msgid "" +"[spin]\n" +"\n" +" Fires the revolver. If the bullet was in the chamber, you're dead.\n" +" Tell me to spin the chambers and I will.\n" +" " +msgstr "" + +#: plugin.py:128 +msgid "*SPIN* Are you feeling lucky?" +msgstr "" + +#: plugin.py:137 +msgid "*BANG* Hey, who put a blank in here?!" +msgstr "" + +#: plugin.py:139 +msgid "reloads and spins the chambers." +msgstr "" + +#: plugin.py:141 +msgid "*click*" +msgstr "" + +#: plugin.py:148 +#, docstring +msgid "" +"[]\n" +"\n" +" Returns the number of consecutive lines you've sent in \n" +" without being interrupted by someone else (i.e. how long your current\n" +" 'monologue' is). is only necessary if the message isn't sent\n" +" in the channel itself.\n" +" " +msgstr "" + +#: plugin.py:167 +msgid "Your current monologue is at least %n long." +msgstr "" + +#: plugin.py:168 +msgid "line" +msgstr "" + diff --git a/plugins/Games/plugin.py b/plugins/Games/plugin.py index 203bb9fd5..931c79d2d 100644 --- a/plugins/Games/plugin.py +++ b/plugins/Games/plugin.py @@ -36,20 +36,24 @@ from supybot.commands import * import supybot.ircmsgs as ircmsgs import supybot.ircutils as ircutils import supybot.callbacks as callbacks +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('Games') class Games(callbacks.Plugin): + @internationalizeDocstring def coin(self, irc, msg, args): """takes no arguments Flips a coin and returns the result. """ if random.randrange(0, 2): - irc.reply('heads') + irc.reply(_('heads')) else: - irc.reply('tails') + irc.reply(_('tails')) coin = wrap(coin) + @internationalizeDocstring def dice(self, irc, msg, args, m): """d @@ -59,11 +63,11 @@ class Games(callbacks.Plugin): """ (dice, sides) = utils.iter.imap(int, m.groups()) if dice > 1000: - irc.error('You can\'t roll more than 1000 dice.') + irc.error(_('You can\'t roll more than 1000 dice.')) elif sides > 100: - irc.error('Dice can\'t have more than 100 sides.') + irc.error(_('Dice can\'t have more than 100 sides.')) elif sides < 3: - irc.error('Dice can\'t have fewer than 3 sides.') + irc.error(_('Dice can\'t have fewer than 3 sides.')) else: L = [0] * dice for i in xrange(dice): @@ -71,36 +75,34 @@ class Games(callbacks.Plugin): irc.reply(format('%L', [str(x) for x in L])) _dicere = re.compile(r'^(\d+)d(\d+)$') dice = wrap(dice, [('matches', _dicere, - 'Dice must be of the form d')]) + _('Dice must be of the form d'))]) # The list of words and algorithm are pulled straight the mozbot # MagicEightBall.bm module: http://tinyurl.com/7ytg7 - _responses = {'positive': ['It is possible.', 'Yes!', 'Of course.', - 'Naturally.', 'Obviously.', 'It shall be.', - 'The outlook is good.', 'It is so.', - 'One would be wise to think so.', - 'The answer is certainly yes.'], - 'negative': ['In your dreams.', 'I doubt it very much.', - 'No chance.', 'The outlook is poor.', - 'Unlikely.', 'About as likely as pigs flying.', - 'You\'re kidding, right?', 'NO!', 'NO.', 'No.', - 'The answer is a resounding no.', ], - 'unknown' : ['Maybe...', 'No clue.', '_I_ don\'t know.', - 'The outlook is hazy, please ask again later.', - 'What are you asking me for?', 'Come again?', - 'You know the answer better than I.', - 'The answer is def-- oooh! shiny thing!'], - } + _positive = _('It is possible.|Yes!|Of course.|Naturally.|Obviously.|' + 'It shall be.|The outlook is good.|It is so.|' + 'One would be wise to think so.|' + 'The answer is certainly yes.') + _negative = _('In your dreams.|I doubt it very much.|No chance.|' + 'The outlook is poor.|Unlikely.|' + 'About as likely as pigs flying.|You\'re kidding, right?|' + 'NO!|NO.|No.|The answer is a resounding no.') + _unknown = _('Maybe...|No clue.|_I_ don\'t know.|' + 'The outlook is hazy, please ask again later.|' + 'What are you asking me for?|Come again?|' + 'You know the answer better than I.|' + 'The answer is def-- oooh! shiny thing!') def _checkTheBall(self, questionLength): if questionLength % 3 == 0: - category = 'positive' + catalog = self._positive elif questionLength % 3 == 1: - category = 'negative' + catalog = self._negative else: - category = 'unknown' - return utils.iter.choice(self._responses[category]) + catalog = self._unknown + return utils.iter.choice(catalog.split('|')) + @internationalizeDocstring def eightball(self, irc, msg, args, text): """[] @@ -114,6 +116,7 @@ class Games(callbacks.Plugin): _rouletteChamber = random.randrange(0, 6) _rouletteBullet = random.randrange(0, 6) + @internationalizeDocstring def roulette(self, irc, msg, args, spin): """[spin] @@ -122,7 +125,7 @@ class Games(callbacks.Plugin): """ if spin: self._rouletteBullet = random.randrange(0, 6) - irc.reply('*SPIN* Are you feeling lucky?', prefixNick=False) + irc.reply(_('*SPIN* Are you feeling lucky?'), prefixNick=False) return channel = msg.args[0] if self._rouletteChamber == self._rouletteBullet: @@ -131,15 +134,16 @@ class Games(callbacks.Plugin): if irc.nick in irc.state.channels[channel].ops: irc.queueMsg(ircmsgs.kick(channel, msg.nick, 'BANG!')) else: - irc.reply('*BANG* Hey, who put a blank in here?!', + irc.reply(_('*BANG* Hey, who put a blank in here?!'), prefixNick=False) - irc.reply('reloads and spins the chambers.', action=True) + irc.reply(_('reloads and spins the chambers.'), action=True) else: - irc.reply('*click*') + irc.reply(_('*click*')) self._rouletteChamber += 1 self._rouletteChamber %= 6 roulette = wrap(roulette, ['public', additional(('literal', 'spin'))]) + @internationalizeDocstring def monologue(self, irc, msg, args, channel): """[] @@ -160,8 +164,8 @@ class Games(callbacks.Plugin): i += 1 else: break - irc.reply(format('Your current monologue is at least %n long.', - (i, 'line'))) + irc.reply(format(_('Your current monologue is at least %n long.'), + (i, _('line')))) monologue = wrap(monologue, ['channel']) Class = Games diff --git a/plugins/Google/config.py b/plugins/Google/config.py index a309911ab..cd1771a6d 100644 --- a/plugins/Google/config.py +++ b/plugins/Google/config.py @@ -30,15 +30,17 @@ import supybot.conf as conf import supybot.registry as registry +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('Google') def configure(advanced): from supybot.questions import output, yn conf.registerPlugin('Google', True) - output("""The Google plugin has the functionality to watch for URLs + output(_("""The Google plugin has the functionality to watch for URLs that match a specific pattern. (We call this a snarfer) When supybot sees such a URL, it will parse the web page - for information and reply with the results.""") - if yn('Do you want the Google search snarfer enabled by default?'): + for information and reply with the results.""")) + if yn(_('Do you want the Google search snarfer enabled by default?')): conf.supybot.plugins.Google.searchSnarfer.setValue(True) class Language(registry.OnlySomeStrings): @@ -94,29 +96,29 @@ class SafeSearch(registry.OnlySomeStrings): Google = conf.registerPlugin('Google') conf.registerGlobalValue(Google, 'referer', - registry.String('', """Determines the URL that will be sent to Google for + registry.String('', _("""Determines the URL that will be sent to Google for the Referer field of the search requests. If this value is empty, a Referer will be generated in the following format: - http://$server/$botName""")) + http://$server/$botName"""))) conf.registerChannelValue(Google, 'searchSnarfer', - registry.Boolean(False, """Determines whether the search snarfer is + registry.Boolean(False, _("""Determines whether the search snarfer is enabled. If so, messages (even unaddressed ones) beginning with the word 'google' will result in the first URL Google returns being sent to the - channel.""")) + channel."""))) conf.registerChannelValue(Google, 'colorfulFilter', - registry.Boolean(False, """Determines whether the word 'google' in the - bot's output will be made colorful (like Google's logo).""")) + registry.Boolean(False, _("""Determines whether the word 'google' in the + bot's output will be made colorful (like Google's logo)."""))) conf.registerChannelValue(Google, 'bold', - registry.Boolean(True, """Determines whether results are bolded.""")) + registry.Boolean(True, _("""Determines whether results are bolded."""))) conf.registerChannelValue(Google, 'maximumResults', - NumSearchResults(8, """Determines the maximum number of results returned - from the google command.""")) + NumSearchResults(8, _("""Determines the maximum number of results returned + from the google command."""))) conf.registerChannelValue(Google, 'defaultLanguage', - Language('lang_en', """Determines what default language is used in - searches. If left empty, no specific language will be requested.""")) + Language('lang_'+ _('en'), _("""Determines what default language is used in + searches. If left empty, no specific language will be requested."""))) conf.registerChannelValue(Google, 'searchFilter', - SafeSearch('moderate', """Determines what level of search filtering to use + SafeSearch('moderate', _("""Determines what level of search filtering to use by default. 'active' - most filtering, 'moderate' - default filtering, - 'off' - no filtering""")) + 'off' - no filtering"""))) # vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: diff --git a/plugins/Google/messages.pot b/plugins/Google/messages.pot new file mode 100644 index 000000000..9493dd858 --- /dev/null +++ b/plugins/Google/messages.pot @@ -0,0 +1,206 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR ORGANIZATION +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2010-10-17 14:50+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 "" +"The Google plugin has the functionality to watch for URLs\n" +" that match a specific pattern. (We call this a snarfer)\n" +" When supybot sees such a URL, it will parse the web page\n" +" for information and reply with the results." +msgstr "" + +#: config.py:43 +msgid "Do you want the Google search snarfer enabled by default?" +msgstr "" + +#: config.py:88 +#, docstring +msgid "Value must be 1 <= n <= 8" +msgstr "" + +#: config.py:99 +msgid "" +"Determines the URL that will be sent to Google for\n" +" the Referer field of the search requests. If this value is empty, a\n" +" Referer will be generated in the following format:\n" +" http://$server/$botName" +msgstr "" + +#: config.py:104 +msgid "" +"Determines whether the search snarfer is\n" +" enabled. If so, messages (even unaddressed ones) beginning with the word\n" +" 'google' will result in the first URL Google returns being sent to the\n" +" channel." +msgstr "" + +#: config.py:109 +msgid "" +"Determines whether the word 'google' in the\n" +" bot's output will be made colorful (like Google's logo)." +msgstr "" + +#: config.py:112 +msgid "Determines whether results are bolded." +msgstr "" + +#: config.py:114 +msgid "" +"Determines the maximum number of results returned\n" +" from the google command." +msgstr "" + +#: config.py:117 +msgid "" +"Determines what default language is used in\n" +" searches. If left empty, no specific language will be requested." +msgstr "" + +#: config.py:117 +msgid "en" +msgstr "" + +#: config.py:120 +msgid "" +"Determines what level of search filtering to use\n" +" by default. 'active' - most filtering, 'moderate' - default filtering,\n" +" 'off' - no filtering" +msgstr "" + +#: plugin.py:101 +#, docstring +msgid "" +"Perform a search using Google's AJAX API.\n" +" search(\"search phrase\", options={})\n" +"\n" +" Valid options are:\n" +" smallsearch - True/False (Default: False)\n" +" filter - {active,moderate,off} (Default: \"moderate\")\n" +" language - Restrict search to documents in the given language\n" +" (Default: \"lang_en\")\n" +" " +msgstr "" + +#: plugin.py:141 plugin.py:192 +msgid "We broke The Google!" +msgstr "" + +#: plugin.py:161 +msgid "No matches found." +msgstr "" + +#: plugin.py:167 +#, docstring +msgid "" +"\n" +"\n" +" Does a google search, but only returns the first result.\n" +" " +msgstr "" + +#: plugin.py:176 +msgid "Google found nothing." +msgstr "" + +#: plugin.py:181 +#, docstring +msgid "" +" [--{filter,language} ]\n" +"\n" +" Searches google.com for the given string. As many results as can fit\n" +" are included. --language accepts a language abbreviation; --filter\n" +" accepts a filtering level ('active', 'moderate', 'off').\n" +" " +msgstr "" + +#: plugin.py:204 +#, docstring +msgid "" +"\n" +"\n" +" Returns a link to the cached version of if it is available.\n" +" " +msgstr "" + +#: plugin.py:215 +msgid "Google seems to have no cache for that site." +msgstr "" + +#: plugin.py:220 +#, docstring +msgid "" +" [ ...]\n" +"\n" +" Returns the results of each search, in order, from greatest number\n" +" of results to least.\n" +" " +msgstr "" + +#: plugin.py:244 +#, docstring +msgid "" +" [to] \n" +"\n" +" Returns translated from into .\n" +" Beware that translating to or from languages that use multi-byte\n" +" characters may result in some very odd results.\n" +" " +msgstr "" + +#: plugin.py:263 +msgid "from language" +msgstr "" + +#: plugin.py:264 plugin.py:273 +msgid "Valid languages are: %L" +msgstr "" + +#: plugin.py:272 +msgid "to language" +msgstr "" + +#: plugin.py:289 +#, docstring +msgid "^google\\s+(.*)$" +msgstr "" + +#: plugin.py:311 +#, docstring +msgid "" +"\n" +"\n" +" Uses Google's calculator to calculate the value of .\n" +" " +msgstr "" + +#: plugin.py:325 +msgid "Google's calculator didn't come up with anything." +msgstr "" + +#: plugin.py:331 +#, docstring +msgid "" +"\n" +"\n" +" Looks up on Google.\n" +" " +msgstr "" + +#: plugin.py:345 +msgid "Google's phonebook didn't come up with anything." +msgstr "" + diff --git a/plugins/Google/plugin.py b/plugins/Google/plugin.py index 2adef8ef3..a0d94d062 100644 --- a/plugins/Google/plugin.py +++ b/plugins/Google/plugin.py @@ -41,6 +41,8 @@ from supybot.commands import * import supybot.ircmsgs as ircmsgs import supybot.ircutils as ircutils import supybot.callbacks as callbacks +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('Google') simplejson = None @@ -94,6 +96,7 @@ class Google(callbacks.PluginRegexp): return msg _gsearchUrl = 'http://ajax.googleapis.com/ajax/services/search/web' + @internationalizeDocstring def search(self, query, channel, options={}): """Perform a search using Google's AJAX API. search("search phrase", options={}) @@ -135,7 +138,7 @@ class Google(callbacks.PluginRegexp): json = simplejson.load(fd) fd.close() if json['responseStatus'] != 200: - raise callbacks.Error, 'We broke The Google!' + raise callbacks.Error, _('We broke The Google!') return json def formatData(self, data, bold=True, max=0): @@ -155,10 +158,11 @@ class Google(callbacks.PluginRegexp): else: results.append(url) if not results: - return format('No matches found.') + return format(_('No matches found.')) else: return format('; '.join(results)) + @internationalizeDocstring def lucky(self, irc, msg, args, text): """ @@ -169,9 +173,10 @@ class Google(callbacks.PluginRegexp): url = data['responseData']['results'][0]['unescapedUrl'] irc.reply(url.encode('utf-8')) else: - irc.reply('Google found nothing.') + irc.reply(_('Google found nothing.')) lucky = wrap(lucky, ['text']) + @internationalizeDocstring def google(self, irc, msg, args, optlist, text): """ [--{filter,language} ] @@ -184,7 +189,7 @@ class Google(callbacks.PluginRegexp): irc.errorInvalid('language') data = self.search(text, msg.args[0], dict(optlist)) if data['responseStatus'] != 200: - irc.reply('We broke The Google!') + irc.reply(_('We broke The Google!')) return bold = self.registryValue('bold', msg.args[0]) max = self.registryValue('maximumResults', msg.args[0]) @@ -194,6 +199,7 @@ class Google(callbacks.PluginRegexp): 'filter':''}), 'text']) + @internationalizeDocstring def cache(self, irc, msg, args, url): """ @@ -206,9 +212,10 @@ class Google(callbacks.PluginRegexp): url = m['cacheUrl'].encode('utf-8') irc.reply(url) return - irc.error('Google seems to have no cache for that site.') + irc.error(_('Google seems to have no cache for that site.')) cache = wrap(cache, ['url']) + @internationalizeDocstring def fight(self, irc, msg, args): """ [ ...] @@ -232,6 +239,7 @@ class Google(callbacks.PluginRegexp): irc.reply(s) _gtranslateUrl='http://ajax.googleapis.com/ajax/services/language/translate' + @internationalizeDocstring def translate(self, irc, msg, args, fromLang, toLang, text): """ [to] @@ -252,8 +260,8 @@ class Google(callbacks.PluginRegexp): fromLang = lang.transLangs[fromLang.capitalize()] elif lang.normalize('lang_'+fromLang)[5:] \ not in lang.transLangs.values(): - irc.errorInvalid('from language', fromLang, - format('Valid languages are: %L', + irc.errorInvalid(_('from language'), fromLang, + format(_('Valid languages are: %L'), lang.transLangs.keys())) else: fromLang = lang.normalize('lang_'+fromLang)[5:] @@ -261,8 +269,8 @@ class Google(callbacks.PluginRegexp): toLang = lang.transLangs[toLang.capitalize()] elif lang.normalize('lang_'+toLang)[5:] \ not in lang.transLangs.values(): - irc.errorInvalid('to language', toLang, - format('Valid languages are: %L', + irc.errorInvalid(_('to language'), toLang, + format(_('Valid languages are: %L'), lang.transLangs.keys())) else: toLang = lang.normalize('lang_'+toLang)[5:] @@ -298,6 +306,7 @@ class Google(callbacks.PluginRegexp): _calcSupRe = re.compile(r'(.*?)', re.I) _calcFontRe = re.compile(r'(.*?)') _calcTimesRe = re.compile(r'&(?:times|#215);') + @internationalizeDocstring def calc(self, irc, msg, args, expr): """ @@ -313,10 +322,11 @@ class Google(callbacks.PluginRegexp): s = self._calcTimesRe.sub(r'*', s) irc.reply(s) else: - irc.reply('Google\'s calculator didn\'t come up with anything.') + irc.reply(_('Google\'s calculator didn\'t come up with anything.')) calc = wrap(calc, ['text']) _phoneRe = re.compile(r'Phonebook.*?(.*?) @@ -332,7 +342,7 @@ class Google(callbacks.PluginRegexp): s = utils.web.htmlToText(s) irc.reply(s) else: - irc.reply('Google\'s phonebook didn\'t come up with anything.') + irc.reply(_('Google\'s phonebook didn\'t come up with anything.')) phonebook = wrap(phonebook, ['text']) From 203fe3c56a72d6df150f15fb1c18e5f43f006454 Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Sun, 17 Oct 2010 15:36:26 +0200 Subject: [PATCH 06/10] Internationalize Herald, Internet, Karma, Lart, Later, Limiter, Math, and Misc --- plugins/Herald/config.py | 34 ++--- plugins/Herald/messages.pot | 140 +++++++++++++++++++++ plugins/Herald/plugin.py | 13 +- plugins/Internet/config.py | 4 +- plugins/Internet/messages.pot | 85 +++++++++++++ plugins/Internet/plugin.py | 29 +++-- plugins/Karma/config.py | 26 ++-- plugins/Karma/messages.pot | 137 ++++++++++++++++++++ plugins/Karma/plugin.py | 28 +++-- plugins/Lart/config.py | 8 +- plugins/Lart/messages.pot | 54 ++++++++ plugins/Lart/plugin.py | 15 ++- plugins/Later/config.py | 11 +- plugins/Later/messages.pot | 101 +++++++++++++++ plugins/Later/plugin.py | 22 ++-- plugins/Limiter/config.py | 14 ++- plugins/Limiter/messages.pot | 50 ++++++++ plugins/Limiter/plugin.py | 4 +- plugins/Math/config.py | 4 +- plugins/Math/messages.pot | 129 +++++++++++++++++++ plugins/Math/plugin.py | 40 +++--- plugins/Misc/config.py | 18 +-- plugins/Misc/messages.pot | 230 ++++++++++++++++++++++++++++++++++ plugins/Misc/plugin.py | 71 ++++++----- 24 files changed, 1131 insertions(+), 136 deletions(-) create mode 100644 plugins/Herald/messages.pot create mode 100644 plugins/Internet/messages.pot create mode 100644 plugins/Karma/messages.pot create mode 100644 plugins/Lart/messages.pot create mode 100644 plugins/Later/messages.pot create mode 100644 plugins/Limiter/messages.pot create mode 100644 plugins/Math/messages.pot create mode 100644 plugins/Misc/messages.pot diff --git a/plugins/Herald/config.py b/plugins/Herald/config.py index 1f96464f8..7c5cbac1d 100644 --- a/plugins/Herald/config.py +++ b/plugins/Herald/config.py @@ -29,6 +29,8 @@ import supybot.conf as conf import supybot.registry as registry +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('Heral') def configure(advanced): # This will be called by supybot to configure this module. advanced is @@ -41,31 +43,31 @@ def configure(advanced): Herald = conf.registerPlugin('Herald') conf.registerChannelValue(Herald, 'heralding', - registry.Boolean(True, """Determines whether messages will be sent to the + registry.Boolean(True, _("""Determines whether messages will be sent to the channel when a recognized user joins; basically enables or disables the - plugin.""")) + plugin."""))) conf.registerGlobalValue(Herald, 'requireCapability', - registry.String('', """Determines what capability (if any) is required to - add/change/remove the herald of another user.""")) + registry.String('', _("""Determines what capability (if any) is required to + add/change/remove the herald of another user."""))) conf.registerChannelValue(Herald, 'throttle', - registry.PositiveInteger(600, """Determines the minimum number of seconds - between heralds.""")) + registry.PositiveInteger(600, _("""Determines the minimum number of seconds + between heralds."""))) conf.registerChannelValue(Herald.throttle, 'afterPart', - registry.NonNegativeInteger(0, """Determines the minimum number of seconds + registry.NonNegativeInteger(0, _("""Determines the minimum number of seconds after parting that the bot will not herald the person when he or she - rejoins.""")) + rejoins."""))) conf.registerChannelValue(Herald.throttle, 'afterSplit', - registry.NonNegativeInteger(60, """Determines the minimum number of seconds - after a netsplit that the bot will not herald the users that split.""")) + registry.NonNegativeInteger(60, _("""Determines the minimum number of seconds + after a netsplit that the bot will not herald the users that split."""))) conf.registerChannelValue(Herald, 'default', - registry.String('', """Sets the default herald to use. If a user has a + registry.String('', _("""Sets the default herald to use. If a user has a personal herald specified, that will be used instead. If set to the empty - string, the default herald will be disabled.""")) + string, the default herald will be disabled."""))) conf.registerChannelValue(Herald.default, 'notice', - registry.Boolean(True, """Determines whether the default herald will be - sent as a NOTICE instead of a PRIVMSG.""")) + registry.Boolean(True, _("""Determines whether the default herald will be + sent as a NOTICE instead of a PRIVMSG."""))) conf.registerChannelValue(Herald.default, 'public', - registry.Boolean(False, """Determines whether the default herald will be - sent publicly.""")) + registry.Boolean(False, _("""Determines whether the default herald will be + sent publicly."""))) # vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: diff --git a/plugins/Herald/messages.pot b/plugins/Herald/messages.pot new file mode 100644 index 000000000..61aec5e7d --- /dev/null +++ b/plugins/Herald/messages.pot @@ -0,0 +1,140 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR ORGANIZATION +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2010-10-17 15:21+CEST\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \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 messages will be sent to the\n" +" channel when a recognized user joins; basically enables or disables the\n" +" plugin." +msgstr "" + +#: config.py:50 +msgid "" +"Determines what capability (if any) is required to\n" +" add/change/remove the herald of another user." +msgstr "" + +#: config.py:53 +msgid "" +"Determines the minimum number of seconds\n" +" between heralds." +msgstr "" + +#: config.py:56 +msgid "" +"Determines the minimum number of seconds\n" +" after parting that the bot will not herald the person when he or she\n" +" rejoins." +msgstr "" + +#: config.py:60 +msgid "" +"Determines the minimum number of seconds\n" +" after a netsplit that the bot will not herald the users that split." +msgstr "" + +#: config.py:63 +msgid "" +"Sets the default herald to use. If a user has a\n" +" personal herald specified, that will be used instead. If set to the empty\n" +" string, the default herald will be disabled." +msgstr "" + +#: config.py:67 +msgid "" +"Determines whether the default herald will be\n" +" sent as a NOTICE instead of a PRIVMSG." +msgstr "" + +#: config.py:70 +msgid "" +"Determines whether the default herald will be\n" +" sent publicly." +msgstr "" + +#: plugin.py:143 +#, docstring +msgid "" +"[] [--remove|]\n" +"\n" +" If is given, sets the default herald to . A of \"\"\n" +" will remove the default herald. If is not given, returns the\n" +" current default herald. is only necessary if the message\n" +" isn't sent in the channel itself.\n" +" " +msgstr "" + +#: plugin.py:162 +msgid "I do not have a default herald set for %s." +msgstr "" + +#: plugin.py:170 +#, docstring +msgid "" +"[] []\n" +"\n" +" Returns the current herald message for (or the user\n" +" is currently identified or recognized as). If \n" +" is not given, defaults to the user giving the command. \n" +" is only necessary if the message isn't sent in the channel itself.\n" +" " +msgstr "" + +#: plugin.py:181 +msgid "I have no herald for %s." +msgstr "" + +#: plugin.py:201 +#, docstring +msgid "" +"[] \n" +"\n" +" Sets the herald message for (or the user is\n" +" currently identified or recognized as) to . is only\n" +" necessary if the message isn't sent in the channel itself.\n" +" " +msgstr "" + +#: plugin.py:214 +#, docstring +msgid "" +"[] []\n" +"\n" +" Removes the herald message set for , or the user\n" +" is currently identified or recognized as. If \n" +" is not given, defaults to the user giving the command.\n" +" is only necessary if the message isn't sent in the channel\n" +" itself.\n" +" " +msgstr "" + +#: plugin.py:227 +msgid "I have no herald for that user." +msgstr "" + +#: plugin.py:232 +#, docstring +msgid "" +"[] [] \n" +"\n" +" Changes the herald message for , or the user is\n" +" currently identified or recognized as, according to . If\n" +" is not given, defaults to the calling user. is only\n" +" necessary if the message isn't sent in the channel itself.\n" +" " +msgstr "" + diff --git a/plugins/Herald/plugin.py b/plugins/Herald/plugin.py index 5069c51e3..e4b99bd40 100644 --- a/plugins/Herald/plugin.py +++ b/plugins/Herald/plugin.py @@ -40,6 +40,8 @@ import supybot.plugins as plugins import supybot.ircutils as ircutils import supybot.callbacks as callbacks from supybot.utils.structures import TimeoutQueue +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('Heral') filename = conf.supybot.directories.data.dirize('Herald.db') @@ -136,6 +138,7 @@ class Herald(callbacks.Plugin): raise KeyError return id + @internationalizeDocstring def default(self, irc, msg, args, channel, optlist, text): """[] [--remove|] @@ -156,12 +159,13 @@ class Herald(callbacks.Plugin): irc.replySuccess() else: resp = self.registryValue('default', channel) or \ - 'I do not have a default herald set for %s.' % channel + _('I do not have a default herald set for %s.') % channel irc.reply(resp) default = wrap(default, ['channel', getopts({'remove': ''}), additional('text')]) + @internationalizeDocstring def get(self, irc, msg, args, channel, user): """[] [] @@ -174,7 +178,7 @@ class Herald(callbacks.Plugin): herald = self.db[channel, user.id] irc.reply(herald) except KeyError: - irc.error('I have no herald for %s.' % user.name) + irc.error(_('I have no herald for %s.') % user.name) get = wrap(get, ['channel', first('otherUser', 'user')]) def _preCheck(self, irc, msg, user): @@ -192,6 +196,7 @@ class Herald(callbacks.Plugin): # I chose not to make optional in this command because # if it's not a valid username (e.g., if the user tyops and misspells a # username), it may be nice not to clobber the user's herald. + @internationalizeDocstring def add(self, irc, msg, args, channel, user, herald): """[] @@ -204,6 +209,7 @@ class Herald(callbacks.Plugin): irc.replySuccess() add = wrap(add, ['channel', 'otherUser', 'text']) + @internationalizeDocstring def remove(self, irc, msg, args, channel, user): """[] [] @@ -218,9 +224,10 @@ class Herald(callbacks.Plugin): del self.db[channel, user.id] irc.replySuccess() except KeyError: - irc.error('I have no herald for that user.') + irc.error(_('I have no herald for that user.')) remove = wrap(remove, ['channel', first('otherUser', 'user')]) + @internationalizeDocstring def change(self, irc, msg, args, channel, user, changer): """[] [] diff --git a/plugins/Internet/config.py b/plugins/Internet/config.py index 118f805a2..cf7ff92c6 100644 --- a/plugins/Internet/config.py +++ b/plugins/Internet/config.py @@ -29,6 +29,8 @@ import supybot.conf as conf import supybot.registry as registry +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('Internet') def configure(advanced): # This will be called by supybot to configure this module. advanced is @@ -42,7 +44,7 @@ def configure(advanced): Internet = conf.registerPlugin('Internet') # This is where your configuration variables (if any) should go. For example: # conf.registerGlobalValue(Internet, 'someConfigVariableName', -# registry.Boolean(False, """Help for someConfigVariableName.""")) +# registry.Boolean(False, _("""Help for someConfigVariableName."""))) # vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: diff --git a/plugins/Internet/messages.pot b/plugins/Internet/messages.pot new file mode 100644 index 000000000..5f6f82699 --- /dev/null +++ b/plugins/Internet/messages.pot @@ -0,0 +1,85 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR ORGANIZATION +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2010-10-17 15:20+CEST\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \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:43 +#, docstring +msgid "Add the help for \"@help Internet\" here." +msgstr "" + +#: plugin.py:47 +#, docstring +msgid "" +"\n" +"\n" +" Returns the ip of or the reverse DNS hostname of .\n" +" " +msgstr "" + +#: plugin.py:54 plugin.py:61 plugin.py:65 +msgid "Host not found." +msgstr "" + +#: plugin.py:77 +#, docstring +msgid "" +"\n" +"\n" +" Returns WHOIS information on the registration of .\n" +" " +msgstr "" + +#: plugin.py:83 +msgid "domain" +msgstr "" + +#: plugin.py:112 +msgid "updated %s" +msgstr "" + +#: plugin.py:115 +msgid "registered %s" +msgstr "" + +#: plugin.py:118 +msgid "expires %s" +msgstr "" + +#: plugin.py:138 +msgid " " +msgstr "" + +#: plugin.py:140 +msgid " " +msgstr "" + +#: plugin.py:145 +msgid "%s%s is %L." +msgstr "" + +#: plugin.py:148 +msgid "I couldn't find such a domain." +msgstr "" + +#: plugin.py:153 +#, docstring +msgid "" +"\n" +"\n" +" Returns the hexadecimal IP for that IP.\n" +" " +msgstr "" + diff --git a/plugins/Internet/plugin.py b/plugins/Internet/plugin.py index 490c9165c..4c33dcf3b 100644 --- a/plugins/Internet/plugin.py +++ b/plugins/Internet/plugin.py @@ -35,11 +35,14 @@ import supybot.utils as utils from supybot.commands import * from supybot.utils.iter import any import supybot.callbacks as callbacks +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('Internet') - +@internationalizeDocstring class Internet(callbacks.Plugin): """Add the help for "@help Internet" here.""" threaded = True + @internationalizeDocstring def dns(self, irc, msg, args, host): """ @@ -48,18 +51,18 @@ class Internet(callbacks.Plugin): if utils.net.isIP(host): hostname = socket.getfqdn(host) if hostname == host: - irc.reply('Host not found.') + irc.reply(_('Host not found.')) else: irc.reply(hostname) else: try: ip = socket.gethostbyname(host) if ip == '64.94.110.11': # Verisign sucks! - irc.reply('Host not found.') + irc.reply(_('Host not found.')) else: irc.reply(ip) except socket.error: - irc.reply('Host not found.') + irc.reply(_('Host not found.')) dns = wrap(dns, ['something']) _domain = ['Domain Name', 'Server Name', 'domain'] @@ -69,6 +72,7 @@ class Internet(callbacks.Plugin): _created = ['Created On', 'Domain Registration Date', 'Creation Date'] _expires = ['Expiration Date', 'Domain Expiration Date'] _status = ['Status', 'Domain Status', 'status'] + @internationalizeDocstring def whois(self, irc, msg, args, domain): """ @@ -76,7 +80,7 @@ class Internet(callbacks.Plugin): """ usertld = domain.split('.')[-1] if '.' not in domain: - irc.errorInvalid('domain') + irc.errorInvalid(_('domain')) return try: t = telnetlib.Telnet('%s.whois-servers.net' % usertld, 43) @@ -105,13 +109,13 @@ class Internet(callbacks.Plugin): registrar = ':'.join(line.split(':')[1:]).strip() elif not updated and any(line.startswith, self._updated): s = ':'.join(line.split(':')[1:]).strip() - updated = 'updated %s' % s + updated = _('updated %s') % s elif not created and any(line.startswith, self._created): s = ':'.join(line.split(':')[1:]).strip() - created = 'registered %s' % s + created = _('registered %s') % s elif not expires and any(line.startswith, self._expires): s = ':'.join(line.split(':')[1:]).strip() - expires = 'expires %s' % s + expires = _('expires %s') % s elif not status and any(line.startswith, self._status): status = ':'.join(line.split(':')[1:]).strip().lower() if not status: @@ -131,19 +135,20 @@ class Internet(callbacks.Plugin): if not line: continue if line.startswith('Email'): - url = ' ' % line.split('@')[-1] + url = _(' ') % line.split('@')[-1] elif line.startswith('Registrar Organization:'): - url = ' ' % line.split(':')[1].strip() + url = _(' ') % line.split(':')[1].strip() elif line == 'Not a valid ID pattern': url = '' if server and status: info = filter(None, [status, created, updated, expires]) - s = format('%s%s is %L.', server, url, info) + s = format(_('%s%s is %L.'), server, url, info) irc.reply(s) else: - irc.error('I couldn\'t find such a domain.') + irc.error(_('I couldn\'t find such a domain.')) whois = wrap(whois, ['lowered']) + @internationalizeDocstring def hexip(self, irc, msg, args, ip): """ diff --git a/plugins/Karma/config.py b/plugins/Karma/config.py index f2ae97196..b43dd011c 100644 --- a/plugins/Karma/config.py +++ b/plugins/Karma/config.py @@ -29,6 +29,8 @@ import supybot.conf as conf import supybot.registry as registry +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('Karma') def configure(advanced): # This will be called by supybot to configure this module. advanced is @@ -41,22 +43,22 @@ def configure(advanced): conf.registerPlugin('Karma') conf.registerChannelValue(conf.supybot.plugins.Karma, 'simpleOutput', - registry.Boolean(False, """Determines whether the bot will output shorter - versions of the karma output when requesting a single thing's karma.""")) + registry.Boolean(False, _("""Determines whether the bot will output shorter + versions of the karma output when requesting a single thing's karma."""))) conf.registerChannelValue(conf.supybot.plugins.Karma, 'response', - registry.Boolean(False, """Determines whether the bot will reply with a - success message when something's karma is increased or decreased.""")) + registry.Boolean(False, _("""Determines whether the bot will reply with a + success message when something's karma is increased or decreased."""))) conf.registerChannelValue(conf.supybot.plugins.Karma, 'rankingDisplay', - registry.Integer(3, """Determines how many highest/lowest karma things are - shown when karma is called with no arguments.""")) + registry.Integer(3, _("""Determines how many highest/lowest karma things + are shown when karma is called with no arguments."""))) conf.registerChannelValue(conf.supybot.plugins.Karma, 'mostDisplay', - registry.Integer(25, """Determines how many karma things are shown when - the most command is called.'""")) + registry.Integer(25, _("""Determines how many karma things are shown when + the most command is called.'"""))) conf.registerChannelValue(conf.supybot.plugins.Karma, 'allowSelfRating', - registry.Boolean(False, """Determines whether users can adjust the karma - of their nick.""")) + registry.Boolean(False, _("""Determines whether users can adjust the karma + of their nick."""))) conf.registerChannelValue(conf.supybot.plugins.Karma, 'allowUnaddressedKarma', - registry.Boolean(False, """Determines whether the bot will - increase/decrease karma without being addressed.""")) + registry.Boolean(False, _("""Determines whether the bot will + increase/decrease karma without being addressed."""))) # vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: diff --git a/plugins/Karma/messages.pot b/plugins/Karma/messages.pot new file mode 100644 index 000000000..8fd166f04 --- /dev/null +++ b/plugins/Karma/messages.pot @@ -0,0 +1,137 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR ORGANIZATION +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2010-10-17 15:21+CEST\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \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 bot will output shorter\n" +" versions of the karma output when requesting a single thing's karma." +msgstr "" + +#: config.py:49 +msgid "" +"Determines whether the bot will reply with a\n" +" success message when something's karma is increased or decreased." +msgstr "" + +#: config.py:52 +msgid "" +"Determines how many highest/lowest karma things\n" +" are shown when karma is called with no arguments." +msgstr "" + +#: config.py:55 +msgid "" +"Determines how many karma things are shown when\n" +" the most command is called.'" +msgstr "" + +#: config.py:58 +msgid "" +"Determines whether users can adjust the karma\n" +" of their nick." +msgstr "" + +#: config.py:61 +msgid "" +"Determines whether the bot will\n" +" increase/decrease karma without being addressed." +msgstr "" + +#: plugin.py:243 plugin.py:251 +msgid "You're not allowed to adjust your own karma." +msgstr "" + +#: plugin.py:280 +#, docstring +msgid "" +"[] [ ...]\n" +"\n" +" Returns the karma of . If is not given, returns the top\n" +" N karmas, where N is determined by the config variable\n" +" supybot.plugins.Karma.rankingDisplay. If one is given, returns\n" +" the details of its karma; if more than one is given, returns\n" +" the total karma of each of the the things. is only necessary\n" +" if the message isn't sent on the channel itself.\n" +" " +msgstr "" + +#: plugin.py:293 +msgid "%s has neutral karma." +msgstr "" + +#: plugin.py:300 +msgid "Karma for %q has been increased %n and decreased %n for a total karma of %s." +msgstr "" + +#: plugin.py:315 +msgid "I didn't know the karma for any of those things." +msgstr "" + +#: plugin.py:325 plugin.py:354 +msgid "I have no karma for this channel." +msgstr "" + +#: plugin.py:330 +msgid " You (%s) are ranked %i out of %i." +msgstr "" + +#: plugin.py:334 +msgid "Highest karma: %L. Lowest karma: %L.%s" +msgstr "" + +#: plugin.py:342 +#, docstring +msgid "" +"[] {increased,decreased,active}\n" +"\n" +" Returns the most increased, the most decreased, or the most active\n" +" (the sum of increased and decreased) karma things. is only\n" +" necessary if the message isn't sent in the channel itself.\n" +" " +msgstr "" + +#: plugin.py:360 +#, docstring +msgid "" +"[] \n" +"\n" +" Resets the karma of to 0.\n" +" " +msgstr "" + +#: plugin.py:370 +#, docstring +msgid "" +"[] \n" +"\n" +" Dumps the Karma database for to in the bot's\n" +" data directory. is only necessary if the message isn't sent\n" +" in the channel itself.\n" +" " +msgstr "" + +#: plugin.py:382 +#, docstring +msgid "" +"[] \n" +"\n" +" Loads the Karma database for from in the bot's\n" +" data directory. is only necessary if the message isn't sent\n" +" in the channel itself.\n" +" " +msgstr "" + diff --git a/plugins/Karma/plugin.py b/plugins/Karma/plugin.py index 02570b5af..af2191619 100644 --- a/plugins/Karma/plugin.py +++ b/plugins/Karma/plugin.py @@ -38,6 +38,8 @@ import supybot.plugins as plugins import supybot.ircmsgs as ircmsgs import supybot.ircutils as ircutils import supybot.callbacks as callbacks +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('Karma') class SqliteKarmaDB(object): def __init__(self, filename): @@ -238,7 +240,7 @@ class Karma(callbacks.Plugin): thing = thing[:-2] if ircutils.strEqual(thing, irc.msg.nick) and \ not self.registryValue('allowSelfRating', channel): - irc.error('You\'re not allowed to adjust your own karma.') + irc.error(_('You\'re not allowed to adjust your own karma.')) elif thing: self.db.increment(channel, self._normalizeThing(thing)) self._respond(irc, channel) @@ -246,7 +248,7 @@ class Karma(callbacks.Plugin): thing = thing[:-2] if ircutils.strEqual(thing, irc.msg.nick) and \ not self.registryValue('allowSelfRating', channel): - irc.error('You\'re not allowed to adjust your own karma.') + irc.error(_('You\'re not allowed to adjust your own karma.')) elif thing: self.db.decrement(channel, self._normalizeThing(thing)) self._respond(irc, channel) @@ -273,6 +275,7 @@ class Karma(callbacks.Plugin): if thing[-2:] in ('++', '--'): self._doKarma(irc, channel, thing) + @internationalizeDocstring def karma(self, irc, msg, args, channel, things): """[] [ ...] @@ -287,15 +290,15 @@ class Karma(callbacks.Plugin): name = things[0] t = self.db.get(channel, name) if t is None: - irc.reply(format('%s has neutral karma.', name)) + irc.reply(format(_('%s has neutral karma.'), name)) else: (added, subtracted) = t total = added - subtracted if self.registryValue('simpleOutput', channel): s = format('%s: %i', name, total) else: - s = format('Karma for %q has been increased %n and ' - 'decreased %n for a total karma of %s.', + s = format(_('Karma for %q has been increased %n and ' + 'decreased %n for a total karma of %s.'), name, (added, 'time'), (subtracted, 'time'), total) irc.reply(s) @@ -309,7 +312,8 @@ class Karma(callbacks.Plugin): s += neutral irc.reply(s + '.') else: - irc.reply('I didn\'t know the karma for any of those things.') + irc.reply(_('I didn\'t know the karma for any of those ' + 'things.')) else: # No name was given. Return the top/bottom N karmas. limit = self.registryValue('rankingDisplay', channel) top = self.db.top(channel, limit) @@ -318,21 +322,22 @@ class Karma(callbacks.Plugin): lowest = [format('%q (%s)', s, t) for (s, t) in self.db.bottom(channel, limit)] if not (highest and lowest): - irc.error('I have no karma for this channel.') + irc.error(_('I have no karma for this channel.')) return rank = self.db.rank(channel, msg.nick) if rank is not None: total = self.db.size(channel) - rankS = format(' You (%s) are ranked %i out of %i.', + rankS = format(_(' You (%s) are ranked %i out of %i.'), msg.nick, rank, total) else: rankS = '' - s = format('Highest karma: %L. Lowest karma: %L.%s', + s = format(_('Highest karma: %L. Lowest karma: %L.%s'), highest, lowest, rankS) irc.reply(s) karma = wrap(karma, ['channel', any('something')]) _mostAbbrev = utils.abbrev(['increased', 'decreased', 'active']) + @internationalizeDocstring def most(self, irc, msg, args, channel, kind): """[] {increased,decreased,active} @@ -346,10 +351,11 @@ class Karma(callbacks.Plugin): L = [format('%q: %i', name, i) for (name, i) in L] irc.reply(format('%L', L)) else: - irc.error('I have no karma for this channel.') + irc.error(_('I have no karma for this channel.')) most = wrap(most, ['channel', ('literal', ['increased', 'decreased', 'active'])]) + @internationalizeDocstring def clear(self, irc, msg, args, channel, name): """[] @@ -359,6 +365,7 @@ class Karma(callbacks.Plugin): irc.replySuccess() clear = wrap(clear, [('checkChannelCapability', 'op'), 'text']) + @internationalizeDocstring def dump(self, irc, msg, args, channel, filename): """[] @@ -370,6 +377,7 @@ class Karma(callbacks.Plugin): irc.replySuccess() dump = wrap(dump, [('checkCapability', 'owner'), 'channeldb', 'filename']) + @internationalizeDocstring def load(self, irc, msg, args, channel, filename): """[] diff --git a/plugins/Lart/config.py b/plugins/Lart/config.py index f3c83e7a7..3ad4aab1f 100644 --- a/plugins/Lart/config.py +++ b/plugins/Lart/config.py @@ -29,6 +29,8 @@ import supybot.conf as conf import supybot.registry as registry +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('Lart') def configure(advanced): # This will be called by supybot to configure this module. advanced is @@ -42,10 +44,10 @@ def configure(advanced): Lart = conf.registerPlugin('Lart') # This is where your configuration variables (if any) should go. For example: # conf.registerGlobalValue(Lart, 'someConfigVariableName', -# registry.Boolean(False, """Help for someConfigVariableName.""")) +# registry.Boolean(False, _("""Help for someConfigVariableName."""))) conf.registerChannelValue(Lart, 'showIds', - registry.Boolean(False, """Determines whether the bot will show the ids of - a lart when the lart is given.""")) + registry.Boolean(False, _("""Determines whether the bot will show the ids + of a lart when the lart is given."""))) # vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: diff --git a/plugins/Lart/messages.pot b/plugins/Lart/messages.pot new file mode 100644 index 000000000..a290a2605 --- /dev/null +++ b/plugins/Lart/messages.pot @@ -0,0 +1,54 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR ORGANIZATION +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2010-10-17 15:21+CEST\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \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 show the ids\n" +" of a lart when the lart is given." +msgstr "" + +#: plugin.py:48 +msgid "Larts must contain $who." +msgstr "" + +#: plugin.py:52 +#, docstring +msgid "" +"[] [] [for ]\n" +"\n" +" Uses the Luser Attitude Readjustment Tool on (for ,\n" +" if given). If is given, uses that specific lart. is\n" +" only necessary if the message isn't sent in the channel itself.\n" +" " +msgstr "" + +#: plugin.py:66 +msgid "There is no lart with id #%i." +msgstr "" + +#: plugin.py:71 +msgid "There are no larts in my database for %s." +msgstr "" + +#: plugin.py:77 +msgid "trying to dis me" +msgstr "" + +#: plugin.py:85 +msgid " for " +msgstr "" + diff --git a/plugins/Lart/plugin.py b/plugins/Lart/plugin.py index 1d1c5c6a6..aed197614 100644 --- a/plugins/Lart/plugin.py +++ b/plugins/Lart/plugin.py @@ -32,6 +32,8 @@ import re from supybot.commands import * import supybot.plugins as plugins import supybot.ircutils as ircutils +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('Lart') class Lart(plugins.ChannelIdDatabasePlugin): _meRe = re.compile(r'\bme\b', re.I) @@ -43,8 +45,9 @@ class Lart(plugins.ChannelIdDatabasePlugin): def addValidator(self, irc, text): if '$who' not in text: - irc.error('Larts must contain $who.', Raise=True) + irc.error(_('Larts must contain $who.'), Raise=True) + @internationalizeDocstring def lart(self, irc, msg, args, channel, id, text): """[] [] [for ] @@ -60,18 +63,18 @@ class Lart(plugins.ChannelIdDatabasePlugin): try: lart = self.db.get(channel, id) except KeyError: - irc.error(format('There is no lart with id #%i.', id)) + irc.error(format(_('There is no lart with id #%i.'), id)) return else: lart = self.db.random(channel) if not lart: - irc.error(format('There are no larts in my database ' - 'for %s.', channel)) + irc.error(format(_('There are no larts in my database ' + 'for %s.'), channel)) return text = lart.text if ircutils.strEqual(target, irc.nick): target = msg.nick - reason = self._replaceFirstPerson('trying to dis me', irc.nick) + reason = self._replaceFirstPerson(_('trying to dis me'), irc.nick) else: target = self._replaceFirstPerson(target, msg.nick) reason = self._replaceFirstPerson(reason, msg.nick) @@ -79,7 +82,7 @@ class Lart(plugins.ChannelIdDatabasePlugin): target = target.rstrip('.') text = text.replace('$who', target) if reason: - text += ' for ' + reason + text += _(' for ') + reason if self.registryValue('showIds', channel): text += format(' (#%i)', lart.id) irc.reply(text, action=True) diff --git a/plugins/Later/config.py b/plugins/Later/config.py index 97ddde7ca..fd1e96a92 100644 --- a/plugins/Later/config.py +++ b/plugins/Later/config.py @@ -29,6 +29,8 @@ import supybot.conf as conf import supybot.registry as registry +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('Later') def configure(advanced): # This will be called by setup.py to configure this module. Advanced is @@ -40,10 +42,11 @@ def configure(advanced): Later = conf.registerPlugin('Later') conf.registerGlobalValue(Later, 'maximum', - registry.NonNegativeInteger(0, """Determines the maximum number of messages - to be queued for a user. If this value is 0, there is no maximum.""")) + registry.NonNegativeInteger(0, _("""Determines the maximum number of + messages to be queued for a user. If this value is 0, there is no maximum. + """))) conf.registerGlobalValue(Later, 'private', - registry.Boolean(True, """Determines whether users will be notified in the - first place in which they're seen, or in private.""")) + registry.Boolean(True, _("""Determines whether users will be notified in + the first place in which they're seen, or in private."""))) # vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: diff --git a/plugins/Later/messages.pot b/plugins/Later/messages.pot new file mode 100644 index 000000000..719e65ef8 --- /dev/null +++ b/plugins/Later/messages.pot @@ -0,0 +1,101 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR ORGANIZATION +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2010-10-17 15:21+CEST\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \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 maximum number of\n" +" messages to be queued for a user. If this value is 0, there is no maximum.\n" +" " +msgstr "" + +#: config.py:49 +msgid "" +"Determines whether users will be notified in\n" +" the first place in which they're seen, or in private." +msgstr "" + +#: plugin.py:47 +#, docstring +msgid "" +"Used to do things later; currently, it only allows the sending of\n" +" nick-based notes. Do note (haha!) that these notes are *not* private\n" +" and don't even pretend to be; if you want such features, consider using the\n" +" Note plugin." +msgstr "" + +#: plugin.py:87 +msgid "just now" +msgstr "" + +#: plugin.py:108 +#, docstring +msgid "" +" \n" +"\n" +" Tells the next time is in seen. can\n" +" contain wildcard characters, and the first matching nick will be\n" +" given the note.\n" +" " +msgstr "" + +#: plugin.py:115 +msgid "I can't send notes to myself." +msgstr "" + +#: plugin.py:121 +msgid "That person's message queue is already full." +msgstr "" + +#: plugin.py:126 +#, docstring +msgid "" +"[]\n" +"\n" +" If is given, replies with what notes are waiting on ,\n" +" otherwise, replies with the nicks that have notes waiting for them.\n" +" " +msgstr "" + +#: plugin.py:137 +msgid "I have no notes for that nick." +msgstr "" + +#: plugin.py:142 +msgid "I currently have notes waiting for %L." +msgstr "" + +#: plugin.py:145 +msgid "I have no notes waiting to be delivered." +msgstr "" + +#: plugin.py:150 +#, docstring +msgid "" +"\n" +"\n" +" Removes the notes waiting on .\n" +" " +msgstr "" + +#: plugin.py:159 +msgid "There were no notes for %r" +msgstr "" + +#: plugin.py:183 +msgid "Sent %s: <%s> %s" +msgstr "" + diff --git a/plugins/Later/plugin.py b/plugins/Later/plugin.py index 3babf6365..3601a47e2 100644 --- a/plugins/Later/plugin.py +++ b/plugins/Later/plugin.py @@ -38,8 +38,11 @@ from supybot.commands import * import supybot.ircmsgs as ircmsgs import supybot.ircutils as ircutils import supybot.callbacks as callbacks +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('Later') +@internationalizeDocstring class Later(callbacks.Plugin): """Used to do things later; currently, it only allows the sending of nick-based notes. Do note (haha!) that these notes are *not* private @@ -81,7 +84,7 @@ class Later(callbacks.Plugin): try: return utils.timeElapsed(diff, seconds=False) + ' ago' except ValueError: - return 'just now' + return _('just now') def _addNote(self, nick, whence, text, at=None, maximum=None): if at is None: @@ -100,6 +103,7 @@ class Later(callbacks.Plugin): self.wildcards.append(nick) self._flushNotes() + @internationalizeDocstring def tell(self, irc, msg, args, nick, text): """ @@ -108,15 +112,16 @@ class Later(callbacks.Plugin): given the note. """ if ircutils.strEqual(nick, irc.nick): - irc.error('I can\'t send notes to myself.') + irc.error(_('I can\'t send notes to myself.')) return try: self._addNote(nick, msg.nick, text) irc.replySuccess() except ValueError: - irc.error('That person\'s message queue is already full.') + irc.error(_('That person\'s message queue is already full.')) tell = wrap(tell, ['something', 'text']) + @internationalizeDocstring def notes(self, irc, msg, args, nick): """[] @@ -129,17 +134,18 @@ class Later(callbacks.Plugin): for (when, whence, note) in self._notes[nick]] irc.reply(format('%L', notes)) else: - irc.error('I have no notes for that nick.') + irc.error(_('I have no notes for that nick.')) else: nicks = self._notes.keys() if nicks: utils.sortBy(ircutils.toLower, nicks) - irc.reply(format('I currently have notes waiting for %L.', + irc.reply(format(_('I currently have notes waiting for %L.'), nicks)) else: - irc.error('I have no notes waiting to be delivered.') + irc.error(_('I have no notes waiting to be delivered.')) notes = wrap(notes, [additional('something')]) + @internationalizeDocstring def remove(self, irc, msg, args, nick): """ @@ -150,7 +156,7 @@ class Later(callbacks.Plugin): self._flushNotes() irc.replySuccess() except KeyError: - irc.error('There were no notes for %r' % nick) + irc.error(_('There were no notes for %r') % nick) remove = wrap(remove, [('checkCapability', 'admin'), 'something']) def doPrivmsg(self, irc, msg): @@ -174,7 +180,7 @@ class Later(callbacks.Plugin): self._flushNotes() def _formatNote(self, when, whence, note): - return 'Sent %s: <%s> %s' % (self._timestamp(when), whence, note) + return _('Sent %s: <%s> %s') % (self._timestamp(when), whence, note) diff --git a/plugins/Limiter/config.py b/plugins/Limiter/config.py index a28f8a5b4..64905d240 100644 --- a/plugins/Limiter/config.py +++ b/plugins/Limiter/config.py @@ -29,6 +29,8 @@ import supybot.conf as conf import supybot.registry as registry +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('Limiter') def configure(advanced): # This will be called by supybot to configure this module. advanced is @@ -41,17 +43,17 @@ def configure(advanced): Limiter = conf.registerPlugin('Limiter') conf.registerChannelValue(Limiter, 'enable', - registry.Boolean(False, """Determines whether the bot will maintain the + registry.Boolean(False, _("""Determines whether the bot will maintain the channel limit to be slightly above the current number of people in the - channel, in order to make clone/drone attacks harder.""")) + channel, in order to make clone/drone attacks harder."""))) conf.registerChannelValue(Limiter, 'minimumExcess', - registry.PositiveInteger(5, """Determines the minimum number of free + registry.PositiveInteger(5, _("""Determines the minimum number of free spots that will be saved when limits are being enforced. This should - always be smaller than supybot.plugins.Limiter.limit.maximumExcess.""")) + always be smaller than supybot.plugins.Limiter.limit.maximumExcess."""))) conf.registerChannelValue(Limiter, 'maximumExcess', - registry.PositiveInteger(10, """Determines the maximum number of free spots + registry.PositiveInteger(10, _("""Determines the maximum number of free spots that will be saved when limits are being enforced. This should always be - larger than supybot.plugins.Limiter.limit.minimumExcess.""")) + larger than supybot.plugins.Limiter.limit.minimumExcess."""))) # vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: diff --git a/plugins/Limiter/messages.pot b/plugins/Limiter/messages.pot new file mode 100644 index 000000000..4ec916ea3 --- /dev/null +++ b/plugins/Limiter/messages.pot @@ -0,0 +1,50 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR ORGANIZATION +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2010-10-17 15:35+CEST\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \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 bot will maintain the\n" +" channel limit to be slightly above the current number of people in the\n" +" channel, in order to make clone/drone attacks harder." +msgstr "" + +#: config.py:50 +msgid "" +"Determines the minimum number of free\n" +" spots that will be saved when limits are being enforced. This should\n" +" always be smaller than supybot.plugins.Limiter.limit.maximumExcess." +msgstr "" + +#: config.py:54 +msgid "" +"Determines the maximum number of free spots\n" +" that will be saved when limits are being enforced. This should always be\n" +" larger than supybot.plugins.Limiter.limit.minimumExcess." +msgstr "" + +#: plugin.py:40 +#, docstring +msgid "" +"In order to use this plugin, its config values need to be properly\n" +" setup. supybot.plugins.Limiter.enable needs to be set to True and\n" +" supybot.plugins.Limiter.{maximumExcess,minimumExcess} should be set to\n" +" values appropriate to your channel (if the defaults aren't satisfactory.\n" +" Once these are set, and someone enters/leaves the channel, Supybot will\n" +" start setting the proper +l modes.\n" +" " +msgstr "" + diff --git a/plugins/Limiter/plugin.py b/plugins/Limiter/plugin.py index c3e02cc11..6388c4327 100644 --- a/plugins/Limiter/plugin.py +++ b/plugins/Limiter/plugin.py @@ -32,8 +32,10 @@ from supybot.commands import * import supybot.ircmsgs as ircmsgs import supybot.ircutils as ircutils import supybot.callbacks as callbacks +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('Limiter') - +@internationalizeDocstring class Limiter(callbacks.Plugin): """In order to use this plugin, its config values need to be properly setup. supybot.plugins.Limiter.enable needs to be set to True and diff --git a/plugins/Math/config.py b/plugins/Math/config.py index 73e68ffeb..db6474c78 100644 --- a/plugins/Math/config.py +++ b/plugins/Math/config.py @@ -29,6 +29,8 @@ import supybot.conf as conf import supybot.registry as registry +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('Math') def configure(advanced): # This will be called by supybot to configure this module. advanced is @@ -42,7 +44,7 @@ def configure(advanced): Math = conf.registerPlugin('Math') # This is where your configuration variables (if any) should go. For example: # conf.registerGlobalValue(Math, 'someConfigVariableName', -# registry.Boolean(False, """Help for someConfigVariableName.""")) +# registry.Boolean(False, _("""Help for someConfigVariableName."""))) # vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: diff --git a/plugins/Math/messages.pot b/plugins/Math/messages.pot new file mode 100644 index 000000000..9f2932cc0 --- /dev/null +++ b/plugins/Math/messages.pot @@ -0,0 +1,129 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR ORGANIZATION +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2010-10-17 15:35+CEST\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \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:52 +#, docstring +msgid "" +" [] \n" +"\n" +" Converts from base to base .\n" +" If is left out, it converts to decimal.\n" +" " +msgstr "" + +#: plugin.py:63 +msgid "Invalid for base %s: %s" +msgstr "" + +#: plugin.py:69 +#, docstring +msgid "Convert a decimal number to another base; returns a string." +msgstr "" + +#: plugin.py:90 +#, docstring +msgid "" +"Convert a number from any base, 2 through 36, to any other\n" +" base, 2 through 36. Returns a string." +msgstr "" + +#: plugin.py:157 +#, docstring +msgid "" +"\n" +"\n" +" Returns the value of the evaluated . The syntax is\n" +" Python syntax; the type of arithmetic is floating point. Floating\n" +" point arithmetic is used in order to prevent a user from being able to\n" +" crash to the bot with something like '10**10**10**10'. One consequence\n" +" is that large values such as '10**24' might not be exact.\n" +" " +msgstr "" + +#: plugin.py:166 plugin.py:220 +msgid "There's really no reason why you should have underscores or brackets in your mathematical expression. Please remove them." +msgstr "" + +#: plugin.py:172 plugin.py:228 +msgid "You can't use lambda in this command." +msgstr "" + +#: plugin.py:202 plugin.py:236 +msgid "The answer exceeded %s or so." +msgstr "" + +#: plugin.py:204 plugin.py:238 +msgid "Something in there wasn't a valid number." +msgstr "" + +#: plugin.py:206 plugin.py:240 +msgid "%s is not a defined function." +msgstr "" + +#: plugin.py:213 +#, docstring +msgid "" +"\n" +"\n" +" This is the same as the calc command except that it allows integer\n" +" math, and can thus cause the bot to suck up CPU. Hence it requires\n" +" the 'trusted' capability to use.\n" +" " +msgstr "" + +#: plugin.py:250 +#, docstring +msgid "" +"\n" +"\n" +" Returns the value of an RPN expression.\n" +" " +msgstr "" + +#: plugin.py:275 +msgid "Not enough arguments for %s" +msgstr "" + +#: plugin.py:288 +msgid "%q is not a defined function." +msgstr "" + +#: plugin.py:295 +msgid "Stack: [%s]" +msgstr "" + +#: plugin.py:299 +#, docstring +msgid "" +"[] to \n" +"\n" +" Converts from to . If number isn't given, it\n" +" defaults to 1. For unit information, see 'units' command.\n" +" " +msgstr "" + +#: plugin.py:314 +#, docstring +msgid "" +" []\n" +"\n" +" With no arguments, returns a list of measurement types, which can be\n" +" passed as arguments. When called with a type as an argument, returns\n" +" the units of that type.\n" +" " +msgstr "" + diff --git a/plugins/Math/plugin.py b/plugins/Math/plugin.py index d3bb5aeb0..683b9c709 100644 --- a/plugins/Math/plugin.py +++ b/plugins/Math/plugin.py @@ -39,12 +39,15 @@ import string import supybot.utils as utils from supybot.commands import * import supybot.callbacks as callbacks +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('Math') convertcore = utils.python.universalImport('local.convertcore') baseArg = ('int', 'base', lambda i: i <= 36) class Math(callbacks.Plugin): + @internationalizeDocstring def base(self, irc, msg, args, frm, to, number): """ [] @@ -57,7 +60,7 @@ class Math(callbacks.Plugin): try: irc.reply(self._convertBaseToBase(number, to, frm)) except ValueError: - irc.error('Invalid for base %s: %s' % (frm, number)) + irc.error(_('Invalid for base %s: %s') % (frm, number)) base = wrap(base, [('int', 'base', lambda i: 2 <= i <= 36), optional(('int', 'base', lambda i: 2 <= i <= 36), 10), additional('something')]) @@ -149,6 +152,7 @@ class Math(callbacks.Plugin): # Then we delete all square brackets, underscores, and whitespace, so no # one can do list comprehensions or call __...__ functions. ### + @internationalizeDocstring def calc(self, irc, msg, args, text): """ @@ -159,13 +163,13 @@ class Math(callbacks.Plugin): is that large values such as '10**24' might not be exact. """ if text != text.translate(utils.str.chars, '_[]'): - irc.error('There\'s really no reason why you should have ' + irc.error(_('There\'s really no reason why you should have ' 'underscores or brackets in your mathematical ' - 'expression. Please remove them.') + 'expression. Please remove them.')) return #text = text.translate(utils.str.chars, '_[] \t') if 'lambda' in text: - irc.error('You can\'t use lambda in this command.') + irc.error(_('You can\'t use lambda in this command.')) return text = text.lower() def handleMatch(m): @@ -195,15 +199,16 @@ class Math(callbacks.Plugin): irc.reply(self._complexToString(x)) except OverflowError: maxFloat = math.ldexp(0.9999999999999999, 1024) - irc.error('The answer exceeded %s or so.' % maxFloat) + irc.error(_('The answer exceeded %s or so.') % maxFloat) except TypeError: - irc.error('Something in there wasn\'t a valid number.') + irc.error(_('Something in there wasn\'t a valid number.')) except NameError, e: - irc.error('%s is not a defined function.' % str(e).split()[1]) + irc.error(_('%s is not a defined function.') % str(e).split()[1]) except Exception, e: irc.error(str(e)) calc = wrap(calc, ['text']) + @internationalizeDocstring def icalc(self, irc, msg, args, text): """ @@ -212,15 +217,15 @@ class Math(callbacks.Plugin): the 'trusted' capability to use. """ if text != text.translate(utils.str.chars, '_[]'): - irc.error('There\'s really no reason why you should have ' + irc.error(_('There\'s really no reason why you should have ' 'underscores or brackets in your mathematical ' - 'expression. Please remove them.') + 'expression. Please remove them.')) return # This removes spaces, too, but we'll leave the removal of _[] for # safety's sake. text = text.translate(utils.str.chars, '_[] \t') if 'lambda' in text: - irc.error('You can\'t use lambda in this command.') + irc.error(_('You can\'t use lambda in this command.')) return text = text.replace('lambda', '') try: @@ -228,11 +233,11 @@ class Math(callbacks.Plugin): irc.reply(str(eval(text, self._mathEnv, self._mathEnv))) except OverflowError: maxFloat = math.ldexp(0.9999999999999999, 1024) - irc.error('The answer exceeded %s or so.' % maxFloat) + irc.error(_('The answer exceeded %s or so.') % maxFloat) except TypeError: - irc.error('Something in there wasn\'t a valid number.') + irc.error(_('Something in there wasn\'t a valid number.')) except NameError, e: - irc.error('%s is not a defined function.' % str(e).split()[1]) + irc.error(_('%s is not a defined function.') % str(e).split()[1]) except Exception, e: irc.error(utils.exnToString(e)) icalc = wrap(icalc, [('checkCapability', 'trusted'), 'text']) @@ -267,7 +272,7 @@ class Math(callbacks.Plugin): except TypeError: pass if not called: - irc.error('Not enough arguments for %s' % arg) + irc.error(_('Not enough arguments for %s') % arg) return else: stack.append(f) @@ -280,14 +285,16 @@ class Math(callbacks.Plugin): try: stack.append(eval(s, self._mathEnv, self._mathEnv)) except SyntaxError: - irc.error(format('%q is not a defined function.', arg)) + irc.error(format(_('%q is not a defined function.'), + arg)) return if len(stack) == 1: irc.reply(str(self._complexToString(complex(stack[0])))) else: s = ', '.join(map(self._complexToString, map(complex, stack))) - irc.reply('Stack: [%s]' % s) + irc.reply(_('Stack: [%s]') % s) + @internationalizeDocstring def convert(self, irc, msg, args, number, unit1, unit2): """[] to @@ -302,6 +309,7 @@ class Math(callbacks.Plugin): irc.error(str(ude)) convert = wrap(convert, [optional('float', 1.0),'something','to','text']) + @internationalizeDocstring def units(self, irc, msg, args, type): """ [] diff --git a/plugins/Misc/config.py b/plugins/Misc/config.py index 57c4dada5..f1c4dc19e 100644 --- a/plugins/Misc/config.py +++ b/plugins/Misc/config.py @@ -29,6 +29,8 @@ import supybot.conf as conf import supybot.registry as registry +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('Misc') def configure(advanced): # This will be called by supybot to configure this module. advanced is @@ -40,24 +42,24 @@ def configure(advanced): Misc = conf.registerPlugin('Misc') conf.registerGlobalValue(Misc, 'listPrivatePlugins', - registry.Boolean(True, """Determines whether the bot will list private + registry.Boolean(True, _("""Determines whether the bot will list private plugins with the list command if given the --private switch. If this is disabled, non-owner users should be unable to see what private plugins - are loaded.""")) + are loaded."""))) conf.registerGlobalValue(Misc, 'timestampFormat', - registry.String('[%H:%M:%S]', """Determines the format string for + registry.String('[%H:%M:%S]', _("""Determines the format string for timestamps in the Misc.last command. Refer to the Python documentation for the time module to see what formats are accepted. If you set this - variable to the empty string, the timestamp will not be shown.""")) + variable to the empty string, the timestamp will not be shown."""))) conf.registerGroup(Misc, 'last') conf.registerGroup(Misc.last, 'nested') conf.registerChannelValue(Misc.last.nested, - 'includeTimestamp', registry.Boolean(False, """Determines whether or not + 'includeTimestamp', registry.Boolean(False, _("""Determines whether or not the timestamp will be included in the output of last when it is part of a - nested command""")) + nested command"""))) conf.registerChannelValue(Misc.last.nested, - 'includeNick', registry.Boolean(False, """Determines whether or not the + 'includeNick', registry.Boolean(False, _("""Determines whether or not the nick will be included in the output of last when it is part of a nested - command""")) + command"""))) # vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: diff --git a/plugins/Misc/messages.pot b/plugins/Misc/messages.pot new file mode 100644 index 000000000..59d3b15a6 --- /dev/null +++ b/plugins/Misc/messages.pot @@ -0,0 +1,230 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR ORGANIZATION +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2010-10-17 15:35+CEST\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \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 whether the bot will list private\n" +" plugins with the list command if given the --private switch. If this is\n" +" disabled, non-owner users should be unable to see what private plugins\n" +" are loaded." +msgstr "" + +#: config.py:50 +msgid "" +"Determines the format string for\n" +" timestamps in the Misc.last command. Refer to the Python documentation\n" +" for the time module to see what formats are accepted. If you set this\n" +" variable to the empty string, the timestamp will not be shown." +msgstr "" + +#: config.py:57 +msgid "" +"Determines whether or not\n" +" the timestamp will be included in the output of last when it is part of a\n" +" nested command" +msgstr "" + +#: config.py:61 +msgid "" +"Determines whether or not the\n" +" nick will be included in the output of last when it is part of a nested\n" +" command" +msgstr "" + +#: plugin.py:81 +msgid "You've given me %s invalid commands within the last minute; I'm now ignoring you for %s." +msgstr "" + +#: plugin.py:93 +msgid "The %q plugin is loaded, but there is no command named %q in it. Try \"list %s\" to see the commands in the %q plugin." +msgstr "" + +#: plugin.py:119 +#, docstring +msgid "" +"[--private] []\n" +"\n" +" Lists the commands available in the given plugin. If no plugin is\n" +" given, lists the public plugins available. If --private is given,\n" +" lists the private plugins.\n" +" " +msgstr "" + +#: plugin.py:144 +msgid "There are no private plugins." +msgstr "" + +#: plugin.py:146 +msgid "There are no public plugins." +msgstr "" + +#: plugin.py:153 +msgid "That plugin exists, but has no commands. This probably means that it has some configuration variables that can be changed in order to modify its behavior. Try \"config list supybot.plugins.%s\" to see what configuration variables it has." +msgstr "" + +#: plugin.py:164 +#, docstring +msgid "" +"\n" +"\n" +" Searches for in the commands currently offered by the bot,\n" +" returning a list of the commands containing that string.\n" +" " +msgstr "" + +#: plugin.py:183 +msgid "No appropriate commands were found." +msgstr "" + +#: plugin.py:188 +#, docstring +msgid "" +"[] []\n" +"\n" +" This command gives a useful description of what does.\n" +" is only necessary if the command is in more than one plugin.\n" +" " +msgstr "" + +#: plugin.py:198 +msgid "That command exists in the %L plugins. Please specify exactly which plugin command you want help with." +msgstr "" + +#: plugin.py:205 +msgid "There is no command %q." +msgstr "" + +#: plugin.py:211 +#, docstring +msgid "" +"takes no arguments\n" +"\n" +" Returns the version of the current bot.\n" +" " +msgstr "" + +#: plugin.py:217 +msgid "The newest version available online is %s." +msgstr "" + +#: plugin.py:221 +msgid "I couldn't fetch the newest version from the Supybot website." +msgstr "" + +#: plugin.py:223 +msgid "The current (running) version of this Supybot is %s. %s" +msgstr "" + +#: plugin.py:230 +#, docstring +msgid "" +"takes no arguments\n" +"\n" +" Returns a URL saying where to get Supybot.\n" +" " +msgstr "" + +#: plugin.py:234 +msgid "My source is at http://supybot.com/" +msgstr "" + +#: plugin.py:239 +#, docstring +msgid "" +"[]\n" +"\n" +" If the last command was truncated due to IRC message length\n" +" limitations, returns the next chunk of the result of the last command.\n" +" If is given, it takes the continuation of the last command from\n" +" instead of the person sending this message.\n" +" " +msgstr "" + +#: plugin.py:253 +msgid "%s has no public mores." +msgstr "" + +#: plugin.py:256 +msgid "Sorry, I can't find any mores for %s" +msgstr "" + +#: plugin.py:265 +msgid "You haven't asked me a command; perhaps you want to see someone else's more. To do so, call this command with that person's nick." +msgstr "" + +#: plugin.py:269 +msgid "That's all, there is no more." +msgstr "" + +#: plugin.py:279 +#, docstring +msgid "" +"[--{from,in,on,with,without,regexp} ] [--nolimit]\n" +"\n" +" Returns the last message matching the given criteria. --from requires\n" +" a nick from whom the message came; --in requires a channel the message\n" +" was sent to; --on requires a network the message was sent on; --with\n" +" requires some string that had to be in the message; --regexp requires\n" +" a regular expression the message must match; --nolimit returns all\n" +" the messages that can be found. By default, the channel this command is\n" +" given in is searched.\n" +" " +msgstr "" + +#: plugin.py:373 +msgid "I couldn't find a message matching that criteria in my history of %s messages." +msgstr "" + +#: plugin.py:388 +#, docstring +msgid "" +" \n" +"\n" +" Tells the whatever is. Use nested commands to your\n" +" benefit here.\n" +" " +msgstr "" + +#: plugin.py:396 +msgid "Dude, just give the command. No need for the tell." +msgstr "" + +#: plugin.py:401 +msgid "You just told me, why should I tell myself?" +msgstr "" + +#: plugin.py:406 +msgid "I haven't seen %s, I'll let you do the telling." +msgstr "" + +#: plugin.py:411 +msgid "%s wants me to tell you: %s" +msgstr "" + +#: plugin.py:417 +#, docstring +msgid "" +"takes no arguments\n" +"\n" +" Checks to see if the bot is alive.\n" +" " +msgstr "" + +#: plugin.py:421 +msgid "pong" +msgstr "" + diff --git a/plugins/Misc/plugin.py b/plugins/Misc/plugin.py index a1412f32e..8079dc52e 100644 --- a/plugins/Misc/plugin.py +++ b/plugins/Misc/plugin.py @@ -44,6 +44,8 @@ import supybot.ircutils as ircutils import supybot.callbacks as callbacks from supybot.utils.iter import ifilter +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('Misc') class Misc(callbacks.Plugin): def __init__(self, irc): @@ -76,8 +78,8 @@ class Misc(callbacks.Plugin): 'permanently.') ircdb.ignores.add(banmask, time.time() + punishment) if conf.supybot.abuse.flood.command.invalid.notify(): - irc.reply('You\'ve given me %s invalid commands within the last ' - 'minute; I\'m now ignoring you for %s.' % + irc.reply(_('You\'ve given me %s invalid commands within the last ' + 'minute; I\'m now ignoring you for %s.') % (maximum, utils.timeElapsed(punishment, seconds=False))) return @@ -88,10 +90,10 @@ class Misc(callbacks.Plugin): cb = irc.getCallback(tokens[0]) if cb: plugin = cb.name() - irc.error(format('The %q plugin is loaded, but there is ' + irc.error(format(_('The %q plugin is loaded, but there is ' 'no command named %q in it. Try "list ' '%s" to see the commands in the %q ' - 'plugin.', plugin, tokens[1], + 'plugin.'), plugin, tokens[1], plugin, plugin)) else: irc.errorInvalid('command', tokens[0], repr=False) @@ -112,6 +114,7 @@ class Misc(callbacks.Plugin): else: pass # Let's just do nothing, I can't think of better. + @internationalizeDocstring def list(self, irc, msg, args, optlist, cb): """[--private] [] @@ -138,24 +141,25 @@ class Misc(callbacks.Plugin): irc.reply(format('%L', names)) else: if private: - irc.reply('There are no private plugins.') + irc.reply(_('There are no private plugins.')) else: - irc.reply('There are no public plugins.') + irc.reply(_('There are no public plugins.')) else: commands = cb.listCommands() if commands: commands.sort() irc.reply(format('%L', commands)) else: - irc.reply(format('That plugin exists, but has no commands. ' + irc.reply(format(_('That plugin exists, but has no commands. ' 'This probably means that it has some ' 'configuration variables that can be ' 'changed in order to modify its behavior. ' 'Try "config list supybot.plugins.%s" to see ' - 'what configuration variables it has.', + 'what configuration variables it has.'), cb.name())) list = wrap(list, [getopts({'private':''}), additional('plugin')]) + @internationalizeDocstring def apropos(self, irc, msg, args, s): """ @@ -176,9 +180,10 @@ class Misc(callbacks.Plugin): L.sort() irc.reply(format('%L', L)) else: - irc.reply('No appropriate commands were found.') + irc.reply(_('No appropriate commands were found.')) apropos = wrap(apropos, ['lowered']) + @internationalizeDocstring def help(self, irc, msg, args, command): """[] [] @@ -190,17 +195,18 @@ class Misc(callbacks.Plugin): if maxL == command: if len(cbs) > 1: names = sorted([cb.name() for cb in cbs]) - irc.error(format('That command exists in the %L plugins. ' + irc.error(format(_('That command exists in the %L plugins. ' 'Please specify exactly which plugin command ' - 'you want help with.', names)) + 'you want help with.'), names)) else: assert cbs, 'Odd, maxL == command, but no cbs.' irc.reply(cbs[0].getCommandHelp(command, False)) else: - irc.error(format('There is no command %q.', + irc.error(format(_('There is no command %q.'), callbacks.formatCommand(command))) help = wrap(help, [many('something')]) + @internationalizeDocstring def version(self, irc, msg, args): """takes no arguments @@ -208,24 +214,27 @@ class Misc(callbacks.Plugin): """ try: newest = utils.web.getUrl('http://supybot.sf.net/version.txt') - newest ='The newest version available online is %s.'%newest.strip() + newest = _('The newest version available online is %s.') % \ + newest.strip() except utils.web.Error, e: self.log.info('Couldn\'t get website version: %s', e) - newest = 'I couldn\'t fetch the newest version ' \ - 'from the Supybot website.' - s = 'The current (running) version of this Supybot is %s. %s' % \ + newest = _('I couldn\'t fetch the newest version ' + 'from the Supybot website.') + s = _('The current (running) version of this Supybot is %s. %s') % \ (conf.version, newest) irc.reply(s) version = wrap(thread(version)) + @internationalizeDocstring def source(self, irc, msg, args): """takes no arguments Returns a URL saying where to get Supybot. """ - irc.reply('My source is at http://supybot.com/') + irc.reply(_('My source is at http://supybot.com/')) source = wrap(source) + @internationalizeDocstring def more(self, irc, msg, args, nick): """[] @@ -241,10 +250,10 @@ class Misc(callbacks.Plugin): if not private: irc._mores[userHostmask] = L[:] else: - irc.error('%s has no public mores.' % nick) + irc.error(_('%s has no public mores.') % nick) return except KeyError: - irc.error('Sorry, I can\'t find any mores for %s' % nick) + irc.error(_('Sorry, I can\'t find any mores for %s') % nick) return try: L = irc._mores[userHostmask] @@ -253,11 +262,11 @@ class Misc(callbacks.Plugin): chunk += format(' \x02(%n)\x0F', (len(L), 'more', 'message')) irc.reply(chunk, True) except KeyError: - irc.error('You haven\'t asked me a command; perhaps you want ' + irc.error(_('You haven\'t asked me a command; perhaps you want ' 'to see someone else\'s more. To do so, call this ' - 'command with that person\'s nick.') + 'command with that person\'s nick.')) except IndexError: - irc.error('That\'s all, there is no more.') + irc.error(_('That\'s all, there is no more.')) more = wrap(more, [additional('seenNick')]) def _validLastMsg(self, msg): @@ -265,6 +274,7 @@ class Misc(callbacks.Plugin): msg.command == 'PRIVMSG' and \ ircutils.isChannel(msg.args[0]) + @internationalizeDocstring def last(self, irc, msg, args, optlist): """[--{from,in,on,with,without,regexp} ] [--nolimit] @@ -360,8 +370,8 @@ class Misc(callbacks.Plugin): showNick=showNick)) return if not resp: - irc.error('I couldn\'t find a message matching that criteria in ' - 'my history of %s messages.' % len(irc.state.history)) + irc.error(_('I couldn\'t find a message matching that criteria in ' + 'my history of %s messages.') % len(irc.state.history)) else: irc.reply(format('%L', resp)) last = wrap(last, [getopts({'nolimit': '', @@ -373,6 +383,7 @@ class Misc(callbacks.Plugin): 'regexp': 'regexpMatcher',})]) + @internationalizeDocstring def tell(self, irc, msg, args, target, text): """ @@ -382,30 +393,32 @@ class Misc(callbacks.Plugin): if target.lower() == 'me': target = msg.nick if ircutils.isChannel(target): - irc.error('Dude, just give the command. No need for the tell.') + irc.error(_('Dude, just give the command. No need for the tell.')) return if not ircutils.isNick(target): irc.errorInvalid('nick', target) if ircutils.nickEqual(target, irc.nick): - irc.error('You just told me, why should I tell myself?',Raise=True) + irc.error(_('You just told me, why should I tell myself?'), + Raise=True) if target not in irc.state.nicksToHostmasks and \ not ircdb.checkCapability(msg.prefix, 'owner'): # We'll let owners do this. - s = 'I haven\'t seen %s, I\'ll let you do the telling.' % target + s = _('I haven\'t seen %s, I\'ll let you do the telling.') % target irc.error(s, Raise=True) if irc.action: irc.action = False text = '* %s %s' % (irc.nick, text) - s = '%s wants me to tell you: %s' % (msg.nick, text) + s = _('%s wants me to tell you: %s') % (msg.nick, text) irc.reply(s, to=target, private=True) tell = wrap(tell, ['something', 'text']) + @internationalizeDocstring def ping(self, irc, msg, args): """takes no arguments Checks to see if the bot is alive. """ - irc.reply('pong', prefixNick=False) + irc.reply(_('pong'), prefixNick=False) Class = Misc From 45de0926521d9d4ebf67f386c7cc82064a8e8066 Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Sun, 17 Oct 2010 15:59:23 +0200 Subject: [PATCH 07/10] Internationalize Herald, Internet, Karma, Lart, Later, Limiter, Math, and Misc --- plugins/Misc/config.py | 18 +-- plugins/Misc/messages.pot | 230 ++++++++++++++++++++++++++++++++++++++ plugins/Misc/plugin.py | 77 ++++++++----- 3 files changed, 287 insertions(+), 38 deletions(-) create mode 100644 plugins/Misc/messages.pot diff --git a/plugins/Misc/config.py b/plugins/Misc/config.py index 57c4dada5..f1c4dc19e 100644 --- a/plugins/Misc/config.py +++ b/plugins/Misc/config.py @@ -29,6 +29,8 @@ import supybot.conf as conf import supybot.registry as registry +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('Misc') def configure(advanced): # This will be called by supybot to configure this module. advanced is @@ -40,24 +42,24 @@ def configure(advanced): Misc = conf.registerPlugin('Misc') conf.registerGlobalValue(Misc, 'listPrivatePlugins', - registry.Boolean(True, """Determines whether the bot will list private + registry.Boolean(True, _("""Determines whether the bot will list private plugins with the list command if given the --private switch. If this is disabled, non-owner users should be unable to see what private plugins - are loaded.""")) + are loaded."""))) conf.registerGlobalValue(Misc, 'timestampFormat', - registry.String('[%H:%M:%S]', """Determines the format string for + registry.String('[%H:%M:%S]', _("""Determines the format string for timestamps in the Misc.last command. Refer to the Python documentation for the time module to see what formats are accepted. If you set this - variable to the empty string, the timestamp will not be shown.""")) + variable to the empty string, the timestamp will not be shown."""))) conf.registerGroup(Misc, 'last') conf.registerGroup(Misc.last, 'nested') conf.registerChannelValue(Misc.last.nested, - 'includeTimestamp', registry.Boolean(False, """Determines whether or not + 'includeTimestamp', registry.Boolean(False, _("""Determines whether or not the timestamp will be included in the output of last when it is part of a - nested command""")) + nested command"""))) conf.registerChannelValue(Misc.last.nested, - 'includeNick', registry.Boolean(False, """Determines whether or not the + 'includeNick', registry.Boolean(False, _("""Determines whether or not the nick will be included in the output of last when it is part of a nested - command""")) + command"""))) # vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: diff --git a/plugins/Misc/messages.pot b/plugins/Misc/messages.pot new file mode 100644 index 000000000..59d3b15a6 --- /dev/null +++ b/plugins/Misc/messages.pot @@ -0,0 +1,230 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR ORGANIZATION +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2010-10-17 15:35+CEST\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \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 whether the bot will list private\n" +" plugins with the list command if given the --private switch. If this is\n" +" disabled, non-owner users should be unable to see what private plugins\n" +" are loaded." +msgstr "" + +#: config.py:50 +msgid "" +"Determines the format string for\n" +" timestamps in the Misc.last command. Refer to the Python documentation\n" +" for the time module to see what formats are accepted. If you set this\n" +" variable to the empty string, the timestamp will not be shown." +msgstr "" + +#: config.py:57 +msgid "" +"Determines whether or not\n" +" the timestamp will be included in the output of last when it is part of a\n" +" nested command" +msgstr "" + +#: config.py:61 +msgid "" +"Determines whether or not the\n" +" nick will be included in the output of last when it is part of a nested\n" +" command" +msgstr "" + +#: plugin.py:81 +msgid "You've given me %s invalid commands within the last minute; I'm now ignoring you for %s." +msgstr "" + +#: plugin.py:93 +msgid "The %q plugin is loaded, but there is no command named %q in it. Try \"list %s\" to see the commands in the %q plugin." +msgstr "" + +#: plugin.py:119 +#, docstring +msgid "" +"[--private] []\n" +"\n" +" Lists the commands available in the given plugin. If no plugin is\n" +" given, lists the public plugins available. If --private is given,\n" +" lists the private plugins.\n" +" " +msgstr "" + +#: plugin.py:144 +msgid "There are no private plugins." +msgstr "" + +#: plugin.py:146 +msgid "There are no public plugins." +msgstr "" + +#: plugin.py:153 +msgid "That plugin exists, but has no commands. This probably means that it has some configuration variables that can be changed in order to modify its behavior. Try \"config list supybot.plugins.%s\" to see what configuration variables it has." +msgstr "" + +#: plugin.py:164 +#, docstring +msgid "" +"\n" +"\n" +" Searches for in the commands currently offered by the bot,\n" +" returning a list of the commands containing that string.\n" +" " +msgstr "" + +#: plugin.py:183 +msgid "No appropriate commands were found." +msgstr "" + +#: plugin.py:188 +#, docstring +msgid "" +"[] []\n" +"\n" +" This command gives a useful description of what does.\n" +" is only necessary if the command is in more than one plugin.\n" +" " +msgstr "" + +#: plugin.py:198 +msgid "That command exists in the %L plugins. Please specify exactly which plugin command you want help with." +msgstr "" + +#: plugin.py:205 +msgid "There is no command %q." +msgstr "" + +#: plugin.py:211 +#, docstring +msgid "" +"takes no arguments\n" +"\n" +" Returns the version of the current bot.\n" +" " +msgstr "" + +#: plugin.py:217 +msgid "The newest version available online is %s." +msgstr "" + +#: plugin.py:221 +msgid "I couldn't fetch the newest version from the Supybot website." +msgstr "" + +#: plugin.py:223 +msgid "The current (running) version of this Supybot is %s. %s" +msgstr "" + +#: plugin.py:230 +#, docstring +msgid "" +"takes no arguments\n" +"\n" +" Returns a URL saying where to get Supybot.\n" +" " +msgstr "" + +#: plugin.py:234 +msgid "My source is at http://supybot.com/" +msgstr "" + +#: plugin.py:239 +#, docstring +msgid "" +"[]\n" +"\n" +" If the last command was truncated due to IRC message length\n" +" limitations, returns the next chunk of the result of the last command.\n" +" If is given, it takes the continuation of the last command from\n" +" instead of the person sending this message.\n" +" " +msgstr "" + +#: plugin.py:253 +msgid "%s has no public mores." +msgstr "" + +#: plugin.py:256 +msgid "Sorry, I can't find any mores for %s" +msgstr "" + +#: plugin.py:265 +msgid "You haven't asked me a command; perhaps you want to see someone else's more. To do so, call this command with that person's nick." +msgstr "" + +#: plugin.py:269 +msgid "That's all, there is no more." +msgstr "" + +#: plugin.py:279 +#, docstring +msgid "" +"[--{from,in,on,with,without,regexp} ] [--nolimit]\n" +"\n" +" Returns the last message matching the given criteria. --from requires\n" +" a nick from whom the message came; --in requires a channel the message\n" +" was sent to; --on requires a network the message was sent on; --with\n" +" requires some string that had to be in the message; --regexp requires\n" +" a regular expression the message must match; --nolimit returns all\n" +" the messages that can be found. By default, the channel this command is\n" +" given in is searched.\n" +" " +msgstr "" + +#: plugin.py:373 +msgid "I couldn't find a message matching that criteria in my history of %s messages." +msgstr "" + +#: plugin.py:388 +#, docstring +msgid "" +" \n" +"\n" +" Tells the whatever is. Use nested commands to your\n" +" benefit here.\n" +" " +msgstr "" + +#: plugin.py:396 +msgid "Dude, just give the command. No need for the tell." +msgstr "" + +#: plugin.py:401 +msgid "You just told me, why should I tell myself?" +msgstr "" + +#: plugin.py:406 +msgid "I haven't seen %s, I'll let you do the telling." +msgstr "" + +#: plugin.py:411 +msgid "%s wants me to tell you: %s" +msgstr "" + +#: plugin.py:417 +#, docstring +msgid "" +"takes no arguments\n" +"\n" +" Checks to see if the bot is alive.\n" +" " +msgstr "" + +#: plugin.py:421 +msgid "pong" +msgstr "" + diff --git a/plugins/Misc/plugin.py b/plugins/Misc/plugin.py index a1412f32e..f03d26750 100644 --- a/plugins/Misc/plugin.py +++ b/plugins/Misc/plugin.py @@ -44,6 +44,8 @@ import supybot.ircutils as ircutils import supybot.callbacks as callbacks from supybot.utils.iter import ifilter +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('Misc') class Misc(callbacks.Plugin): def __init__(self, irc): @@ -76,8 +78,8 @@ class Misc(callbacks.Plugin): 'permanently.') ircdb.ignores.add(banmask, time.time() + punishment) if conf.supybot.abuse.flood.command.invalid.notify(): - irc.reply('You\'ve given me %s invalid commands within the last ' - 'minute; I\'m now ignoring you for %s.' % + irc.reply(_('You\'ve given me %s invalid commands within the last ' + 'minute; I\'m now ignoring you for %s.') % (maximum, utils.timeElapsed(punishment, seconds=False))) return @@ -88,10 +90,10 @@ class Misc(callbacks.Plugin): cb = irc.getCallback(tokens[0]) if cb: plugin = cb.name() - irc.error(format('The %q plugin is loaded, but there is ' + irc.error(format(_('The %q plugin is loaded, but there is ' 'no command named %q in it. Try "list ' '%s" to see the commands in the %q ' - 'plugin.', plugin, tokens[1], + 'plugin.'), plugin, tokens[1], plugin, plugin)) else: irc.errorInvalid('command', tokens[0], repr=False) @@ -112,6 +114,7 @@ class Misc(callbacks.Plugin): else: pass # Let's just do nothing, I can't think of better. + @internationalizeDocstring def list(self, irc, msg, args, optlist, cb): """[--private] [] @@ -138,24 +141,25 @@ class Misc(callbacks.Plugin): irc.reply(format('%L', names)) else: if private: - irc.reply('There are no private plugins.') + irc.reply(_('There are no private plugins.')) else: - irc.reply('There are no public plugins.') + irc.reply(_('There are no public plugins.')) else: commands = cb.listCommands() if commands: commands.sort() irc.reply(format('%L', commands)) else: - irc.reply(format('That plugin exists, but has no commands. ' + irc.reply(format(_('That plugin exists, but has no commands. ' 'This probably means that it has some ' 'configuration variables that can be ' 'changed in order to modify its behavior. ' 'Try "config list supybot.plugins.%s" to see ' - 'what configuration variables it has.', + 'what configuration variables it has.'), cb.name())) list = wrap(list, [getopts({'private':''}), additional('plugin')]) + @internationalizeDocstring def apropos(self, irc, msg, args, s): """ @@ -176,9 +180,10 @@ class Misc(callbacks.Plugin): L.sort() irc.reply(format('%L', L)) else: - irc.reply('No appropriate commands were found.') + irc.reply(_('No appropriate commands were found.')) apropos = wrap(apropos, ['lowered']) + @internationalizeDocstring def help(self, irc, msg, args, command): """[] [] @@ -190,17 +195,18 @@ class Misc(callbacks.Plugin): if maxL == command: if len(cbs) > 1: names = sorted([cb.name() for cb in cbs]) - irc.error(format('That command exists in the %L plugins. ' + irc.error(format(_('That command exists in the %L plugins. ' 'Please specify exactly which plugin command ' - 'you want help with.', names)) + 'you want help with.'), names)) else: assert cbs, 'Odd, maxL == command, but no cbs.' irc.reply(cbs[0].getCommandHelp(command, False)) else: - irc.error(format('There is no command %q.', + irc.error(format(_('There is no command %q.'), callbacks.formatCommand(command))) help = wrap(help, [many('something')]) + @internationalizeDocstring def version(self, irc, msg, args): """takes no arguments @@ -208,24 +214,27 @@ class Misc(callbacks.Plugin): """ try: newest = utils.web.getUrl('http://supybot.sf.net/version.txt') - newest ='The newest version available online is %s.'%newest.strip() + newest = _('The newest version available online is %s.') % \ + newest.strip() except utils.web.Error, e: self.log.info('Couldn\'t get website version: %s', e) - newest = 'I couldn\'t fetch the newest version ' \ - 'from the Supybot website.' - s = 'The current (running) version of this Supybot is %s. %s' % \ + newest = _('I couldn\'t fetch the newest version ' + 'from the Supybot website.') + s = _('The current (running) version of this Supybot is %s. %s') % \ (conf.version, newest) irc.reply(s) version = wrap(thread(version)) + @internationalizeDocstring def source(self, irc, msg, args): """takes no arguments Returns a URL saying where to get Supybot. """ - irc.reply('My source is at http://supybot.com/') + irc.reply(_('My source is at http://supybot.com/')) source = wrap(source) + @internationalizeDocstring def more(self, irc, msg, args, nick): """[] @@ -241,23 +250,27 @@ class Misc(callbacks.Plugin): if not private: irc._mores[userHostmask] = L[:] else: - irc.error('%s has no public mores.' % nick) + irc.error(_('%s has no public mores.') % nick) return except KeyError: - irc.error('Sorry, I can\'t find any mores for %s' % nick) + irc.error(_('Sorry, I can\'t find any mores for %s') % nick) return try: L = irc._mores[userHostmask] chunk = L.pop() if L: - chunk += format(' \x02(%n)\x0F', (len(L), 'more', 'message')) + if len(L) < 2: + more = _('more message') + else: + more = _('more messages') + chunk += format(' \x02(%s)\x0F', more) irc.reply(chunk, True) except KeyError: - irc.error('You haven\'t asked me a command; perhaps you want ' + irc.error(_('You haven\'t asked me a command; perhaps you want ' 'to see someone else\'s more. To do so, call this ' - 'command with that person\'s nick.') + 'command with that person\'s nick.')) except IndexError: - irc.error('That\'s all, there is no more.') + irc.error(_('That\'s all, there is no more.')) more = wrap(more, [additional('seenNick')]) def _validLastMsg(self, msg): @@ -265,6 +278,7 @@ class Misc(callbacks.Plugin): msg.command == 'PRIVMSG' and \ ircutils.isChannel(msg.args[0]) + @internationalizeDocstring def last(self, irc, msg, args, optlist): """[--{from,in,on,with,without,regexp} ] [--nolimit] @@ -360,8 +374,8 @@ class Misc(callbacks.Plugin): showNick=showNick)) return if not resp: - irc.error('I couldn\'t find a message matching that criteria in ' - 'my history of %s messages.' % len(irc.state.history)) + irc.error(_('I couldn\'t find a message matching that criteria in ' + 'my history of %s messages.') % len(irc.state.history)) else: irc.reply(format('%L', resp)) last = wrap(last, [getopts({'nolimit': '', @@ -373,6 +387,7 @@ class Misc(callbacks.Plugin): 'regexp': 'regexpMatcher',})]) + @internationalizeDocstring def tell(self, irc, msg, args, target, text): """ @@ -382,30 +397,32 @@ class Misc(callbacks.Plugin): if target.lower() == 'me': target = msg.nick if ircutils.isChannel(target): - irc.error('Dude, just give the command. No need for the tell.') + irc.error(_('Dude, just give the command. No need for the tell.')) return if not ircutils.isNick(target): irc.errorInvalid('nick', target) if ircutils.nickEqual(target, irc.nick): - irc.error('You just told me, why should I tell myself?',Raise=True) + irc.error(_('You just told me, why should I tell myself?'), + Raise=True) if target not in irc.state.nicksToHostmasks and \ not ircdb.checkCapability(msg.prefix, 'owner'): # We'll let owners do this. - s = 'I haven\'t seen %s, I\'ll let you do the telling.' % target + s = _('I haven\'t seen %s, I\'ll let you do the telling.') % target irc.error(s, Raise=True) if irc.action: irc.action = False text = '* %s %s' % (irc.nick, text) - s = '%s wants me to tell you: %s' % (msg.nick, text) + s = _('%s wants me to tell you: %s') % (msg.nick, text) irc.reply(s, to=target, private=True) tell = wrap(tell, ['something', 'text']) + @internationalizeDocstring def ping(self, irc, msg, args): """takes no arguments Checks to see if the bot is alive. """ - irc.reply('pong', prefixNick=False) + irc.reply(_('pong'), prefixNick=False) Class = Misc From e5e705f78c16f3dcd856a2c89ff8b82c7bec71ae Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Sun, 17 Oct 2010 16:02:11 +0200 Subject: [PATCH 08/10] Fix %n issue in Alias --- plugins/Alias/plugin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/Alias/plugin.py b/plugins/Alias/plugin.py index d43f22b4f..87ce858b6 100644 --- a/plugins/Alias/plugin.py +++ b/plugins/Alias/plugin.py @@ -163,7 +163,7 @@ def makeNewAlias(name, alias): if biggestDollar and (wildcard or biggestAt): flexargs = _(' at least') doc =format(_('\n\nAlias for %q.'), - flexargs, (biggestDollar, 'argument'), alias) + flexargs, (biggestDollar, _('argument')), alias) f = utils.python.changeFunctionName(f, name, doc) return f From ffc609a299ed2bf3c74c62ceb16dba71053936d9 Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Sun, 17 Oct 2010 16:59:21 +0200 Subject: [PATCH 09/10] Internationalized MoobotFactoids, News, and NickCapture --- plugins/MoobotFactoids/config.py | 10 +- plugins/MoobotFactoids/messages.pot | 269 ++++++++++++++++++++++++++++ plugins/MoobotFactoids/plugin.py | 82 +++++---- plugins/News/config.py | 4 +- plugins/News/messages.pot | 106 +++++++++++ plugins/News/plugin.py | 31 ++-- plugins/NickCapture/config.py | 10 +- plugins/NickCapture/messages.pot | 42 +++++ plugins/NickCapture/plugin.py | 3 + 9 files changed, 506 insertions(+), 51 deletions(-) create mode 100644 plugins/MoobotFactoids/messages.pot create mode 100644 plugins/News/messages.pot create mode 100644 plugins/NickCapture/messages.pot diff --git a/plugins/MoobotFactoids/config.py b/plugins/MoobotFactoids/config.py index 0595421b3..07f55889c 100644 --- a/plugins/MoobotFactoids/config.py +++ b/plugins/MoobotFactoids/config.py @@ -29,6 +29,8 @@ import supybot.conf as conf import supybot.registry as registry +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('MoobotFactoids') def configure(advanced): # This will be called by supybot to configure this module. advanced is @@ -41,12 +43,12 @@ def configure(advanced): MoobotFactoids = conf.registerPlugin('MoobotFactoids') conf.registerChannelValue(MoobotFactoids, - 'showFactoidIfOnlyOneMatch', registry.Boolean(True, """Determines whether + 'showFactoidIfOnlyOneMatch', registry.Boolean(True, _("""Determines whether or not the factoid value will be shown when a listkeys search returns only - one factoid key.""")) + one factoid key."""))) conf.registerChannelValue(MoobotFactoids, - 'mostCount', registry.Integer(10, """Determines how many items are shown - when the 'most' command is called.""")) + 'mostCount', registry.Integer(10, _("""Determines how many items are shown + when the 'most' command is called."""))) # vim:set shiftwidth=4 softtabstop=8 expandtab textwidth=78 diff --git a/plugins/MoobotFactoids/messages.pot b/plugins/MoobotFactoids/messages.pot new file mode 100644 index 000000000..0c51bc8d8 --- /dev/null +++ b/plugins/MoobotFactoids/messages.pot @@ -0,0 +1,269 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR ORGANIZATION +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2010-10-17 16:36+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\n" +" or not the factoid value will be shown when a listkeys search returns only\n" +" one factoid key." +msgstr "" + +#: config.py:50 +msgid "" +"Determines how many items are shown\n" +" when the 'most' command is called." +msgstr "" + +#: plugin.py:293 +#, docstring +msgid "" +"Add the help for \"@help MoobotFactoids\" here (assuming you don't implement a MoobotFactoids\n" +" command). This should describe *how* to use this plugin." +msgstr "" + +#: plugin.py:350 +msgid "%s is %s" +msgstr "" + +#: plugin.py:369 +msgid "Factoid %q is locked." +msgstr "" + +#: plugin.py:376 +msgid "Factoid %q not found." +msgstr "" + +#: plugin.py:386 +msgid "Missing an 'is' or '_is_'." +msgstr "" + +#: plugin.py:402 +msgid "Factoid %q already exists." +msgstr "" + +#: plugin.py:436 +msgid "%s, or %s" +msgstr "" + +#: plugin.py:457 +#, docstring +msgid "" +"[] \n" +"\n" +" Returns the literal factoid for the given factoid key. No parsing of\n" +" the factoid value is done as it is with normal retrieval. \n" +" is only necessary if the message isn't sent in the channel itself.\n" +" " +msgstr "" + +#: plugin.py:470 +#, docstring +msgid "" +"[] \n" +"\n" +" Returns the various bits of info on the factoid for the given key.\n" +" is only necessary if the message isn't sent in the channel\n" +" itself.\n" +" " +msgstr "" + +#: plugin.py:481 plugin.py:521 +msgid "No such factoid: %q" +msgstr "" + +#: plugin.py:490 +msgid "Created by %s on %s." +msgstr "" + +#: plugin.py:496 +msgid " Last modified by %s on %s." +msgstr "" + +#: plugin.py:504 +msgid " Last requested by %s on %s, requested %n." +msgstr "" + +#: plugin.py:511 +msgid " Locked by %s on %s." +msgstr "" + +#: plugin.py:526 +msgid "Factoid %q is already locked." +msgstr "" + +#: plugin.py:529 +msgid "Factoid %q is not locked." +msgstr "" + +#: plugin.py:539 +msgid "Cannot %s someone else's factoid unless you are an admin." +msgstr "" + +#: plugin.py:551 +#, docstring +msgid "" +"[] \n" +"\n" +" Locks the factoid with the given factoid key. Requires that the user\n" +" be registered and have created the factoid originally. is\n" +" only necessary if the message isn't sent in the channel itself.\n" +" " +msgstr "" + +#: plugin.py:562 +#, docstring +msgid "" +"[] \n" +"\n" +" Unlocks the factoid with the given factoid key. Requires that the\n" +" user be registered and have locked the factoid. is only\n" +" necessary if the message isn't sent in the channel itself.\n" +" " +msgstr "" + +#: plugin.py:573 +#, docstring +msgid "" +"[] {popular|authored|recent}\n" +"\n" +" Lists the most {popular|authored|recent} factoids. \"popular\" lists the\n" +" most frequently requested factoids. \"authored\" lists the author with\n" +" the most factoids. \"recent\" lists the most recently created factoids.\n" +" is only necessary if the message isn't sent in the channel\n" +" itself.\n" +" " +msgstr "" + +#: plugin.py:598 +msgid "Most prolific %s: %L" +msgstr "" + +#: plugin.py:600 plugin.py:612 +msgid "There are no factoids in my database." +msgstr "" + +#: plugin.py:607 +msgid "latest factoid" +msgstr "" + +#: plugin.py:609 +msgid "latest factoids" +msgstr "" + +#: plugin.py:610 +msgid "%s: %L" +msgstr "" + +#: plugin.py:619 +msgid "requested factoid" +msgstr "" + +#: plugin.py:621 +msgid "requested factoids" +msgstr "" + +#: plugin.py:622 +msgid "Top %s: %L" +msgstr "" + +#: plugin.py:624 +msgid "No factoids have been requested from my database." +msgstr "" + +#: plugin.py:628 +#, docstring +msgid "" +"[] \n" +"\n" +" Lists the keys of the factoids with the given author. Note that if an\n" +" author has an integer name, you'll have to use that author's id to use\n" +" this function (so don't use integer usernames!). is only\n" +" necessary if the message isn't sent in the channel itself.\n" +" " +msgstr "" + +#: plugin.py:641 +msgid "No factoids by %q found." +msgstr "" + +#: plugin.py:644 +msgid "Author search for %q (%i found): %L" +msgstr "" + +#: plugin.py:651 +#, docstring +msgid "" +"[] \n" +"\n" +" Lists the keys of the factoids whose key contains the provided text.\n" +" is only necessary if the message isn't sent in the channel\n" +" itself.\n" +" " +msgstr "" + +#: plugin.py:659 +msgid "No keys matching %q found." +msgstr "" + +#: plugin.py:666 +msgid "Key search for %q (%i found): %L" +msgstr "" + +#: plugin.py:673 +#, docstring +msgid "" +"[] \n" +"\n" +" Lists the keys of the factoids whose value contains the provided text.\n" +" is only necessary if the message isn't sent in the channel\n" +" itself.\n" +" " +msgstr "" + +#: plugin.py:681 +msgid "No values matching %q found." +msgstr "" + +#: plugin.py:684 +msgid "Value search for %q (%i found): %L" +msgstr "" + +#: plugin.py:691 +#, docstring +msgid "" +"[] \n" +"\n" +" Deletes the factoid with the given key. is only necessary\n" +" if the message isn't sent in the channel itself.\n" +" " +msgstr "" + +#: plugin.py:704 +#, docstring +msgid "" +"[]\n" +"\n" +" Displays a random factoid (along with its key) from the database.\n" +" is only necessary if the message isn't sent in the channel\n" +" itself.\n" +" " +msgstr "" + +#: plugin.py:712 +msgid "No factoids in the database." +msgstr "" + diff --git a/plugins/MoobotFactoids/plugin.py b/plugins/MoobotFactoids/plugin.py index c0818bc77..9a7581a79 100644 --- a/plugins/MoobotFactoids/plugin.py +++ b/plugins/MoobotFactoids/plugin.py @@ -41,6 +41,8 @@ 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('MoobotFactoids') allchars = string.maketrans('', '') class OptionList(object): @@ -286,6 +288,7 @@ class SqliteMoobotDB(object): MoobotDB = plugins.DB('MoobotFactoids', {'sqlite': SqliteMoobotDB}) +@internationalizeDocstring class MoobotFactoids(callbacks.Plugin): """Add the help for "@help MoobotFactoids" here (assuming you don't implement a MoobotFactoids command). This should describe *how* to use this plugin.""" @@ -344,7 +347,8 @@ class MoobotFactoids(callbacks.Plugin): elif type == 'reply': irc.reply(text, prefixNick=False) elif type == 'define': - irc.reply(format('%s is %s', key, text), prefixNick=False) + irc.reply(format(_('%s is %s'), key, text), + prefixNick=False) else: assert False, 'Spurious type from _parseFactoid' else: @@ -362,14 +366,14 @@ class MoobotFactoids(callbacks.Plugin): def _checkNotLocked(self, irc, channel, key): if self.db.locked(channel, key): - irc.error(format('Factoid %q is locked.', key), Raise=True) + irc.error(format(_('Factoid %q is locked.'), key), Raise=True) def _getFactoid(self, irc, channel, key): fact = self.db.getFactoid(channel, key) if fact is not None: return fact else: - irc.error(format('Factoid %q not found.', key), Raise=True) + irc.error(format(_('Factoid %q not found.'), key), Raise=True) def _getKeyAndFactoid(self, tokens): if '_is_' in tokens: @@ -379,7 +383,7 @@ class MoobotFactoids(callbacks.Plugin): else: self.log.debug('Invalid tokens for {add,replace}Factoid: %s.', tokens) - s = 'Missing an \'is\' or \'_is_\'.' + s = _('Missing an \'is\' or \'_is_\'.') raise ValueError, s (key, newfact) = map(' '.join, utils.iter.split(p, tokens, maxsplit=1)) key = self._sanitizeKey(key) @@ -395,7 +399,7 @@ class MoobotFactoids(callbacks.Plugin): irc.error(str(e), Raise=True) # Check and make sure it's not in the DB already if self.db.getFactoid(channel, key): - irc.error(format('Factoid %q already exists.', key), Raise=True) + irc.error(format(_('Factoid %q already exists.'), key), Raise=True) self.db.addFactoid(channel, key, fact, id) irc.replySuccess() @@ -429,7 +433,7 @@ class MoobotFactoids(callbacks.Plugin): self._checkNotLocked(irc, channel, key) # It's fair game if we get to here fact = fact[0] - new_fact = format('%s, or %s', fact, new_text) + new_fact = format(_('%s, or %s'), fact, new_text) self.db.updateFactoid(channel, key, new_fact, id) irc.replySuccess() @@ -448,6 +452,7 @@ class MoobotFactoids(callbacks.Plugin): self.db.addFactoid(channel, key, fact, id) irc.replySuccess() + @internationalizeDocstring def literal(self, irc, msg, args, channel, key): """[] @@ -460,6 +465,7 @@ class MoobotFactoids(callbacks.Plugin): irc.reply(fact) literal = wrap(literal, ['channeldb', 'text']) + @internationalizeDocstring def factinfo(self, irc, msg, args, channel, key): """[] @@ -472,7 +478,7 @@ class MoobotFactoids(callbacks.Plugin): # Next, get all the info and build the response piece by piece info = self.db.getFactinfo(channel, key) if not info: - irc.error(format('No such factoid: %q', key)) + irc.error(format(_('No such factoid: %q'), key)) return (created_by, created_at, modified_by, modified_at, last_requested_by, last_requested_at, requested_count, locked_by, locked_at) = info @@ -481,27 +487,28 @@ class MoobotFactoids(callbacks.Plugin): created_by = plugins.getUserName(created_by) created_at = time.strftime(conf.supybot.reply.format.time(), time.localtime(int(created_at))) - s += format('Created by %s on %s.', created_by, created_at) + s += format(_('Created by %s on %s.'), created_by, created_at) # Next, modification info, if any. if modified_by is not None: modified_by = plugins.getUserName(modified_by) modified_at = time.strftime(conf.supybot.reply.format.time(), time.localtime(int(modified_at))) - s += format(' Last modified by %s on %s.',modified_by, modified_at) + s += format(_(' Last modified by %s on %s.'), modified_by, + modified_at) # Next, last requested info, if any if last_requested_by is not None: last_by = last_requested_by # not an int user id last_at = time.strftime(conf.supybot.reply.format.time(), time.localtime(int(last_requested_at))) req_count = requested_count - s += format(' Last requested by %s on %s, requested %n.', + s += format(_(' Last requested by %s on %s, requested %n.'), last_by, last_at, (requested_count, 'time')) # Last, locked info if locked_at is not None: lock_at = time.strftime(conf.supybot.reply.format.time(), time.localtime(int(locked_at))) lock_by = plugins.getUserName(locked_by) - s += format(' Locked by %s on %s.', lock_by, lock_at) + s += format(_(' Locked by %s on %s.'), lock_by, lock_at) irc.reply(s) factinfo = wrap(factinfo, ['channeldb', 'text']) @@ -511,15 +518,15 @@ class MoobotFactoids(callbacks.Plugin): id = user.id info = self.db.getFactinfo(channel, key) if not info: - irc.error(format('No such factoid: %q', key)) + irc.error(format(_('No such factoid: %q'), key)) return (created_by, _, _, _, _, _, _, locked_by, _) = info # Don't perform redundant operations if locking and locked_by is not None: - irc.error(format('Factoid %q is already locked.', key)) + irc.error(format(_('Factoid %q is already locked.'), key)) return if not locking and locked_by is None: - irc.error(format('Factoid %q is not locked.', key)) + irc.error(format(_('Factoid %q is not locked.'), key)) return # Can only lock/unlock own factoids unless you're an admin #self.log.debug('admin?: %s', ircdb.checkCapability(id, 'admin')) @@ -529,8 +536,8 @@ class MoobotFactoids(callbacks.Plugin): s = 'lock' else: s = 'unlock' - irc.error(format('Cannot %s someone else\'s factoid unless you ' - 'are an admin.', s)) + irc.error(format(_('Cannot %s someone else\'s factoid unless you ' + 'are an admin.'), s)) return # Okay, we're done, ready to lock/unlock if locking: @@ -539,6 +546,7 @@ class MoobotFactoids(callbacks.Plugin): self.db.unlock(channel, key) irc.replySuccess() + @internationalizeDocstring def lock(self, irc, msg, args, channel, user, key): """[] @@ -549,6 +557,7 @@ class MoobotFactoids(callbacks.Plugin): self._lock(irc, msg, channel, user, key, True) lock = wrap(lock, ['channeldb', 'user', 'text']) + @internationalizeDocstring def unlock(self, irc, msg, args, channel, user, key): """[] @@ -559,6 +568,7 @@ class MoobotFactoids(callbacks.Plugin): self._lock(irc, msg, channel, user, key, False) unlock = wrap(unlock, ['channeldb', 'user', 'text']) + @internationalizeDocstring def most(self, irc, msg, args, channel, method): """[] {popular|authored|recent} @@ -585,27 +595,35 @@ class MoobotFactoids(callbacks.Plugin): author = 'author' if len(L) != 1: author = 'authors' - irc.reply(format('Most prolific %s: %L', author, L)) + irc.reply(format(_('Most prolific %s: %L'), author, L)) else: - irc.error('There are no factoids in my database.') + irc.error(_('There are no factoids in my database.')) def _mostRecent(self, irc, channel, limit): results = self.db.mostRecent(channel, limit) L = [format('%q', t[0]) for t in results] if L: - irc.reply(format('%n: %L', (len(L), 'latest', 'factoid'), L)) + if len(L) < 2: + latest = _('latest factoid') + else: + latest = _('latest factoids') + irc.reply(format(_('%s: %L'), latest, L)) else: - irc.error('There are no factoids in my database.') + irc.error(_('There are no factoids in my database.')) def _mostPopular(self, irc, channel, limit): results = self.db.mostPopular(channel, limit) L = [format('%q (%s)', t[0], t[1]) for t in results] if L: - irc.reply( - format('Top %n: %L', (len(L), 'requested', 'factoid'), L)) + if len(L) < 2: + requested = _('requested factoid') + else: + requested = _('requested factoids') + irc.reply(format(_('Top %s: %L'), requested, L)) else: - irc.error('No factoids have been requested from my database.') + irc.error(_('No factoids have been requested from my database.')) + @internationalizeDocstring def listauth(self, irc, msg, args, channel, author): """[] @@ -620,14 +638,15 @@ class MoobotFactoids(callbacks.Plugin): irc.errorNoUser(name=author, Raise=True) results = self.db.getKeysByAuthor(channel, id) if not results: - irc.reply(format('No factoids by %q found.', author)) + irc.reply(format(_('No factoids by %q found.'), author)) return keys = [format('%q', t[0]) for t in results] - s = format('Author search for %q (%i found): %L', + s = format(_('Author search for %q (%i found): %L'), author, len(keys), keys) irc.reply(s) listauth = wrap(listauth, ['channeldb', 'something']) + @internationalizeDocstring def listkeys(self, irc, msg, args, channel, search): """[] @@ -637,18 +656,19 @@ class MoobotFactoids(callbacks.Plugin): """ results = self.db.getKeysByGlob(channel, search) if not results: - irc.reply(format('No keys matching %q found.', search)) + irc.reply(format(_('No keys matching %q found.'), search)) elif len(results) == 1 and \ self.registryValue('showFactoidIfOnlyOneMatch', channel): key = results[0][0] self.invalidCommand(irc, msg, [key]) else: keys = [format('%q', tup[0]) for tup in results] - s = format('Key search for %q (%i found): %L', + s = format(_('Key search for %q (%i found): %L'), search, len(keys), keys) irc.reply(s) listkeys = wrap(listkeys, ['channeldb', 'text']) + @internationalizeDocstring def listvalues(self, irc, msg, args, channel, search): """[] @@ -658,14 +678,15 @@ class MoobotFactoids(callbacks.Plugin): """ results = self.db.getKeysByValueGlob(channel, search) if not results: - irc.reply(format('No values matching %q found.', search)) + irc.reply(format(_('No values matching %q found.'), search)) return keys = [format('%q', tup[0]) for tup in results] - s = format('Value search for %q (%i found): %L', + s = format(_('Value search for %q (%i found): %L'), search, len(keys), keys) irc.reply(s) listvalues = wrap(listvalues, ['channeldb', 'text']) + @internationalizeDocstring def remove(self, irc, msg, args, channel, _, key): """[] @@ -678,6 +699,7 @@ class MoobotFactoids(callbacks.Plugin): irc.replySuccess() remove = wrap(remove, ['channeldb', 'user', 'text']) + @internationalizeDocstring def random(self, irc, msg, args, channel): """[] @@ -687,7 +709,7 @@ class MoobotFactoids(callbacks.Plugin): """ results = self.db.randomFactoid(channel) if not results: - irc.error('No factoids in the database.') + irc.error(_('No factoids in the database.')) return (fact, key) = results irc.reply(format('Random factoid: %q is %q', key, fact)) diff --git a/plugins/News/config.py b/plugins/News/config.py index 4ba1a6c46..2a2e0e8f4 100644 --- a/plugins/News/config.py +++ b/plugins/News/config.py @@ -29,6 +29,8 @@ import supybot.conf as conf import supybot.registry as registry +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('News') def configure(advanced): # This will be called by supybot to configure this module. advanced is @@ -42,7 +44,7 @@ def configure(advanced): News = conf.registerPlugin('News') # This is where your configuration variables (if any) should go. For example: # conf.registerGlobalValue(News, '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/News/messages.pot b/plugins/News/messages.pot new file mode 100644 index 000000000..9a77314ef --- /dev/null +++ b/plugins/News/messages.pot @@ -0,0 +1,106 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR ORGANIZATION +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2010-10-17 16:53+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:57 +msgid "%s (Subject: %q, added by %s on %s)" +msgstr "" + +#: plugin.py:61 +msgid "%s (Subject: %q, added by %s on %s, expires at %s)" +msgstr "" + +#: plugin.py:120 +#, docstring +msgid "" +"[] : \n" +"\n" +" Adds a given news item of to a channel with the given .\n" +" If isn't 0, that news item will expire seconds from\n" +" now. is only necessary if the message isn't sent in the\n" +" channel itself.\n" +" " +msgstr "" + +#: plugin.py:132 +msgid "(News item #%i added)" +msgstr "" + +#: plugin.py:137 +#, docstring +msgid "" +"[] []\n" +"\n" +" Display the news items for in the format of '(#id) subject'.\n" +" If is given, retrieve only that news item; otherwise retrieve all\n" +" news items. is only necessary if the message isn't sent in\n" +" the channel itself.\n" +" " +msgstr "" + +#: plugin.py:148 +msgid "News for %s: %s" +msgstr "" + +#: plugin.py:151 +msgid "No news for %s." +msgstr "" + +#: plugin.py:157 plugin.py:171 plugin.py:187 plugin.py:203 +msgid "news item id" +msgstr "" + +#: plugin.py:162 +#, docstring +msgid "" +"[] \n" +"\n" +" Removes the news item with from . is only\n" +" necessary if the message isn't sent in the channel itself.\n" +" " +msgstr "" + +#: plugin.py:176 +#, docstring +msgid "" +"[] \n" +"\n" +" Changes the news item with from according to the\n" +" regular expression . should be of the form\n" +" s/text/replacement/flags. is only necessary if the message\n" +" isn't sent on the channel itself.\n" +" " +msgstr "" + +#: plugin.py:192 +#, docstring +msgid "" +"[] []\n" +"\n" +" Returns the old news item for with . If no number is\n" +" given, returns all the old news items in reverse order. is\n" +" only necessary if the message isn't sent in the channel itself.\n" +" " +msgstr "" + +#: plugin.py:208 +msgid "Old news for %s: %s" +msgstr "" + +#: plugin.py:211 +msgid "No old news for %s." +msgstr "" + diff --git a/plugins/News/plugin.py b/plugins/News/plugin.py index 554ddd825..5a9d5d95d 100644 --- a/plugins/News/plugin.py +++ b/plugins/News/plugin.py @@ -36,6 +36,8 @@ 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('News') class DbiNewsDB(plugins.DbiChannelDB): @@ -52,12 +54,12 @@ class DbiNewsDB(plugins.DbiChannelDB): def __str__(self): user = plugins.getUserName(self.by) if self.expires == 0: - s = format('%s (Subject: %q, added by %s on %s)', + s = format(_('%s (Subject: %q, added by %s on %s)'), self.text, self.subject, self.by, utils.str.timestamp(self.at)) else: - s = format('%s (Subject: %q, added by %s on %s, ' - 'expires at %s)', + s = format(_('%s (Subject: %q, added by %s on %s, ' + 'expires at %s)'), self.text, self.subject, user, utils.str.timestamp(self.at), utils.str.timestamp(self.expires)) @@ -113,6 +115,7 @@ class News(callbacks.Plugin): self.__parent.die() self.db.close() + @internationalizeDocstring def add(self, irc, msg, args, channel, user, at, expires, news): """[] : @@ -126,9 +129,10 @@ class News(callbacks.Plugin): except ValueError: raise callbacks.ArgumentError id = self.db.add(channel, subject, text, at, expires, user.id) - irc.replySuccess(format('(News item #%i added)', id)) + irc.replySuccess(format(_('(News item #%i added)'), id)) add = wrap(add, ['channeldb', 'user', 'now', 'expiry', 'text']) + @internationalizeDocstring def news(self, irc, msg, args, channel, id): """[] [] @@ -141,18 +145,19 @@ class News(callbacks.Plugin): try: records = self.db.get(channel) items = [format('(#%i) %s', R.id, R.subject) for R in records] - s = format('News for %s: %s', channel, '; '.join(items)) + s = format(_('News for %s: %s'), channel, '; '.join(items)) irc.reply(s) except dbi.NoRecordError: - irc.reply(format('No news for %s.', channel)) + irc.reply(format(_('No news for %s.'), channel)) else: try: record = self.db.get(channel, id) irc.reply(str(record)) except dbi.NoRecordError, id: - irc.errorInvalid('news item id', id) + irc.errorInvalid(_('news item id'), id) news = wrap(news, ['channeldb', additional('positiveInt')]) + @internationalizeDocstring def remove(self, irc, msg, args, channel, id): """[] @@ -163,9 +168,10 @@ class News(callbacks.Plugin): self.db.remove(channel, id) irc.replySuccess() except dbi.NoRecordError: - irc.errorInvalid('news item id', id) + irc.errorInvalid(_('news item id'), id) remove = wrap(remove, ['channeldb', 'positiveInt']) + @internationalizeDocstring def change(self, irc, msg, args, channel, id, replacer): """[] @@ -178,9 +184,10 @@ class News(callbacks.Plugin): self.db.change(channel, id, replacer) irc.replySuccess() except dbi.NoRecordError: - irc.errorInvalid('news item id', id) + irc.errorInvalid(_('news item id'), id) change = wrap(change, ['channeldb', 'positiveInt', 'regexpReplacer']) + @internationalizeDocstring def old(self, irc, msg, args, channel, id): """[] [] @@ -193,15 +200,15 @@ class News(callbacks.Plugin): record = self.db.getOld(channel, id) irc.reply(str(record)) except dbi.NoRecordError, id: - irc.errorInvalid('news item id', id) + irc.errorInvalid(_('news item id'), id) else: try: records = self.db.getOld(channel) items = [format('(#%i) %s', R.id, R.subject) for R in records] - s = format('Old news for %s: %s', channel, '; '.join(items)) + s = format(_('Old news for %s: %s'), channel, '; '.join(items)) irc.reply(s) except dbi.NoRecordError: - irc.reply(format('No old news for %s.', channel)) + irc.reply(format(_('No old news for %s.'), channel)) old = wrap(old, ['channeldb', additional('positiveInt')]) diff --git a/plugins/NickCapture/config.py b/plugins/NickCapture/config.py index bad856b12..a333679a3 100644 --- a/plugins/NickCapture/config.py +++ b/plugins/NickCapture/config.py @@ -29,6 +29,8 @@ import supybot.conf as conf import supybot.registry as registry +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('NickCapture') def configure(advanced): # This will be called by supybot to configure this module. advanced is @@ -42,11 +44,11 @@ def configure(advanced): NickCapture = conf.registerPlugin('NickCapture') conf.registerPlugin('NickCapture') conf.registerGlobalValue(NickCapture, 'ison', - registry.Boolean(True, """Determines whether the bot will check - occasionally if its preferred nick is in use via the ISON command.""")) + registry.Boolean(True, _("""Determines whether the bot will check + occasionally if its preferred nick is in use via the ISON command."""))) conf.registerGlobalValue(NickCapture.ison, 'period', - registry.PositiveInteger(600, """Determines how often (in seconds) the bot - will check whether its nick ISON.""")) + registry.PositiveInteger(600, _("""Determines how often (in seconds) the bot + will check whether its nick ISON."""))) # vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: diff --git a/plugins/NickCapture/messages.pot b/plugins/NickCapture/messages.pot new file mode 100644 index 000000000..46813d8b7 --- /dev/null +++ b/plugins/NickCapture/messages.pot @@ -0,0 +1,42 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR ORGANIZATION +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2010-10-17 16:58+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 whether the bot will check\n" +" occasionally if its preferred nick is in use via the ISON command." +msgstr "" + +#: config.py:50 +msgid "" +"Determines how often (in seconds) the bot\n" +" will check whether its nick ISON." +msgstr "" + +#: plugin.py:41 +#, docstring +msgid "" +"This module constantly tries to take whatever nick is configured as\n" +" supybot.nick. Just make sure that's set appropriately, and thus plugin\n" +" will do the rest." +msgstr "" + +#: plugin.py:90 +#, docstring +msgid "This is returned by the ISON command." +msgstr "" + diff --git a/plugins/NickCapture/plugin.py b/plugins/NickCapture/plugin.py index e81ad5718..2d7e7602d 100644 --- a/plugins/NickCapture/plugin.py +++ b/plugins/NickCapture/plugin.py @@ -33,7 +33,10 @@ import supybot.conf as conf import supybot.ircmsgs as ircmsgs import supybot.ircutils as ircutils import supybot.callbacks as callbacks +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('NickCapture') +@internationalizeDocstring class NickCapture(callbacks.Plugin): """This module constantly tries to take whatever nick is configured as supybot.nick. Just make sure that's set appropriately, and thus plugin From 029c0cbe806701151e575dcd010d7e8faa3a13ae Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Sun, 17 Oct 2010 18:37:13 +0200 Subject: [PATCH 10/10] Internationalize Nickometer, Praise, Protector, Quote, and QuoteGrabs --- plugins/Nickometer/config.py | 4 +- plugins/Nickometer/messages.pot | 31 ++++++ plugins/Nickometer/plugin.py | 5 +- plugins/Praise/config.py | 8 +- plugins/Praise/messages.pot | 60 +++++++++++ plugins/Praise/plugin.py | 14 ++- plugins/Protector/config.py | 10 +- plugins/Protector/messages.pot | 31 ++++++ plugins/Protector/plugin.py | 2 + plugins/Quote/config.py | 4 +- plugins/Quote/messages.pot | 31 ++++++ plugins/Quote/plugin.py | 5 +- plugins/QuoteGrabs/config.py | 20 ++-- plugins/QuoteGrabs/messages.pot | 170 ++++++++++++++++++++++++++++++++ plugins/QuoteGrabs/plugin.py | 35 ++++--- 15 files changed, 392 insertions(+), 38 deletions(-) create mode 100644 plugins/Nickometer/messages.pot create mode 100644 plugins/Praise/messages.pot create mode 100644 plugins/Protector/messages.pot create mode 100644 plugins/Quote/messages.pot create mode 100644 plugins/QuoteGrabs/messages.pot diff --git a/plugins/Nickometer/config.py b/plugins/Nickometer/config.py index 27cc2568f..c8945d41f 100644 --- a/plugins/Nickometer/config.py +++ b/plugins/Nickometer/config.py @@ -30,6 +30,8 @@ import supybot.conf as conf import supybot.registry as registry +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('Nickometer') def configure(advanced): # This will be called by setup.py to configure this module. Advanced is @@ -42,7 +44,7 @@ def configure(advanced): Nickometer = conf.registerPlugin('Nickometer') # This is where your configuration variables (if any) should go. For example: # conf.registerGlobalValue(Nickometer, '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/Nickometer/messages.pot b/plugins/Nickometer/messages.pot new file mode 100644 index 000000000..fd8dfe20c --- /dev/null +++ b/plugins/Nickometer/messages.pot @@ -0,0 +1,31 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR ORGANIZATION +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2010-10-17 18: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:84 +#, docstring +msgid "" +"[]\n" +"\n" +" Tells you how lame said nick is. If is not given, uses the\n" +" nick of the person giving the command.\n" +" " +msgstr "" + +#: plugin.py:226 +msgid "The \"lame nick-o-meter\" reading for \"%s\" is %s%%." +msgstr "" + diff --git a/plugins/Nickometer/plugin.py b/plugins/Nickometer/plugin.py index ec24737ff..b5bac6d2c 100644 --- a/plugins/Nickometer/plugin.py +++ b/plugins/Nickometer/plugin.py @@ -53,6 +53,8 @@ import string import supybot.callbacks as callbacks from supybot.commands import wrap, additional +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('Nickometer') def slowExponent(x): return 1.3 * x * (1 - math.atan(x / 6.0) * 2 / math.pi) @@ -77,6 +79,7 @@ class Nickometer(callbacks.Plugin): self.log.debug('%s lameness points awarded: %s', damage, reason) return damage + @internationalizeDocstring def nickometer(self, irc, msg, args, nick): """[] @@ -220,7 +223,7 @@ class Nickometer(callbacks.Plugin): # if it's above 99.9%, show as many digits as is interesting score_string=re.sub('(99\\.9*\\d|\\.\\d).*','\\1',`percentage`) - irc.reply('The "lame nick-o-meter" reading for "%s" is %s%%.' % + irc.reply(_('The "lame nick-o-meter" reading for "%s" is %s%%.') % (originalNick, score_string)) self.log.debug('Calculated lameness score for %s as %s ' diff --git a/plugins/Praise/config.py b/plugins/Praise/config.py index b16b5d842..fc5aadd62 100644 --- a/plugins/Praise/config.py +++ b/plugins/Praise/config.py @@ -29,6 +29,8 @@ import supybot.conf as conf import supybot.registry as registry +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('Praise') def configure(advanced): # This will be called by supybot to configure this module. advanced is @@ -42,10 +44,10 @@ def configure(advanced): Praise = conf.registerPlugin('Praise') # This is where your configuration variables (if any) should go. For example: # conf.registerGlobalValue(Praise, 'someConfigVariableName', -# registry.Boolean(False, """Help for someConfigVariableName.""")) +# registry.Boolean(False, _("""Help for someConfigVariableName."""))) conf.registerChannelValue(Praise, 'showIds', - registry.Boolean(False, """Determines whether the bot will show the ids of - a praise when the praise is given.""")) + registry.Boolean(False, _("""Determines whether the bot will show the ids of + a praise when the praise is given."""))) # vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: diff --git a/plugins/Praise/messages.pot b/plugins/Praise/messages.pot new file mode 100644 index 000000000..81a2b8502 --- /dev/null +++ b/plugins/Praise/messages.pot @@ -0,0 +1,60 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR ORGANIZATION +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2010-10-17 18:33+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 show the ids of\n" +" a praise when the praise is given." +msgstr "" + +#: plugin.py:40 +#, docstring +msgid "" +"Praise is a plugin for ... well, praising things. Feel free to add\n" +" your own flavor to it by customizing what praises it gives. Use \"praise\n" +" add \" to add new ones, making sure to include \"$who\" in where\n" +" you want to insert the thing being praised.\n" +" " +msgstr "" + +#: plugin.py:54 +msgid "Praises must contain $who." +msgstr "" + +#: plugin.py:58 +#, docstring +msgid "" +"[] [] [for ]\n" +"\n" +" Praises (for , if given). If is given, uses\n" +" that specific praise. is only necessary if the message isn't\n" +" sent in the channel itself.\n" +" " +msgstr "" + +#: plugin.py:74 +msgid "There is no praise with id #%i." +msgstr "" + +#: plugin.py:79 +msgid "There are no praises in my database for %s." +msgstr "" + +#: plugin.py:87 +msgid " for " +msgstr "" + diff --git a/plugins/Praise/plugin.py b/plugins/Praise/plugin.py index dd6ad4171..2d912e8c5 100644 --- a/plugins/Praise/plugin.py +++ b/plugins/Praise/plugin.py @@ -32,7 +32,10 @@ import re from supybot.commands import * import supybot.plugins as plugins import supybot.ircutils as ircutils +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('Praise') +@internationalizeDocstring class Praise(plugins.ChannelIdDatabasePlugin): """Praise is a plugin for ... well, praising things. Feel free to add your own flavor to it by customizing what praises it gives. Use "praise @@ -48,8 +51,9 @@ class Praise(plugins.ChannelIdDatabasePlugin): def addValidator(self, irc, text): if '$who' not in text: - irc.error('Praises must contain $who.', Raise=True) + irc.error(_('Praises must contain $who.'), Raise=True) + @internationalizeDocstring def praise(self, irc, msg, args, channel, id, text): """[] [] [for ] @@ -67,20 +71,20 @@ class Praise(plugins.ChannelIdDatabasePlugin): try: praise = self.db.get(channel, id) except KeyError: - irc.error(format('There is no praise with id #%i.', id)) + irc.error(format(_('There is no praise with id #%i.'), id)) return else: praise = self.db.random(channel) if not praise: - irc.error(format('There are no praises in my database ' \ - 'for %s.', channel)) + irc.error(format(_('There are no praises in my database ' \ + 'for %s.'), channel)) return text = self._replaceFirstPerson(praise.text, msg.nick) reason = self._replaceFirstPerson(reason, msg.nick) target = self._replaceFirstPerson(target, msg.nick) text = text.replace('$who', target) if reason: - text += ' for ' + reason + text += _(' for ') + reason if self.registryValue('showIds', channel): text += format(' (#%i)', praise.id) irc.reply(text, action=True) diff --git a/plugins/Protector/config.py b/plugins/Protector/config.py index 977bd0d7a..b4d10f417 100644 --- a/plugins/Protector/config.py +++ b/plugins/Protector/config.py @@ -30,6 +30,8 @@ import supybot.conf as conf import supybot.ircutils as ircutils import supybot.registry as registry +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('Protector') def configure(advanced): # This will be called by supybot to configure this module. advanced is @@ -42,17 +44,17 @@ def configure(advanced): Protector = conf.registerPlugin('Protector') conf.registerChannelValue(Protector, 'enable', - registry.Boolean(True, """Determines whether this plugin is enabled in a - given channel.""")) + registry.Boolean(True, _("""Determines whether this plugin is enabled in a + given channel."""))) class ImmuneNicks(conf.ValidNicks): List = ircutils.IrcSet conf.registerChannelValue(Protector, 'immune', - ImmuneNicks([], """Determines what nicks the bot will consider to + ImmuneNicks([], _("""Determines what nicks the bot will consider to be immune from enforcement. These nicks will not even have their actions watched by this plugin. In general, only the ChanServ for this network - will be in this list.""")) + will be in this list."""))) diff --git a/plugins/Protector/messages.pot b/plugins/Protector/messages.pot new file mode 100644 index 000000000..0bb646f0a --- /dev/null +++ b/plugins/Protector/messages.pot @@ -0,0 +1,31 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR ORGANIZATION +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2010-10-17 18:34+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 whether this plugin is enabled in a\n" +" given channel." +msgstr "" + +#: config.py:54 +msgid "" +"Determines what nicks the bot will consider to\n" +" be immune from enforcement. These nicks will not even have their actions\n" +" watched by this plugin. In general, only the ChanServ for this network\n" +" will be in this list." +msgstr "" + diff --git a/plugins/Protector/plugin.py b/plugins/Protector/plugin.py index cae90feeb..b90e3c2de 100644 --- a/plugins/Protector/plugin.py +++ b/plugins/Protector/plugin.py @@ -32,6 +32,8 @@ import supybot.ircdb as ircdb import supybot.ircmsgs as ircmsgs import supybot.ircutils as ircutils import supybot.callbacks as callbacks +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('Protector') class Protector(callbacks.Plugin): def isImmune(self, irc, msg): diff --git a/plugins/Quote/config.py b/plugins/Quote/config.py index 39813e5d6..1d1a2cfeb 100644 --- a/plugins/Quote/config.py +++ b/plugins/Quote/config.py @@ -29,6 +29,8 @@ import supybot.conf as conf import supybot.registry as registry +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('Quote') def configure(advanced): # This will be called by supybot to configure this module. advanced is @@ -42,7 +44,7 @@ def configure(advanced): Quote = conf.registerPlugin('Quote') # This is where your configuration variables (if any) should go. For example: # conf.registerGlobalValue(Quote, '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/Quote/messages.pot b/plugins/Quote/messages.pot new file mode 100644 index 000000000..7d85fdf6e --- /dev/null +++ b/plugins/Quote/messages.pot @@ -0,0 +1,31 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR ORGANIZATION +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2010-10-17 18:34+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 "" +"[]\n" +"\n" +" Returns a random quote from . is only necessary if\n" +" the message isn't sent in the channel itself.\n" +" " +msgstr "" + +#: plugin.py:47 +msgid "I have no quotes in my database for %s." +msgstr "" + diff --git a/plugins/Quote/plugin.py b/plugins/Quote/plugin.py index c1f0d938a..c18bc750d 100644 --- a/plugins/Quote/plugin.py +++ b/plugins/Quote/plugin.py @@ -29,8 +29,11 @@ from supybot.commands import * import supybot.plugins as plugins +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('Quote') class Quote(plugins.ChannelIdDatabasePlugin): + @internationalizeDocstring def random(self, irc, msg, args, channel): """[] @@ -41,7 +44,7 @@ class Quote(plugins.ChannelIdDatabasePlugin): if quote: irc.reply(self.showRecord(quote)) else: - irc.error('I have no quotes in my database for %s.' % channel) + irc.error(_('I have no quotes in my database for %s.') % channel) random = wrap(random, ['channeldb']) Class = Quote diff --git a/plugins/QuoteGrabs/config.py b/plugins/QuoteGrabs/config.py index 27a8f7b0e..18219a8b3 100644 --- a/plugins/QuoteGrabs/config.py +++ b/plugins/QuoteGrabs/config.py @@ -29,6 +29,8 @@ import supybot.conf as conf import supybot.registry as registry +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('QuoteGrabs') def configure(advanced): # This will be called by supybot to configure this module. advanced is @@ -42,24 +44,24 @@ def configure(advanced): QuoteGrabs = conf.registerPlugin('QuoteGrabs') # This is where your configuration variables (if any) should go. For example: # conf.registerGlobalValue(QuoteGrabs, 'someConfigVariableName', -# registry.Boolean(False, """Help for someConfigVariableName.""")) +# registry.Boolean(False, _("""Help for someConfigVariableName."""))) conf.registerChannelValue(conf.supybot.plugins.QuoteGrabs, 'randomGrabber', - registry.Boolean(False, """Determines whether the bot will randomly grab + registry.Boolean(False, _("""Determines whether the bot will randomly grab possibly-suitable quotes on occasion. The suitability of a given message - is determined by ...""")) + is determined by ..."""))) conf.registerChannelValue(conf.supybot.plugins.QuoteGrabs.randomGrabber, 'averageTimeBetweenGrabs', - registry.PositiveInteger(864000, """Determines about how many seconds, on + registry.PositiveInteger(864000, _("""Determines about how many seconds, on average, should elapse between random grabs. This is only an average value; grabs can happen from any time after half this time until never, - although that's unlikely to occur.""")) + although that's unlikely to occur."""))) conf.registerChannelValue(conf.supybot.plugins.QuoteGrabs.randomGrabber, - 'minimumWords', registry.PositiveInteger(3, """Determines the minimum + 'minimumWords', registry.PositiveInteger(3, _("""Determines the minimum number of words in a message for it to be considered for random - grabbing.""")) + grabbing."""))) conf.registerChannelValue(conf.supybot.plugins.QuoteGrabs.randomGrabber, - 'minimumCharacters', registry.PositiveInteger(8, """Determines the + 'minimumCharacters', registry.PositiveInteger(8, _("""Determines the minimum number of characters in a message for it to be considered for - random grabbing.""")) + random grabbing."""))) # vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: diff --git a/plugins/QuoteGrabs/messages.pot b/plugins/QuoteGrabs/messages.pot new file mode 100644 index 000000000..9b365e4ee --- /dev/null +++ b/plugins/QuoteGrabs/messages.pot @@ -0,0 +1,170 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR ORGANIZATION +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2010-10-17 18:36+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 randomly grab\n" +" possibly-suitable quotes on occasion. The suitability of a given message\n" +" is determined by ..." +msgstr "" + +#: config.py:54 +msgid "" +"Determines about how many seconds, on\n" +" average, should elapse between random grabs. This is only an average\n" +" value; grabs can happen from any time after half this time until never,\n" +" although that's unlikely to occur." +msgstr "" + +#: config.py:59 +msgid "" +"Determines the minimum\n" +" number of words in a message for it to be considered for random\n" +" grabbing." +msgstr "" + +#: config.py:63 +msgid "" +"Determines the\n" +" minimum number of characters in a message for it to be considered for\n" +" random grabbing." +msgstr "" + +#: plugin.py:57 +msgid "%s (Said by: %s; grabbed by %s at %t)" +msgstr "" + +#: plugin.py:210 +#, docstring +msgid "Add the help for \"@help QuoteGrabs\" here." +msgstr "" + +#: plugin.py:249 +#, docstring +msgid "" +"[] \n" +"\n" +" Grabs a quote from by for the quotegrabs table.\n" +" is only necessary if the message isn't sent in the channel\n" +" itself.\n" +" " +msgstr "" + +#: plugin.py:262 +msgid "You can't quote grab yourself." +msgstr "" + +#: plugin.py:269 +msgid "I couldn't find a proper message to grab." +msgstr "" + +#: plugin.py:274 +#, docstring +msgid "" +"[] \n" +"\n" +" Removes the grab (the last by default) on .\n" +" is only necessary if the message isn't sent in the channel\n" +" itself.\n" +" " +msgstr "" + +#: plugin.py:285 +msgid "Nothing to ungrab." +msgstr "" + +#: plugin.py:287 +msgid "Invalid grab number." +msgstr "" + +#: plugin.py:292 +#, docstring +msgid "" +"[] \n" +"\n" +" Returns 's latest quote grab in . is only\n" +" necessary if the message isn't sent in the channel itself.\n" +" " +msgstr "" + +#: plugin.py:300 +msgid "I couldn't find a matching quotegrab for %s." +msgstr "" + +#: plugin.py:306 +#, docstring +msgid "" +"[] \n" +"\n" +" Returns a list of shortened quotes that have been grabbed for \n" +" as well as the id of each quote. These ids can be used to get the\n" +" full quote. is only necessary if the message isn't sent in\n" +" the channel itself.\n" +" " +msgstr "" + +#: plugin.py:323 +msgid "I couldn't find any quotegrabs for %s." +msgstr "" + +#: plugin.py:329 +#, docstring +msgid "" +"[] []\n" +"\n" +" Returns a randomly grabbed quote, optionally choosing only from those\n" +" quotes grabbed for . is only necessary if the message\n" +" isn't sent in the channel itself.\n" +" " +msgstr "" + +#: plugin.py:339 +msgid "Couldn't get a random quote for that nick." +msgstr "" + +#: plugin.py:341 +msgid "Couldn't get a random quote. Are there any grabbed quotes in the database?" +msgstr "" + +#: plugin.py:347 +#, docstring +msgid "" +"[] \n" +"\n" +" Return the quotegrab with the given . is only necessary\n" +" if the message isn't sent in the channel itself.\n" +" " +msgstr "" + +#: plugin.py:355 +msgid "No quotegrab for id %s" +msgstr "" + +#: plugin.py:361 +#, docstring +msgid "" +"[] \n" +"\n" +" Searches for in a quote. is only necessary if the\n" +" message isn't sent in the channel itself.\n" +" " +msgstr "" + +#: plugin.py:376 +msgid "No quotegrabs matching %s" +msgstr "" + diff --git a/plugins/QuoteGrabs/plugin.py b/plugins/QuoteGrabs/plugin.py index 03d3a98d6..9e4f6f77f 100644 --- a/plugins/QuoteGrabs/plugin.py +++ b/plugins/QuoteGrabs/plugin.py @@ -40,6 +40,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('QuoteGrabs') class QuoteGrabsRecord(dbi.Record): __fields__ = [ @@ -52,7 +54,7 @@ class QuoteGrabsRecord(dbi.Record): def __str__(self): grabber = plugins.getUserName(self.grabber) - return format('%s (Said by: %s; grabbed by %s at %t)', + return format(_('%s (Said by: %s; grabbed by %s at %t)'), self.text, self.hostmask, grabber, self.at) class SqliteQuoteGrabsDB(object): @@ -242,6 +244,7 @@ class QuoteGrabs(callbacks.Plugin): s = 'jots down a new quote for %s' % msg.nick irc.reply(s, action=True, prefixNick=False) + @internationalizeDocstring def grab(self, irc, msg, args, channel, nick): """[] @@ -256,16 +259,17 @@ class QuoteGrabs(callbacks.Plugin): if chan is None: raise callbacks.ArgumentError if ircutils.nickEqual(nick, msg.nick): - irc.error('You can\'t quote grab yourself.', Raise=True) + irc.error(_('You can\'t quote grab yourself.'), Raise=True) for m in reversed(irc.state.history): if m.command == 'PRIVMSG' and ircutils.nickEqual(m.nick, nick) \ and ircutils.strEqual(m.args[0], chan): self._grab(channel, irc, m, msg.prefix) irc.replySuccess() return - irc.error('I couldn\'t find a proper message to grab.') + irc.error(_('I couldn\'t find a proper message to grab.')) grab = wrap(grab, ['channeldb', 'nick']) + @internationalizeDocstring def ungrab(self, irc, msg, args, channel, grab): """[] @@ -278,11 +282,12 @@ class QuoteGrabs(callbacks.Plugin): irc.replySuccess() except dbi.NoRecordError: if grab is None: - irc.error('Nothing to ungrab.') + irc.error(_('Nothing to ungrab.')) else: - irc.error('Invalid grab number.') + irc.error(_('Invalid grab number.')) ungrab = wrap(ungrab, ['channeldb', optional('id')]) + @internationalizeDocstring def quote(self, irc, msg, args, channel, nick): """[] @@ -292,10 +297,11 @@ class QuoteGrabs(callbacks.Plugin): try: irc.reply(self.db.getQuote(channel, nick)) except dbi.NoRecordError: - irc.error('I couldn\'t find a matching quotegrab for %s.' % nick, - Raise=True) + irc.error(_('I couldn\'t find a matching quotegrab for %s.') % + nick, Raise=True) quote = wrap(quote, ['channeldb', 'nick']) + @internationalizeDocstring def list(self, irc, msg, args, channel, nick): """[] @@ -314,10 +320,11 @@ class QuoteGrabs(callbacks.Plugin): L.append(item) irc.reply(utils.str.commaAndify(L)) except dbi.NoRecordError: - irc.error('I couldn\'t find any quotegrabs for %s.' % nick, + irc.error(_('I couldn\'t find any quotegrabs for %s.') % nick, Raise=True) list = wrap(list, ['channeldb', 'nick']) + @internationalizeDocstring def random(self, irc, msg, args, channel, nick): """[] [] @@ -329,12 +336,13 @@ class QuoteGrabs(callbacks.Plugin): irc.reply(self.db.random(channel, nick)) except dbi.NoRecordError: if nick: - irc.error('Couldn\'t get a random quote for that nick.') + irc.error(_('Couldn\'t get a random quote for that nick.')) else: - irc.error('Couldn\'t get a random quote. Are there any ' - 'grabbed quotes in the database?') + irc.error(_('Couldn\'t get a random quote. Are there any ' + 'grabbed quotes in the database?')) random = wrap(random, ['channeldb', additional('nick')]) + @internationalizeDocstring def get(self, irc, msg, args, channel, id): """[] @@ -344,10 +352,11 @@ class QuoteGrabs(callbacks.Plugin): try: irc.reply(self.db.get(channel, id)) except dbi.NoRecordError: - irc.error('No quotegrab for id %s' % utils.str.quoted(id), + irc.error(_('No quotegrab for id %s') % utils.str.quoted(id), Raise=True) get = wrap(get, ['channeldb', 'id']) + @internationalizeDocstring def search(self, irc, msg, args, channel, text): """[] @@ -364,7 +373,7 @@ class QuoteGrabs(callbacks.Plugin): L.append(item) irc.reply(utils.str.commaAndify(L)) except dbi.NoRecordError: - irc.error('No quotegrabs matching %s' % utils.str.quoted(text), + irc.error(_('No quotegrabs matching %s') % utils.str.quoted(text), Raise=True) search = wrap(search, ['channeldb', 'text'])