Translate docstrings.

This commit is contained in:
Pavel Zuna 2011-02-10 13:00:00 -05:00 committed by Rob Crittenden
parent bbc94034b0
commit 8145952752
2 changed files with 8 additions and 4 deletions

View File

@ -663,12 +663,16 @@ class help(frontend.Local):
self._topics[topic_name][2].append(c)
else:
m = '%s.%s' % (self._PLUGIN_BASE_MODULE, topic_name)
doc = (sys.modules[m].__doc__ or '').strip().split('\n', 1)[0]
doc = (
unicode(_(sys.modules[m].__doc__)) or ''
).strip().split('\n', 1)[0]
self._topics[topic_name] = [doc, 0, [c]]
mcl = max((self._topics[topic_name][1], len(c.name)))
self._topics[topic_name][1] = mcl
else: # a module grouped in a topic
doc = (sys.modules[c.module].__doc__ or '').strip().split('\n', 1)[0]
doc = (
unicode(_(sys.modules[c.module].__doc__)) or ''
).strip().split('\n', 1)[0]
mod_name = c.module.rsplit('.',1)[1]
if topic_name in self._topics:
if mod_name in self._topics[topic_name][2]:
@ -757,7 +761,7 @@ class help(frontend.Local):
break
m = '%s.%s' % (self._PLUGIN_BASE_MODULE, topic)
doc = (sys.modules[m].__doc__ or '').strip()
doc = (unicode(_(sys.modules[m].__doc__)) or '').strip()
print doc
if len(commands) > 1:

View File

@ -181,7 +181,7 @@ class Plugin(ReadOnly):
self.bases = tuple(
'%s.%s' % (b.__module__, b.__name__) for b in cls.__bases__
)
self.doc = inspect.getdoc(cls)
self.doc = _(inspect.getdoc(cls))
if self.doc is None:
self.summary = '<%s>' % self.fullname
else: