mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-27 05:09:23 +01:00
MessageParser: internationalization and French localization
This commit is contained in:
parent
2779b676c2
commit
401725f511
@ -31,41 +31,42 @@
|
||||
import supybot.conf as conf
|
||||
import supybot.registry as registry
|
||||
|
||||
def configure(advanced):
|
||||
# This will be called by supybot to configure this module. advanced is
|
||||
# a bool that specifies whether the user identified himself as an advanced
|
||||
# user or not. You should effect your configuration by manipulating the
|
||||
# registry as appropriate.
|
||||
from supybot.questions import expect, anything, something, yn
|
||||
conf.registerPlugin('MessageParser', True)
|
||||
try:
|
||||
from supybot.i18n import PluginInternationalization
|
||||
from supybot.i18n import internationalizeDocstring
|
||||
_ = PluginInternationalization('MessageParser')
|
||||
except:
|
||||
# This are useless functions that's allow to run the plugin on a bot
|
||||
# without the i18n plugin
|
||||
_ = lambda x:x
|
||||
internationalizeDocstring = lambda x:x
|
||||
|
||||
MessageParser = conf.registerPlugin('MessageParser')
|
||||
# This is where your configuration variables (if any) should go. For example:
|
||||
# conf.registerGlobalValue(MessageParser, 'someConfigVariableName',
|
||||
# registry.Boolean(False, """Help for someConfigVariableName."""))
|
||||
conf.registerChannelValue(MessageParser, 'enable',
|
||||
registry.Boolean(True, """Determines whether the
|
||||
registry.Boolean(True, _("""Determines whether the
|
||||
message parser is enabled. If enabled, will trigger on regexps
|
||||
added to the regexp db."""))
|
||||
added to the regexp db.""")))
|
||||
conf.registerChannelValue(MessageParser, 'keepRankInfo',
|
||||
registry.Boolean(True, """Determines whether we keep updating the usage
|
||||
count for each regexp, for popularity ranking."""))
|
||||
registry.Boolean(True, _("""Determines whether we keep updating the usage
|
||||
count for each regexp, for popularity ranking.""")))
|
||||
conf.registerChannelValue(MessageParser, 'rankListLength',
|
||||
registry.Integer(20, """Determines the number of regexps returned
|
||||
by the triggerrank command."""))
|
||||
registry.Integer(20, _("""Determines the number of regexps returned
|
||||
by the triggerrank command.""")))
|
||||
conf.registerChannelValue(MessageParser, 'requireVacuumCapability',
|
||||
registry.String('admin', """Determines the capability required (if any) to
|
||||
vacuum the database."""))
|
||||
registry.String('admin', _("""Determines the capability required (if any) to
|
||||
vacuum the database.""")))
|
||||
conf.registerChannelValue(MessageParser, 'requireManageCapability',
|
||||
registry.String('admin; channel,op',
|
||||
"""Determines the
|
||||
registry.String('admin; channel,op', _("""Determines the
|
||||
capabilities required (if any) to manage the regexp database,
|
||||
including add, remove, lock, unlock. Use 'channel,capab' for
|
||||
including add, remove, lock, unlock. Use 'channel,capab' for
|
||||
channel-level capabilities.
|
||||
Note that absence of an explicit anticapability means user has
|
||||
capability."""))
|
||||
Note that absence of an explicit anticapability means user has
|
||||
capability.""")))
|
||||
conf.registerChannelValue(MessageParser, 'listSeparator',
|
||||
registry.String(', ', """Determines the separator used between rexeps when
|
||||
shown by the list command."""))
|
||||
|
||||
registry.String(', ', _("""Determines the separator used between rexeps when
|
||||
shown by the list command.""")))
|
||||
|
||||
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
|
||||
|
241
plugins/MessageParser/locale/fr.po
Normal file
241
plugins/MessageParser/locale/fr.po
Normal file
@ -0,0 +1,241 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Gribble\n"
|
||||
"POT-Creation-Date: 2011-02-26 11:47+CET\n"
|
||||
"PO-Revision-Date: \n"
|
||||
"Last-Translator: Valentin Lorentz <progval@gmail.com>\n"
|
||||
"Language-Team: Supybot-fr <progval@gmail.com>\n"
|
||||
"Language: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Poedit-Language: Français\n"
|
||||
"X-Poedit-Country: France\n"
|
||||
"X-Poedit-SourceCharset: Gribble\n"
|
||||
|
||||
#: config.py:49
|
||||
msgid ""
|
||||
"Determines whether the\n"
|
||||
" message parser is enabled. If enabled, will trigger on regexps\n"
|
||||
" added to the regexp db."
|
||||
msgstr "Détermine si le parseur de messages est activé. S'il l'est, il réagira aux expressions régulières qui sont dans la base de données d'expressions régulières."
|
||||
|
||||
#: config.py:53
|
||||
msgid ""
|
||||
"Determines whether we keep updating the usage\n"
|
||||
" count for each regexp, for popularity ranking."
|
||||
msgstr "Détermine si on met à jour le compteur d'utilisation de chaque expression régulière, pour un classement de popularité"
|
||||
|
||||
#: config.py:56
|
||||
msgid ""
|
||||
"Determines the number of regexps returned\n"
|
||||
" by the triggerrank command."
|
||||
msgstr "Détermine le nombre d'expressions régulières retournées par la commande triggerrank"
|
||||
|
||||
#: config.py:59
|
||||
msgid ""
|
||||
"Determines the capability required (if any) to\n"
|
||||
" vacuum the database."
|
||||
msgstr "Détermine la capacité requise (s'il y en a une) pour faire un vacuum de la base de données."
|
||||
|
||||
#: config.py:62
|
||||
msgid ""
|
||||
"Determines the\n"
|
||||
" capabilities required (if any) to manage the regexp database,\n"
|
||||
" including add, remove, lock, unlock. Use 'channel,capab' for\n"
|
||||
" channel-level capabilities.\n"
|
||||
" Note that absence of an explicit anticapability means user has\n"
|
||||
" capability."
|
||||
msgstr "Détermine les capacités requises (s'il y en a) pour gérer la base de données d'expressions régulières, ce qui inclue l'ajout, la suppression, le verrouillage, et le déverrouillage. Utilisez 'canal,capa' pour des permissions par canal. Notez que l'absence de toute anti-capacité explicite signifit que l'utilisateur peut le faire."
|
||||
|
||||
#: config.py:69
|
||||
msgid ""
|
||||
"Determines the separator used between rexeps when\n"
|
||||
" shown by the list command."
|
||||
msgstr "Détermine le séparateur utilisé entre les expressions régulières affichées par la commande list."
|
||||
|
||||
#: plugin.py:75
|
||||
msgid ""
|
||||
"This plugin can set regexp triggers to activate the bot.\n"
|
||||
" Use 'add' command to add regexp trigger, 'remove' to remove."
|
||||
msgstr "Ce plugin peut définir les triggers pour activer le bot. Utilisez la commande 'add' pour ajouter un trigger et 'remove' pour en retirer un."
|
||||
|
||||
#: plugin.py:83
|
||||
msgid "Create the database and connect to it."
|
||||
msgstr ""
|
||||
|
||||
#: plugin.py:106
|
||||
msgid "Use this to get a database for a specific channel."
|
||||
msgstr ""
|
||||
|
||||
#: plugin.py:129
|
||||
msgid "Run a command from message, as if command was sent over IRC."
|
||||
msgstr ""
|
||||
|
||||
#: plugin.py:137
|
||||
msgid ""
|
||||
"Check if the user has any of the required capabilities to manage\n"
|
||||
" the regexp database."
|
||||
msgstr ""
|
||||
|
||||
#: plugin.py:179
|
||||
msgid ""
|
||||
"[<channel>] <regexp> <action>\n"
|
||||
"\n"
|
||||
" Associates <regexp> with <action>. <channel> is only\n"
|
||||
" necessary if the message isn't sent on the channel\n"
|
||||
" itself. Action is echoed upon regexp match, with variables $1, $2, \n"
|
||||
" etc. being interpolated from the regexp match groups."
|
||||
msgstr ""
|
||||
"[<canal>] <expression régulière> <action>\n"
|
||||
"\n"
|
||||
"Associe l'<expression régulière> à l'<action>. <action> est affiché après la correspondance avec l'<expression régulière>, avec les variables $1, $2, etc, récupérés à partir des groupes de correspondance de l'<expression régulière>.<canal> n'est nécessaire que si le message n'est pas envoyé sur le canal lui-même."
|
||||
|
||||
#: plugin.py:201
|
||||
msgid "Invalid python regexp: %s"
|
||||
msgstr "Expression régulière Python invalide : %s"
|
||||
|
||||
#: plugin.py:213
|
||||
msgid "That trigger is locked."
|
||||
msgstr "Ce trigger est bloqué."
|
||||
|
||||
#: plugin.py:219
|
||||
msgid ""
|
||||
"[<channel>] [--id] <regexp>]\n"
|
||||
"\n"
|
||||
" Removes the trigger for <regexp> from the triggers database. \n"
|
||||
" <channel> is only necessary if\n"
|
||||
" the message isn't sent in the channel itself.\n"
|
||||
" If option --id specified, will retrieve by regexp id, not content.\n"
|
||||
" "
|
||||
msgstr ""
|
||||
"[<canal>] [--id] <expression régulière>\n"
|
||||
"\n"
|
||||
"Supprime le déclencheur pour l'<expression régulière> de la base de données des déclencheurs. Si l'option --id est spécifiée, l'id de l'<expression régulière> sera récupéré, et non le contenu."
|
||||
|
||||
#: plugin.py:241
|
||||
#: plugin.py:271
|
||||
#: plugin.py:294
|
||||
#: plugin.py:322
|
||||
#: plugin.py:352
|
||||
msgid "There is no such regexp trigger."
|
||||
msgstr "Cette expression régulière n'existe pas."
|
||||
|
||||
#: plugin.py:245
|
||||
msgid "This regexp trigger is locked."
|
||||
msgstr "Cette expression régulière est verrouillée"
|
||||
|
||||
#: plugin.py:257
|
||||
msgid ""
|
||||
"[<channel>] <regexp>\n"
|
||||
"\n"
|
||||
" Locks the <regexp> so that it cannot be\n"
|
||||
" removed or overwritten to. <channel> is only necessary if the message isn't\n"
|
||||
" sent in the channel itself.\n"
|
||||
" "
|
||||
msgstr ""
|
||||
"[<canal>] <expression régulière>\n"
|
||||
"\n"
|
||||
"Verrouille l'<expression régulière>, ce qui fait que l'on ne puisse plus la supprimer ou la modifier. <canal> n'est nécessaire que si le message n'est pas envoyé sur le canal lui-même."
|
||||
|
||||
#: plugin.py:280
|
||||
msgid ""
|
||||
"[<channel>] <regexp>\n"
|
||||
"\n"
|
||||
" Unlocks the entry associated with <regexp> so that it can be\n"
|
||||
" removed or overwritten. <channel> is only necessary if the message isn't\n"
|
||||
" sent in the channel itself.\n"
|
||||
" "
|
||||
msgstr ""
|
||||
"[<canal>] <expression régulière>\n"
|
||||
"\n"
|
||||
"Déverrouille l'<expression régulière>, ce qui fait que l'on peut à nouveau la supprimer ou la modifier. <canal> n'est nécessaire que si le message n'est pas envoyé sur le canal lui-même."
|
||||
|
||||
#: plugin.py:303
|
||||
msgid ""
|
||||
"[<channel>] [--id] <regexp>\n"
|
||||
"\n"
|
||||
" Looks up the value of <regexp> in the triggers database.\n"
|
||||
" <channel> is only necessary if the message isn't sent in the channel \n"
|
||||
" itself.\n"
|
||||
" If option --id specified, will retrieve by regexp id, not content.\n"
|
||||
" "
|
||||
msgstr ""
|
||||
"[<canal>] [--id] <expression régulière>\n"
|
||||
"\n"
|
||||
"Recherche la valeur de l'<expression régulière> de la base de données des déclencheurs. Si l'option --id est spécifiée, l'id de l'<expression régulière> sera récupéré, et non le contenu."
|
||||
|
||||
#: plugin.py:332
|
||||
msgid ""
|
||||
"[<channel>] [--id] <regexp>\n"
|
||||
"\n"
|
||||
" Display information about <regexp> in the triggers database.\n"
|
||||
" <channel> is only necessary if the message isn't sent in the channel \n"
|
||||
" itself.\n"
|
||||
" If option --id specified, will retrieve by regexp id, not content.\n"
|
||||
" "
|
||||
msgstr ""
|
||||
"[<canal>] [--id] <expression régulière>\n"
|
||||
"\n"
|
||||
"Affiche des informations à propos de l'<expression régulière> de la base de données des déclencheurs. Si l'option --id est spécifiée, l'id de l'<expression régulière> sera récupéré, et non le contenu."
|
||||
|
||||
#: plugin.py:355
|
||||
msgid "The regexp id is %d, regexp is \"%s\", and action is \"%s\". It was added by user %s on %s, has been triggered %d times, and is %s."
|
||||
msgstr "L'id de l'expression régulière est %d, l'expression régulière est \"%s\", et l'action est \"%s\". Elle a été ajoutée par l'utilisateur %s le %s, et a été utilisée %d fois, et est %s"
|
||||
|
||||
#: plugin.py:364
|
||||
msgid "locked"
|
||||
msgstr "verouillée"
|
||||
|
||||
#: plugin.py:364
|
||||
msgid "not locked"
|
||||
msgstr "non verrouillée"
|
||||
|
||||
#: plugin.py:371
|
||||
msgid ""
|
||||
"[<channel>]\n"
|
||||
"\n"
|
||||
" Lists regexps present in the triggers database.\n"
|
||||
" <channel> is only necessary if the message isn't sent in the channel \n"
|
||||
" itself. Regexp ID listed in paretheses.\n"
|
||||
" "
|
||||
msgstr ""
|
||||
"[<canal>]\n"
|
||||
"\n"
|
||||
"Liste les expressions régulières présentes dans la base de données. <canal> n'est nécessaire que si le message n'est pas envoyé sur le canal lui-même."
|
||||
|
||||
#: plugin.py:384
|
||||
#: plugin.py:410
|
||||
msgid "There are no regexp triggers in the database."
|
||||
msgstr "Il n'y a pas d'expression régulière dans ma base de données."
|
||||
|
||||
#: plugin.py:394
|
||||
msgid ""
|
||||
"[<channel>]\n"
|
||||
" \n"
|
||||
" Returns a list of top-ranked regexps, sorted by usage count \n"
|
||||
" (rank). The number of regexps returned is set by the \n"
|
||||
" rankListLength registry value. <channel> is only necessary if the \n"
|
||||
" message isn't sent in the channel itself.\n"
|
||||
" "
|
||||
msgstr ""
|
||||
"[<canal>]\n"
|
||||
"\n"
|
||||
"Retourne une liste des expressions régulières les plus utilisées. Le nombre d'expressions régulières est définie par la variable de registre supybot.plugins.MessageParser.rankListLength. <canal> n'est nécessaire que si le message n'est pas envoyé sur le canal lui-même."
|
||||
|
||||
#: plugin.py:418
|
||||
msgid ""
|
||||
"[<channel>]\n"
|
||||
" \n"
|
||||
" Vacuums the database for <channel>.\n"
|
||||
" See SQLite vacuum doc here: http://www.sqlite.org/lang_vacuum.html\n"
|
||||
" <channel> is only necessary if the message isn't sent in \n"
|
||||
" the channel itself.\n"
|
||||
" First check if user has the required capability specified in plugin \n"
|
||||
" config requireVacuumCapability.\n"
|
||||
" "
|
||||
msgstr ""
|
||||
"[<canal>]\n"
|
||||
"\n"
|
||||
"Fait un vacuum de la base de données pour le <canal>.Lisez la documentation de SQLite sur cette fonctionnalité : http://www.sqlite.org/lang_vacuum.htmlVérifie d'abord si l'utilisateur a bien la permission spécifiée dans la variable de configuration supybot.plugins.requireVacuumCapability<canal> n'est nécessaire que si le message n'est pas envoyé sur le canal lui-même."
|
||||
|
@ -5,7 +5,7 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"POT-Creation-Date: 2011-02-26 09:49+CET\n"
|
||||
"POT-Creation-Date: 2011-02-26 11:47+CET\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"
|
||||
@ -15,36 +15,77 @@ msgstr ""
|
||||
"Generated-By: pygettext.py 1.5\n"
|
||||
|
||||
|
||||
#: plugin.py:65
|
||||
#: config.py:49
|
||||
msgid ""
|
||||
"Determines whether the\n"
|
||||
" message parser is enabled. If enabled, will trigger on regexps\n"
|
||||
" added to the regexp db."
|
||||
msgstr ""
|
||||
|
||||
#: config.py:53
|
||||
msgid ""
|
||||
"Determines whether we keep updating the usage\n"
|
||||
" count for each regexp, for popularity ranking."
|
||||
msgstr ""
|
||||
|
||||
#: config.py:56
|
||||
msgid ""
|
||||
"Determines the number of regexps returned\n"
|
||||
" by the triggerrank command."
|
||||
msgstr ""
|
||||
|
||||
#: config.py:59
|
||||
msgid ""
|
||||
"Determines the capability required (if any) to\n"
|
||||
" vacuum the database."
|
||||
msgstr ""
|
||||
|
||||
#: config.py:62
|
||||
msgid ""
|
||||
"Determines the\n"
|
||||
" capabilities required (if any) to manage the regexp database,\n"
|
||||
" including add, remove, lock, unlock. Use 'channel,capab' for\n"
|
||||
" channel-level capabilities.\n"
|
||||
" Note that absence of an explicit anticapability means user has\n"
|
||||
" capability."
|
||||
msgstr ""
|
||||
|
||||
#: config.py:69
|
||||
msgid ""
|
||||
"Determines the separator used between rexeps when\n"
|
||||
" shown by the list command."
|
||||
msgstr ""
|
||||
|
||||
#: plugin.py:75
|
||||
#, docstring
|
||||
msgid ""
|
||||
"This plugin can set regexp triggers to activate the bot.\n"
|
||||
" Use 'add' command to add regexp trigger, 'remove' to remove."
|
||||
msgstr ""
|
||||
|
||||
#: plugin.py:73
|
||||
#: plugin.py:83
|
||||
#, docstring
|
||||
msgid "Create the database and connect to it."
|
||||
msgstr ""
|
||||
|
||||
#: plugin.py:96
|
||||
#: plugin.py:106
|
||||
#, docstring
|
||||
msgid "Use this to get a database for a specific channel."
|
||||
msgstr ""
|
||||
|
||||
#: plugin.py:119
|
||||
#: plugin.py:129
|
||||
#, docstring
|
||||
msgid "Run a command from message, as if command was sent over IRC."
|
||||
msgstr ""
|
||||
|
||||
#: plugin.py:127
|
||||
#: plugin.py:137
|
||||
#, docstring
|
||||
msgid ""
|
||||
"Check if the user has any of the required capabilities to manage\n"
|
||||
" the regexp database."
|
||||
msgstr ""
|
||||
|
||||
#: plugin.py:168
|
||||
#: plugin.py:179
|
||||
#, docstring
|
||||
msgid ""
|
||||
"[<channel>] <regexp> <action>\n"
|
||||
@ -55,7 +96,15 @@ msgid ""
|
||||
" etc. being interpolated from the regexp match groups."
|
||||
msgstr ""
|
||||
|
||||
#: plugin.py:207
|
||||
#: plugin.py:201
|
||||
msgid "Invalid python regexp: %s"
|
||||
msgstr ""
|
||||
|
||||
#: plugin.py:213
|
||||
msgid "That trigger is locked."
|
||||
msgstr ""
|
||||
|
||||
#: plugin.py:219
|
||||
#, docstring
|
||||
msgid ""
|
||||
"[<channel>] [--id] <regexp>]\n"
|
||||
@ -67,7 +116,15 @@ msgid ""
|
||||
" "
|
||||
msgstr ""
|
||||
|
||||
#: plugin.py:244
|
||||
#: plugin.py:241 plugin.py:271 plugin.py:294 plugin.py:322 plugin.py:352
|
||||
msgid "There is no such regexp trigger."
|
||||
msgstr ""
|
||||
|
||||
#: plugin.py:245
|
||||
msgid "This regexp trigger is locked."
|
||||
msgstr ""
|
||||
|
||||
#: plugin.py:257
|
||||
#, docstring
|
||||
msgid ""
|
||||
"[<channel>] <regexp>\n"
|
||||
@ -78,7 +135,7 @@ msgid ""
|
||||
" "
|
||||
msgstr ""
|
||||
|
||||
#: plugin.py:266
|
||||
#: plugin.py:280
|
||||
#, docstring
|
||||
msgid ""
|
||||
"[<channel>] <regexp>\n"
|
||||
@ -89,7 +146,7 @@ msgid ""
|
||||
" "
|
||||
msgstr ""
|
||||
|
||||
#: plugin.py:288
|
||||
#: plugin.py:303
|
||||
#, docstring
|
||||
msgid ""
|
||||
"[<channel>] [--id] <regexp>\n"
|
||||
@ -101,7 +158,7 @@ msgid ""
|
||||
" "
|
||||
msgstr ""
|
||||
|
||||
#: plugin.py:316
|
||||
#: plugin.py:332
|
||||
#, docstring
|
||||
msgid ""
|
||||
"[<channel>] [--id] <regexp>\n"
|
||||
@ -113,7 +170,19 @@ msgid ""
|
||||
" "
|
||||
msgstr ""
|
||||
|
||||
#: plugin.py:354
|
||||
#: plugin.py:355
|
||||
msgid "The regexp id is %d, regexp is \"%s\", and action is \"%s\". It was added by user %s on %s, has been triggered %d times, and is %s."
|
||||
msgstr ""
|
||||
|
||||
#: plugin.py:364
|
||||
msgid "locked"
|
||||
msgstr ""
|
||||
|
||||
#: plugin.py:364
|
||||
msgid "not locked"
|
||||
msgstr ""
|
||||
|
||||
#: plugin.py:371
|
||||
#, docstring
|
||||
msgid ""
|
||||
"[<channel>]\n"
|
||||
@ -124,7 +193,11 @@ msgid ""
|
||||
" "
|
||||
msgstr ""
|
||||
|
||||
#: plugin.py:376
|
||||
#: plugin.py:384 plugin.py:410
|
||||
msgid "There are no regexp triggers in the database."
|
||||
msgstr ""
|
||||
|
||||
#: plugin.py:394
|
||||
#, docstring
|
||||
msgid ""
|
||||
"[<channel>]\n"
|
||||
@ -136,7 +209,7 @@ msgid ""
|
||||
" "
|
||||
msgstr ""
|
||||
|
||||
#: plugin.py:399
|
||||
#: plugin.py:418
|
||||
#, docstring
|
||||
msgid ""
|
||||
"[<channel>]\n"
|
||||
|
@ -41,6 +41,16 @@ import re
|
||||
import os
|
||||
import time
|
||||
|
||||
try:
|
||||
from supybot.i18n import PluginInternationalization
|
||||
from supybot.i18n import internationalizeDocstring
|
||||
_ = PluginInternationalization('MessageParser')
|
||||
except:
|
||||
# This are useless functions that's allow to run the plugin on a bot
|
||||
# without the i18n plugin
|
||||
_ = lambda x:x
|
||||
internationalizeDocstring = lambda x:x
|
||||
|
||||
#try:
|
||||
#import sqlite
|
||||
#except ImportError:
|
||||
@ -164,6 +174,7 @@ class MessageParser(callbacks.Plugin, plugins.ChannelDBHandler):
|
||||
for action in actions:
|
||||
self._runCommandFunction(irc, msg, action)
|
||||
|
||||
@internationalizeDocstring
|
||||
def add(self, irc, msg, args, channel, regexp, action):
|
||||
"""[<channel>] <regexp> <action>
|
||||
|
||||
@ -187,7 +198,7 @@ class MessageParser(callbacks.Plugin, plugins.ChannelDBHandler):
|
||||
try:
|
||||
re.compile(regexp)
|
||||
except Exception, e:
|
||||
irc.error('Invalid python regexp: %s' % (e,))
|
||||
irc.error(_('Invalid python regexp: %s') % (e,))
|
||||
return
|
||||
if ircdb.users.hasUser(msg.prefix):
|
||||
name = ircdb.users.getUser(msg.prefix).name
|
||||
@ -199,10 +210,11 @@ class MessageParser(callbacks.Plugin, plugins.ChannelDBHandler):
|
||||
db.commit()
|
||||
irc.replySuccess()
|
||||
else:
|
||||
irc.error('That trigger is locked.')
|
||||
irc.error(_('That trigger is locked.'))
|
||||
return
|
||||
add = wrap(add, ['channel', 'something', 'something'])
|
||||
|
||||
@internationalizeDocstring
|
||||
def remove(self, irc, msg, args, channel, optlist, regexp):
|
||||
"""[<channel>] [--id] <regexp>]
|
||||
|
||||
@ -226,11 +238,11 @@ class MessageParser(callbacks.Plugin, plugins.ChannelDBHandler):
|
||||
if len(results) != 0:
|
||||
(id, locked) = map(int, results[0])
|
||||
else:
|
||||
irc.error('There is no such regexp trigger.')
|
||||
irc.error(_('There is no such regexp trigger.'))
|
||||
return
|
||||
|
||||
if locked:
|
||||
irc.error('This regexp trigger is locked.')
|
||||
irc.error(_('This regexp trigger is locked.'))
|
||||
return
|
||||
|
||||
cursor.execute("""DELETE FROM triggers WHERE id=?""", (id,))
|
||||
@ -240,6 +252,7 @@ class MessageParser(callbacks.Plugin, plugins.ChannelDBHandler):
|
||||
getopts({'id': '',}),
|
||||
'something'])
|
||||
|
||||
@internationalizeDocstring
|
||||
def lock(self, irc, msg, args, channel, regexp):
|
||||
"""[<channel>] <regexp>
|
||||
|
||||
@ -255,13 +268,14 @@ class MessageParser(callbacks.Plugin, plugins.ChannelDBHandler):
|
||||
cursor.execute("SELECT id FROM triggers WHERE regexp=?", (regexp,))
|
||||
results = cursor.fetchall()
|
||||
if len(results) == 0:
|
||||
irc.error('There is no such regexp trigger.')
|
||||
irc.error(_('There is no such regexp trigger.'))
|
||||
return
|
||||
cursor.execute("UPDATE triggers SET locked=1 WHERE regexp=?", (regexp,))
|
||||
db.commit()
|
||||
irc.replySuccess()
|
||||
lock = wrap(lock, ['channel', 'text'])
|
||||
|
||||
@internationalizeDocstring
|
||||
def unlock(self, irc, msg, args, channel, regexp):
|
||||
"""[<channel>] <regexp>
|
||||
|
||||
@ -277,13 +291,14 @@ class MessageParser(callbacks.Plugin, plugins.ChannelDBHandler):
|
||||
cursor.execute("SELECT id FROM triggers WHERE regexp=?", (regexp,))
|
||||
results = cursor.fetchall()
|
||||
if len(results) == 0:
|
||||
irc.error('There is no such regexp trigger.')
|
||||
irc.error(_('There is no such regexp trigger.'))
|
||||
return
|
||||
cursor.execute("UPDATE triggers SET locked=0 WHERE regexp=?", (regexp,))
|
||||
db.commit()
|
||||
irc.replySuccess()
|
||||
unlock = wrap(unlock, ['channel', 'text'])
|
||||
|
||||
@internationalizeDocstring
|
||||
def show(self, irc, msg, args, channel, optlist, regexp):
|
||||
"""[<channel>] [--id] <regexp>
|
||||
|
||||
@ -304,7 +319,7 @@ class MessageParser(callbacks.Plugin, plugins.ChannelDBHandler):
|
||||
if len(results) != 0:
|
||||
(regexp, action) = results[0]
|
||||
else:
|
||||
irc.error('There is no such regexp trigger.')
|
||||
irc.error(_('There is no such regexp trigger.'))
|
||||
return
|
||||
|
||||
irc.reply("The action for regexp trigger \"%s\" is \"%s\"" % (regexp, action))
|
||||
@ -312,6 +327,7 @@ class MessageParser(callbacks.Plugin, plugins.ChannelDBHandler):
|
||||
getopts({'id': '',}),
|
||||
'something'])
|
||||
|
||||
@internationalizeDocstring
|
||||
def info(self, irc, msg, args, channel, optlist, regexp):
|
||||
"""[<channel>] [--id] <regexp>
|
||||
|
||||
@ -333,23 +349,24 @@ class MessageParser(callbacks.Plugin, plugins.ChannelDBHandler):
|
||||
(id, regexp, added_by, added_at, usage_count,
|
||||
action, locked) = results[0]
|
||||
else:
|
||||
irc.error('There is no such regexp trigger.')
|
||||
irc.error(_('There is no such regexp trigger.'))
|
||||
return
|
||||
|
||||
irc.reply("The regexp id is %d, regexp is \"%s\", and action is"
|
||||
irc.reply(_("The regexp id is %d, regexp is \"%s\", and action is"
|
||||
" \"%s\". It was added by user %s on %s, has been "
|
||||
"triggered %d times, and is %s." % (id,
|
||||
"triggered %d times, and is %s.") % (id,
|
||||
regexp,
|
||||
action,
|
||||
added_by,
|
||||
time.strftime(conf.supybot.reply.format.time(),
|
||||
time.localtime(int(added_at))),
|
||||
usage_count,
|
||||
locked and "locked" or "not locked",))
|
||||
locked and _("locked") or _("not locked"),))
|
||||
info = wrap(info, ['channel',
|
||||
getopts({'id': '',}),
|
||||
'something'])
|
||||
|
||||
@internationalizeDocstring
|
||||
def list(self, irc, msg, args, channel):
|
||||
"""[<channel>]
|
||||
|
||||
@ -364,7 +381,7 @@ class MessageParser(callbacks.Plugin, plugins.ChannelDBHandler):
|
||||
if len(results) != 0:
|
||||
regexps = results
|
||||
else:
|
||||
irc.reply('There are no regexp triggers in the database.')
|
||||
irc.reply(_('There are no regexp triggers in the database.'))
|
||||
return
|
||||
|
||||
s = [ "\"%s\" (%d)" % (regexp[0], regexp[1]) for regexp in regexps ]
|
||||
@ -372,6 +389,7 @@ class MessageParser(callbacks.Plugin, plugins.ChannelDBHandler):
|
||||
irc.reply(separator.join(s))
|
||||
list = wrap(list, ['channel'])
|
||||
|
||||
@internationalizeDocstring
|
||||
def rank(self, irc, msg, args, channel):
|
||||
"""[<channel>]
|
||||
|
||||
@ -389,12 +407,13 @@ class MessageParser(callbacks.Plugin, plugins.ChannelDBHandler):
|
||||
LIMIT ?""", (numregexps,))
|
||||
regexps = cursor.fetchall()
|
||||
if len(regexps) == 0:
|
||||
irc.reply('There are no regexp triggers in the database.')
|
||||
irc.reply(_('There are no regexp triggers in the database.'))
|
||||
return
|
||||
s = [ "#%d \"%s\" (%d)" % (i+1, regexp[0], regexp[1]) for i, regexp in enumerate(regexps) ]
|
||||
irc.reply(", ".join(s))
|
||||
rank = wrap(rank, ['channel'])
|
||||
|
||||
@internationalizeDocstring
|
||||
def vacuum(self, irc, msg, args, channel):
|
||||
"""[<channel>]
|
||||
|
||||
@ -415,6 +434,7 @@ class MessageParser(callbacks.Plugin, plugins.ChannelDBHandler):
|
||||
db.commit()
|
||||
irc.replySuccess()
|
||||
vacuum = wrap(vacuum, ['channel'])
|
||||
MessageParser = internationalizeDocstring(MessageParser)
|
||||
|
||||
Class = MessageParser
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user