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'])