From 0360451cb966b63eaf1226a892be4492c44b5ec6 Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Sun, 31 Oct 2010 11:29:01 +0100 Subject: [PATCH 1/2] Note & Owner : fix missing import for the i18n --- plugins/Misc/plugin.py | 1 - plugins/Note/config.py | 2 ++ plugins/Note/plugin.py | 2 ++ plugins/Owner/config.py | 2 ++ plugins/Owner/plugin.py | 2 ++ 5 files changed, 8 insertions(+), 1 deletion(-) diff --git a/plugins/Misc/plugin.py b/plugins/Misc/plugin.py index f03d26750..147f29701 100644 --- a/plugins/Misc/plugin.py +++ b/plugins/Misc/plugin.py @@ -42,7 +42,6 @@ import supybot.irclib as irclib import supybot.ircmsgs as ircmsgs import supybot.ircutils as ircutils import supybot.callbacks as callbacks - from supybot.utils.iter import ifilter from supybot.i18n import PluginInternationalization, internationalizeDocstring _ = PluginInternationalization('Misc') diff --git a/plugins/Note/config.py b/plugins/Note/config.py index 7603eb7e9..b3be8b120 100644 --- a/plugins/Note/config.py +++ b/plugins/Note/config.py @@ -29,6 +29,8 @@ import supybot.conf as conf import supybot.registry as registry +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('Note') def configure(advanced): # This will be called by supybot to configure this module. advanced is diff --git a/plugins/Note/plugin.py b/plugins/Note/plugin.py index 3fd3cb326..b89de964d 100644 --- a/plugins/Note/plugin.py +++ b/plugins/Note/plugin.py @@ -42,6 +42,8 @@ import supybot.ircmsgs as ircmsgs import supybot.plugins as plugins import supybot.ircutils as ircutils import supybot.callbacks as callbacks +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('Note') class NoteRecord(dbi.Record): __fields__ = [ diff --git a/plugins/Owner/config.py b/plugins/Owner/config.py index c171db000..cd0fe0f94 100644 --- a/plugins/Owner/config.py +++ b/plugins/Owner/config.py @@ -30,6 +30,8 @@ import supybot.conf as conf import supybot.registry as registry +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('Owner') def configure(advanced): # This will be called by supybot to configure this module. advanced is diff --git a/plugins/Owner/plugin.py b/plugins/Owner/plugin.py index c025529db..73d2707a1 100644 --- a/plugins/Owner/plugin.py +++ b/plugins/Owner/plugin.py @@ -54,6 +54,8 @@ import supybot.ircmsgs as ircmsgs import supybot.ircutils as ircutils import supybot.registry as registry import supybot.callbacks as callbacks +from supybot.i18n import PluginInternationalization, internationalizeDocstring +_ = PluginInternationalization('Owner') ### # supybot.commands. From 283a026449fae5ceffb9b844fdba2f2d9bf61c9e Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Sun, 31 Oct 2010 11:30:04 +0100 Subject: [PATCH 2/2] Add the i18n test in src/test.py --- src/test.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/test.py b/src/test.py index 50dad08a7..2ff5fa465 100644 --- a/src/test.py +++ b/src/test.py @@ -37,6 +37,7 @@ import unittest import threading import supybot.log as log +import supybot.i18n as i18n import supybot.conf as conf import supybot.utils as utils import supybot.ircdb as ircdb @@ -359,6 +360,7 @@ class PluginTestCase(SupyTestCase): return for cb in self.irc.callbacks: name = cb.name() + print " --- " + name if ((name in self._noTestDoc) and \ not name.lower() in self.__class__.__name__.lower()): continue @@ -370,6 +372,13 @@ class PluginTestCase(SupyTestCase): attr == callbacks.canonicalName(attr): self.failUnless(getattr(cb, attr, None).__doc__, '%s.%s has no help.' % (name, attr)) + def testInternationalization(self): + name = self.__class__.__module__[0:-len('.test')] + if self.__class__.__module__.startswith('supybot'): + return + self.failIf(hasattr(sys.modules[name], '_') == False, + '%s has no internationalizer.' % name) + class ChannelPluginTestCase(PluginTestCase):