Internationalize Admin

This commit is contained in:
Valentin Lorentz 2010-10-16 09:50:23 +02:00
parent 70af49feb3
commit 949d13cdc9
3 changed files with 224 additions and 22 deletions

View File

@ -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

187
plugins/Admin/messages.pot Normal file
View File

@ -0,0 +1,187 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR ORGANIZATION
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2010-10-16 09:41+CEST\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: ENCODING\n"
"Generated-By: pygettext.py 1.5\n"
#: plugin.py: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 ""
"<channel> [<key>]\n"
"\n"
" Tell the bot to join the given channel. If <key> 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 ""
"[<nick>]\n"
"\n"
" Changes the bot's nick to <nick>. If no nick is given, returns the\n"
" bot's current nick.\n"
" "
msgstr ""
#: plugin.py:221
#, docstring
msgid ""
"[<channel>] [<reason>]\n"
"\n"
" Tells the bot to part the list of channels you give it. <channel> is\n"
" only necessary if you want the bot to part a channel other than the\n"
" current channel. If <reason> 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 ""
"<name|hostmask> <capability>\n"
"\n"
" Gives the user specified by <name> (or the user to whom <hostmask>\n"
" currently maps) the specified capability <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 ""
"<name|hostmask> <capability>\n"
"\n"
" Takes from the user specified by <name> (or the user to whom\n"
" <hostmask> currently maps) the specified capability <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 ""
"<hostmask|nick> [<expires>]\n"
"\n"
" This will set a persistent ignore on <hostmask> or the hostmask\n"
" currently associated with <nick>. <expires> 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 ""
"<hostmask|nick>\n"
"\n"
" This will remove the persistent ignore on <hostmask> or the\n"
" hostmask currently associated with <nick>.\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 ""

View File

@ -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):
"""<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):
"""[<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):
"""[<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):
"""<name|hostmask> <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):
"""<name|hostmask> <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):
"""<hostmask|nick> [<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):
"""<hostmask|nick>
@ -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)