mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-30 14:14:37 +01:00
Internationalized MoobotFactoids, News, and NickCapture
This commit is contained in:
parent
e5e705f78c
commit
ffc609a299
@ -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
|
||||
|
269
plugins/MoobotFactoids/messages.pot
Normal file
269
plugins/MoobotFactoids/messages.pot
Normal file
@ -0,0 +1,269 @@
|
||||
# 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-17 16:36+CEST\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=CHARSET\n"
|
||||
"Content-Transfer-Encoding: ENCODING\n"
|
||||
"Generated-By: pygettext.py 1.5\n"
|
||||
|
||||
|
||||
#: config.py: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 ""
|
||||
"[<channel>] <factoid key>\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. <channel>\n"
|
||||
" is only necessary if the message isn't sent in the channel itself.\n"
|
||||
" "
|
||||
msgstr ""
|
||||
|
||||
#: plugin.py:470
|
||||
#, docstring
|
||||
msgid ""
|
||||
"[<channel>] <factoid key>\n"
|
||||
"\n"
|
||||
" Returns the various bits of info on the factoid for the given key.\n"
|
||||
" <channel> 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 ""
|
||||
"[<channel>] <factoid key>\n"
|
||||
"\n"
|
||||
" Locks the factoid with the given factoid key. Requires that the user\n"
|
||||
" be registered and have created the factoid originally. <channel> is\n"
|
||||
" only necessary if the message isn't sent in the channel itself.\n"
|
||||
" "
|
||||
msgstr ""
|
||||
|
||||
#: plugin.py:562
|
||||
#, docstring
|
||||
msgid ""
|
||||
"[<channel>] <factoid key>\n"
|
||||
"\n"
|
||||
" Unlocks the factoid with the given factoid key. Requires that the\n"
|
||||
" user be registered and have locked the factoid. <channel> is only\n"
|
||||
" necessary if the message isn't sent in the channel itself.\n"
|
||||
" "
|
||||
msgstr ""
|
||||
|
||||
#: plugin.py:573
|
||||
#, docstring
|
||||
msgid ""
|
||||
"[<channel>] {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"
|
||||
" <channel> 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 ""
|
||||
"[<channel>] <author name>\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!). <channel> 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 ""
|
||||
"[<channel>] <text>\n"
|
||||
"\n"
|
||||
" Lists the keys of the factoids whose key contains the provided text.\n"
|
||||
" <channel> 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 ""
|
||||
"[<channel>] <text>\n"
|
||||
"\n"
|
||||
" Lists the keys of the factoids whose value contains the provided text.\n"
|
||||
" <channel> 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 ""
|
||||
"[<channel>] <factoid key>\n"
|
||||
"\n"
|
||||
" Deletes the factoid with the given key. <channel> is only necessary\n"
|
||||
" if the message isn't sent in the channel itself.\n"
|
||||
" "
|
||||
msgstr ""
|
||||
|
||||
#: plugin.py:704
|
||||
#, docstring
|
||||
msgid ""
|
||||
"[<channel>]\n"
|
||||
"\n"
|
||||
" Displays a random factoid (along with its key) from the database.\n"
|
||||
" <channel> 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 ""
|
||||
|
@ -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):
|
||||
"""[<channel>] <factoid 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):
|
||||
"""[<channel>] <factoid 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):
|
||||
"""[<channel>] <factoid 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):
|
||||
"""[<channel>] <factoid 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):
|
||||
"""[<channel>] {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:
|
||||
irc.error('There are no factoids in my database.')
|
||||
latest = _('latest factoids')
|
||||
irc.reply(format(_('%s: %L'), latest, L))
|
||||
else:
|
||||
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:
|
||||
irc.error('No factoids have been requested from my database.')
|
||||
requested = _('requested factoids')
|
||||
irc.reply(format(_('Top %s: %L'), requested, L))
|
||||
else:
|
||||
irc.error(_('No factoids have been requested from my database.'))
|
||||
|
||||
@internationalizeDocstring
|
||||
def listauth(self, irc, msg, args, channel, author):
|
||||
"""[<channel>] <author name>
|
||||
|
||||
@ -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):
|
||||
"""[<channel>] <text>
|
||||
|
||||
@ -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):
|
||||
"""[<channel>] <text>
|
||||
|
||||
@ -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):
|
||||
"""[<channel>] <factoid 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):
|
||||
"""[<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))
|
||||
|
@ -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:
|
||||
|
106
plugins/News/messages.pot
Normal file
106
plugins/News/messages.pot
Normal file
@ -0,0 +1,106 @@
|
||||
# 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-17 16:53+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: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 ""
|
||||
"[<channel>] <expires> <subject>: <text>\n"
|
||||
"\n"
|
||||
" Adds a given news item of <text> to a channel with the given <subject>.\n"
|
||||
" If <expires> isn't 0, that news item will expire <expires> seconds from\n"
|
||||
" now. <channel> 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 ""
|
||||
"[<channel>] [<id>]\n"
|
||||
"\n"
|
||||
" Display the news items for <channel> in the format of '(#id) subject'.\n"
|
||||
" If <id> is given, retrieve only that news item; otherwise retrieve all\n"
|
||||
" news items. <channel> 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 ""
|
||||
"[<channel>] <id>\n"
|
||||
"\n"
|
||||
" Removes the news item with <id> from <channel>. <channel> is only\n"
|
||||
" necessary if the message isn't sent in the channel itself.\n"
|
||||
" "
|
||||
msgstr ""
|
||||
|
||||
#: plugin.py:176
|
||||
#, docstring
|
||||
msgid ""
|
||||
"[<channel>] <id> <regexp>\n"
|
||||
"\n"
|
||||
" Changes the news item with <id> from <channel> according to the\n"
|
||||
" regular expression <regexp>. <regexp> should be of the form\n"
|
||||
" s/text/replacement/flags. <channel> is only necessary if the message\n"
|
||||
" isn't sent on the channel itself.\n"
|
||||
" "
|
||||
msgstr ""
|
||||
|
||||
#: plugin.py:192
|
||||
#, docstring
|
||||
msgid ""
|
||||
"[<channel>] [<id>]\n"
|
||||
"\n"
|
||||
" Returns the old news item for <channel> with <id>. If no number is\n"
|
||||
" given, returns all the old news items in reverse order. <channel> 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 ""
|
||||
|
@ -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):
|
||||
"""[<channel>] <expires> <subject>: <text>
|
||||
|
||||
@ -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):
|
||||
"""[<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):
|
||||
"""[<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):
|
||||
"""[<channel>] <id> <regexp>
|
||||
|
||||
@ -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):
|
||||
"""[<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')])
|
||||
|
||||
|
||||
|
@ -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:
|
||||
|
42
plugins/NickCapture/messages.pot
Normal file
42
plugins/NickCapture/messages.pot
Normal file
@ -0,0 +1,42 @@
|
||||
# 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-17 16:58+CEST\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=CHARSET\n"
|
||||
"Content-Transfer-Encoding: ENCODING\n"
|
||||
"Generated-By: pygettext.py 1.5\n"
|
||||
|
||||
|
||||
#: config.py: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 ""
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user