summaryrefslogtreecommitdiffstats
path: root/ipalib
diff options
context:
space:
mode:
authorPavel Zuna <pzuna@redhat.com>2011-02-21 14:54:05 -0500
committerRob Crittenden <rcritten@redhat.com>2011-03-01 10:31:42 -0500
commitfc842e36504d39221fbfdafbaf8996b63e20de57 (patch)
treec8e32bca1ea95a27194c571c9e30821f9eb4dbfb /ipalib
parent18dda28c563770730837e2b771a0acdc2e849158 (diff)
downloadfreeipa-fc842e36504d39221fbfdafbaf8996b63e20de57.tar.gz
freeipa-fc842e36504d39221fbfdafbaf8996b63e20de57.tar.xz
freeipa-fc842e36504d39221fbfdafbaf8996b63e20de57.zip
Use pygettext to generate translatable strings from plugin files.
This patch replaces xgettext with a custom pygettext to generate translatable strings from plugin files in ipalib/plugins. pygettext was modified to handle plural forms (credit goes to Jan Hendrik Goellner) and had some bugs fixed by myself. We only use it for plugins, because it's the only place where we need to extract docstrings for the built-in help system. I also had to make some changes to the way the built-in documentation systems gets docstrings from modules for this to work.
Diffstat (limited to 'ipalib')
-rw-r--r--ipalib/cli.py2
-rw-r--r--ipalib/plugable.py5
-rw-r--r--ipalib/plugins/internal.py10
3 files changed, 6 insertions, 11 deletions
diff --git a/ipalib/cli.py b/ipalib/cli.py
index fa1dba8de..60afb7d02 100644
--- a/ipalib/cli.py
+++ b/ipalib/cli.py
@@ -706,7 +706,7 @@ class help(frontend.Local):
self.print_commands(name)
elif name in self.Command:
cmd = self.Command[name]
- print 'Purpose: %s' % cmd.doc
+ print 'Purpose: %s' % unicode(cmd.doc).strip()
self.Backend.cli.build_parser(cmd).print_help()
elif mod_name in sys.modules:
self.print_commands(name)
diff --git a/ipalib/plugable.py b/ipalib/plugable.py
index da02d87f4..92e6392ae 100644
--- a/ipalib/plugable.py
+++ b/ipalib/plugable.py
@@ -182,9 +182,8 @@ class Plugin(ReadOnly):
self.bases = tuple(
'%s.%s' % (b.__module__, b.__name__) for b in cls.__bases__
)
- doc = inspect.getdoc(cls)
- self.doc = _(doc)
- if doc is None:
+ self.doc = _(cls.__doc__)
+ if self.doc is None:
self.summary = '<%s>' % self.fullname
else:
self.summary = unicode(self.doc).split('\n\n', 1)[0]
diff --git a/ipalib/plugins/internal.py b/ipalib/plugins/internal.py
index f25e429e9..ae8bf3b94 100644
--- a/ipalib/plugins/internal.py
+++ b/ipalib/plugins/internal.py
@@ -114,14 +114,11 @@ class i18n_messages(Command):
"privilege_withdrawn":_("Privilege Withdrawn"),
"aa_compromise":_("AA Compromise"),
"revoke_confirmation":_(
- "To confirm your intention to revoke this certificate, "+
- "select a reason from the pull-down list, and click "+
- "the \"Revoke\" button."),
+ "To confirm your intention to revoke this certificate, select a reason from the pull-down list, and click the \"Revoke\" button."),
"note":_("Note"),
"reason":_("Reason for Revocation"),
"restore_confirmation":_(
- "To confirm your intention to restore this certificate, "+
- "click the \"Restore\" button."),
+ "To confirm your intention to restore this certificate, click the \"Restore\" button."),
"issued_to":_("Issued To"),
"common_name":_("Common Name"),
"organization":_("Organization"),
@@ -351,8 +348,7 @@ class i18n_messages(Command):
"unselect_all":_("Unselect All"),
"delete_confirm":_("Are you sure you want to delete selected entries?"),
"truncated":_(
- "Query returned results than configured size limit will show. " +
- "First ${counter} results shown."),
+ "Query returned results than configured size limit will show. First ${counter} results shown."),
},
"details":{
"general":_("General"),