From 90d99f6017c934541a5263f4ccd708ad7c36491f Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Fri, 10 Feb 2012 04:27:53 -0500 Subject: Clean up i18n strings This patch switches to named ("%(name)s") instead of positional ("%s") substitutions for internationalized strings, so translators can reorder the words. This fixes https://fedorahosted.org/freeipa/ticket/2179 (xgettext no longer gives warnings). Also, some i18n calls are rewritten to translate the template before substitutions, not after. --- ipalib/plugins/baseldap.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'ipalib/plugins/baseldap.py') diff --git a/ipalib/plugins/baseldap.py b/ipalib/plugins/baseldap.py index 66ba4eff3..66339ccad 100644 --- a/ipalib/plugins/baseldap.py +++ b/ipalib/plugins/baseldap.py @@ -1644,8 +1644,8 @@ class LDAPSearch(BaseLDAPCommand, crud.Search): Retrieve all LDAP entries matching the given criteria. """ member_attributes = [] - member_param_incl_doc = _('Search for %s with these %s %s.') - member_param_excl_doc = _('Search for %s without these %s %s.') + member_param_incl_doc = _('Search for %(searched_object)s with these %(relationship)s %(ldap_object)s.') + member_param_excl_doc = _('Search for %(searched_object)s without these %(relationship)s %(ldap_object)s.') # pointer to function for entries sorting # if no function is assigned the entries are sorted by their primary key value @@ -1684,18 +1684,20 @@ class LDAPSearch(BaseLDAPCommand, crud.Search): relationship = self.obj.relationships.get( attr, ['member', '', 'no_'] ) - doc = self.member_param_incl_doc % ( - self.obj.object_name_plural, relationship[0].lower(), - ldap_obj.object_name_plural + doc = self.member_param_incl_doc % dict( + searched_object=self.obj.object_name_plural, + relationship=relationship[0].lower(), + ldap_object=ldap_obj.object_name_plural ) name = '%s%s' % (relationship[1], to_cli(ldap_obj_name)) yield Str( '%s*' % name, cli_name='%ss' % name, doc=doc, label=ldap_obj.object_name, csv=True ) - doc = self.member_param_excl_doc % ( - self.obj.object_name_plural, relationship[0].lower(), - ldap_obj.object_name_plural + doc = self.member_param_excl_doc % dict( + searched_object=self.obj.object_name_plural, + relationship=relationship[0].lower(), + ldap_object=ldap_obj.object_name_plural ) name = '%s%s' % (relationship[2], to_cli(ldap_obj_name)) yield Str( -- cgit