From 949d13cdc9ed8db9346315c6ee32966ca33aefae Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Sat, 16 Oct 2010 09:50:23 +0200 Subject: [PATCH] Internationalize Admin --- plugins/Admin/config.py | 2 + plugins/Admin/messages.pot | 187 +++++++++++++++++++++++++++++++++++++ plugins/Admin/plugin.py | 57 ++++++----- 3 files changed, 224 insertions(+), 22 deletions(-) create mode 100644 plugins/Admin/messages.pot diff --git a/plugins/Admin/config.py b/plugins/Admin/config.py index cbc0f6279..c8995d2ce 100644 --- a/plugins/Admin/config.py +++ b/plugins/Admin/config.py @@ -30,6 +30,8 @@ import supybot.conf as conf import supybot.registry as registry +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('Admin') def configure(advanced): # This will be called by supybot to configure this module. advanced is diff --git a/plugins/Admin/messages.pot b/plugins/Admin/messages.pot new file mode 100644 index 000000000..e5833f721 --- /dev/null +++ b/plugins/Admin/messages.pot @@ -0,0 +1,187 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR ORGANIZATION +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2010-10-16 09:41+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:53 +#, docstring +msgid "Nick/channel temporarily unavailable." +msgstr "" + +#: plugin.py:71 +msgid "Cannot join %s, it's full." +msgstr "" + +#: plugin.py:79 +msgid "Cannot join %s, I was not invited." +msgstr "" + +#: plugin.py:87 +msgid "Cannot join %s, it's banned me." +msgstr "" + +#: plugin.py:95 +msgid "Cannot join %s, my keyword was wrong." +msgstr "" + +#: plugin.py:103 +msgid "Cannot join %s, I'm not identified with the NickServ." +msgstr "" + +#: plugin.py:133 +#, docstring +msgid "" +" []\n" +"\n" +" Tell the bot to join the given channel. If is given, it is used\n" +" when attempting to join the channel.\n" +" " +msgstr "" + +#: plugin.py:146 +msgid "I'm already too close to maximum number of channels for this network." +msgstr "" + +#: plugin.py:155 +#, docstring +msgid "" +"takes no arguments\n" +"\n" +" Returns the channels the bot is on. Must be given in private, in order\n" +" to protect the secrecy of secret channels.\n" +" " +msgstr "" + +#: plugin.py:165 +msgid "I'm not currently in any channels." +msgstr "" + +#: plugin.py:171 +msgid "My connection is restricted, I can't change nicks." +msgstr "" + +#: plugin.py:178 +msgid "Someone else is already using that nick." +msgstr "" + +#: plugin.py:185 +msgid "That nick is currently banned." +msgstr "" + +#: plugin.py:192 +msgid "I can't change nicks, the server said %q." +msgstr "" + +#: plugin.py:206 +#, docstring +msgid "" +"[]\n" +"\n" +" Changes the bot's nick to . If no nick is given, returns the\n" +" bot's current nick.\n" +" " +msgstr "" + +#: plugin.py:221 +#, docstring +msgid "" +"[] []\n" +"\n" +" Tells the bot to part the list of channels you give it. is\n" +" only necessary if you want the bot to part a channel other than the\n" +" current channel. If is specified, use it as the part\n" +" message.\n" +" " +msgstr "" + +#: plugin.py:239 +msgid "I'm not in %s." +msgstr "" + +#: plugin.py:251 +#, docstring +msgid "" +" \n" +"\n" +" Gives the user specified by (or the user to whom \n" +" currently maps) the specified capability \n" +" " +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." +msgstr "" + +#: plugin.py:282 +msgid "You can't add capabilities you don't have." +msgstr "" + +#: plugin.py:287 +#, docstring +msgid "" +" \n" +"\n" +" Takes from the user specified by (or the user to whom\n" +" currently maps) the specified capability \n" +" " +msgstr "" + +#: plugin.py:299 +msgid "That user doesn't have that capability." +msgstr "" + +#: plugin.py:301 +msgid "You can't remove capabilities you don't have." +msgstr "" + +#: plugin.py:309 +#, docstring +msgid "" +" []\n" +"\n" +" This will set a persistent ignore on or the hostmask\n" +" currently associated with . is an optional argument\n" +" specifying when (in \"seconds from now\") the ignore will expire; if\n" +" it isn't given, the ignore will never automatically expire.\n" +" " +msgstr "" + +#: plugin.py:322 +#, docstring +msgid "" +"\n" +"\n" +" This will remove the persistent ignore on or the\n" +" hostmask currently associated with .\n" +" " +msgstr "" + +#: plugin.py:331 +msgid "%s wasn't in the ignores database." +msgstr "" + +#: plugin.py:336 +#, docstring +msgid "" +"takes no arguments\n" +"\n" +" Lists the hostmasks that the bot is ignoring.\n" +" " +msgstr "" + +#: plugin.py:344 +msgid "I'm not currently globally ignoring anyone." +msgstr "" + diff --git a/plugins/Admin/plugin.py b/plugins/Admin/plugin.py index 149d08235..205856a2d 100644 --- a/plugins/Admin/plugin.py +++ b/plugins/Admin/plugin.py @@ -1,5 +1,6 @@ ### # Copyright (c) 2002-2005, Jeremiah Fincher +# Copyright (c) 2010, Valentin Lorentz # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -38,6 +39,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('Admin') class Admin(callbacks.Plugin): def __init__(self, irc): @@ -46,6 +49,7 @@ class Admin(callbacks.Plugin): self.joins = {} self.pendingNickChanges = {} + @internationalizeDocstring def do437(self, irc, msg): """Nick/channel temporarily unavailable.""" target = msg.args[0] @@ -65,7 +69,7 @@ class Admin(callbacks.Plugin): try: channel = msg.args[1] (irc, msg) = self.joins.pop(channel) - irc.error('Cannot join %s, it\'s full.' % channel) + irc.error(_('Cannot join %s, it\'s full.') % channel) except KeyError: self.log.debug('Got 471 without Admin.join being called.') @@ -73,7 +77,7 @@ class Admin(callbacks.Plugin): try: channel = msg.args[1] (irc, msg) = self.joins.pop(channel) - irc.error('Cannot join %s, I was not invited.' % channel) + irc.error(_('Cannot join %s, I was not invited.') % channel) except KeyError: self.log.debug('Got 473 without Admin.join being called.') @@ -81,7 +85,7 @@ class Admin(callbacks.Plugin): try: channel = msg.args[1] (irc, msg) = self.joins.pop(channel) - irc.error('Cannot join %s, it\'s banned me.' % channel) + irc.error(_('Cannot join %s, it\'s banned me.') % channel) except KeyError: self.log.debug('Got 474 without Admin.join being called.') @@ -89,7 +93,7 @@ class Admin(callbacks.Plugin): try: channel = msg.args[1] (irc, msg) = self.joins.pop(channel) - irc.error('Cannot join %s, my keyword was wrong.' % channel) + irc.error(_('Cannot join %s, my keyword was wrong.') % channel) except KeyError: self.log.debug('Got 475 without Admin.join being called.') @@ -97,8 +101,8 @@ class Admin(callbacks.Plugin): try: channel = msg.args[1] (irc, msg) = self.joins.pop(channel) - irc.error('Cannot join %s, I\'m not identified with the NickServ.' - % channel) + irc.error(_('Cannot join %s, I\'m not identified with the ' + 'NickServ.') % channel) except KeyError: self.log.debug('Got 515 without Admin.join being called.') @@ -125,6 +129,7 @@ class Admin(callbacks.Plugin): 'the user lacked the "admin" capability.', channel, msg.prefix) + @internationalizeDocstring def join(self, irc, msg, args, channel, key): """ [] @@ -139,13 +144,14 @@ class Admin(callbacks.Plugin): networkGroup.channels.key.get(channel).setValue(key) maxchannels = irc.state.supported.get('maxchannels', sys.maxint) if len(irc.state.channels) + 1 > maxchannels: - irc.error('I\'m already too close to maximum number of ' - 'channels for this network.', Raise=True) + irc.error(_('I\'m already too close to maximum number of ' + 'channels for this network.'), Raise=True) irc.queueMsg(networkGroup.channels.join(channel)) irc.noReply() self.joins[channel] = (irc, msg) join = wrap(join, ['validChannel', additional('something')]) + @internationalizeDocstring def channels(self, irc, msg, args): """takes no arguments @@ -157,34 +163,34 @@ class Admin(callbacks.Plugin): utils.sortBy(ircutils.toLower, L) irc.reply(format('%L', L)) else: - irc.reply('I\'m not currently in any channels.') + irc.reply(_('I\'m not currently in any channels.')) channels = wrap(channels, ['private']) def do484(self, irc, msg): irc = self.pendingNickChanges.get(irc, None) if irc is not None: - irc.error('My connection is restricted, I can\'t change nicks.') + irc.error(_('My connection is restricted, I can\'t change nicks.')) else: self.log.debug('Got 484 without Admin.nick being called.') def do433(self, irc, msg): irc = self.pendingNickChanges.get(irc, None) if irc is not None: - irc.error('Someone else is already using that nick.') + irc.error(_('Someone else is already using that nick.')) else: self.log.debug('Got 433 without Admin.nick being called.') def do435(self, irc, msg): irc = self.pendingNickChanges.get(irc, None) if irc is not None: - irc.error('That nick is currently banned.') + irc.error(_('That nick is currently banned.')) else: self.log.debug('Got 435 without Admin.nick being called.') def do438(self, irc, msg): irc = self.pendingNickChanges.get(irc, None) if irc is not None: - irc.error(format('I can\'t change nicks, the server said %q.', + irc.error(format(_('I can\'t change nicks, the server said %q.'), msg.args[2]), private=True) else: self.log.debug('Got 438 without Admin.nick being called.') @@ -196,6 +202,7 @@ class Admin(callbacks.Plugin): except KeyError: self.log.debug('Got NICK without Admin.nick being called.') + @internationalizeDocstring def nick(self, irc, msg, args, nick): """[] @@ -210,6 +217,7 @@ class Admin(callbacks.Plugin): irc.reply(irc.nick) nick = wrap(nick, [additional('nick')]) + @internationalizeDocstring def part(self, irc, msg, args, channel, reason): """[] [] @@ -229,7 +237,7 @@ class Admin(callbacks.Plugin): except KeyError: pass if channel not in irc.state.channels: - irc.error('I\'m not in %s.' % channel, Raise=True) + irc.error(_('I\'m not in %s.') % channel, Raise=True) irc.queueMsg(ircmsgs.part(channel, reason or msg.nick)) if msg.nick in irc.state.channels[channel].users: irc.noReply() @@ -239,6 +247,7 @@ class Admin(callbacks.Plugin): class capability(callbacks.Commands): + @internationalizeDocstring def add(self, irc, msg, args, user, capability): """ @@ -260,10 +269,10 @@ 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 bot.' - ' Use the supybot-adduser program (or edit 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.') + 'capability.')) return if ircdb.isAntiCapability(capability) or \ ircdb.checkCapability(msg.prefix, capability): @@ -271,9 +280,10 @@ class Admin(callbacks.Plugin): ircdb.users.setUser(user) irc.replySuccess() else: - irc.error('You can\'t add capabilities you don\'t have.') + irc.error(_('You can\'t add capabilities you don\'t have.')) add = wrap(add, ['otherUser', 'lowered']) + @internationalizeDocstring def remove(self, irc, msg, args, user, capability): """ @@ -287,14 +297,15 @@ class Admin(callbacks.Plugin): ircdb.users.setUser(user) irc.replySuccess() except KeyError: - irc.error('That user doesn\'t have that capability.') + irc.error(_('That user doesn\'t have that capability.')) else: - s = 'You can\'t remove capabilities you don\'t have.' + s = _('You can\'t remove capabilities you don\'t have.') irc.error(s) remove = wrap(remove, ['otherUser','lowered']) class ignore(callbacks.Commands): + @internationalizeDocstring def add(self, irc, msg, args, hostmask, expires): """ [] @@ -307,6 +318,7 @@ class Admin(callbacks.Plugin): irc.replySuccess() add = wrap(add, ['hostmask', additional('expiry', 0)]) + @internationalizeDocstring def remove(self, irc, msg, args, hostmask): """ @@ -317,9 +329,10 @@ class Admin(callbacks.Plugin): ircdb.ignores.remove(hostmask) irc.replySuccess() except KeyError: - irc.error('%s wasn\'t in the ignores database.' % hostmask) + irc.error(_('%s wasn\'t in the ignores database.') % hostmask) remove = wrap(remove, ['hostmask']) + @internationalizeDocstring def list(self, irc, msg, args): """takes no arguments @@ -329,7 +342,7 @@ class Admin(callbacks.Plugin): if ircdb.ignores.hostmasks: irc.reply(format('%L', (map(repr,ircdb.ignores.hostmasks)))) else: - irc.reply('I\'m not currently globally ignoring anyone.') + irc.reply(_('I\'m not currently globally ignoring anyone.')) list = wrap(list)