summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetr Viktorin <pviktori@redhat.com>2012-02-10 04:27:53 -0500
committerMartin Kosek <mkosek@redhat.com>2012-02-10 11:56:05 +0100
commita53dda6ff6a7b2ae6f48b265d2b60d262769556a (patch)
treee14eb91753cb14420ca539f4fab223e8e4619bcc
parentbf97b526c0db3987862042ca429e767265aac861 (diff)
downloadfreeipa.git-a53dda6ff6a7b2ae6f48b265d2b60d262769556a.tar.gz
freeipa.git-a53dda6ff6a7b2ae6f48b265d2b60d262769556a.tar.xz
freeipa.git-a53dda6ff6a7b2ae6f48b265d2b60d262769556a.zip
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.
-rw-r--r--ipalib/plugins/automember.py8
-rw-r--r--ipalib/plugins/baseldap.py18
-rw-r--r--ipalib/plugins/config.py4
-rw-r--r--ipalib/plugins/sudorule.py8
-rw-r--r--ipaserver/plugins/selfsign.py2
5 files changed, 21 insertions, 19 deletions
diff --git a/ipalib/plugins/automember.py b/ipalib/plugins/automember.py
index 3b652185..fabc9bb3 100644
--- a/ipalib/plugins/automember.py
+++ b/ipalib/plugins/automember.py
@@ -185,7 +185,7 @@ class automember(LDAPObject):
try:
(gdn, entry_attrs) = ldap.get_entry(dn, [])
except errors.NotFound:
- raise errors.NotFound(reason=_(u'Group: %s not found!' % groupname))
+ raise errors.NotFound(reason=_(u'Group: %s not found!') % groupname)
return gdn
def get_dn(self, *keys, **options):
@@ -212,7 +212,7 @@ class automember(LDAPObject):
if obj is not None:
return obj
else:
- raise errors.NotFound(reason=_('%s is not a valid attribute.' % attr))
+ raise errors.NotFound(reason=_('%s is not a valid attribute.') % attr)
api.register(automember)
@@ -283,7 +283,7 @@ class automember_add_condition(LDAPUpdate):
try:
(tdn, test_attrs) = ldap.get_entry(dn, [])
except errors.NotFound:
- raise errors.NotFound(reason=_(u'Auto member rule: %s not found!' % keys[0]))
+ raise errors.NotFound(reason=_(u'Auto member rule: %s not found!') % keys[0])
# Define container key
key = options['key']
# Check to see if the attribute is valid
@@ -369,7 +369,7 @@ class automember_remove_condition(LDAPUpdate):
try:
(tdn, test_attrs) = ldap.get_entry(dn, [])
except errors.NotFound:
- raise errors.NotFound(reason=_(u'Auto member rule: %s not found!' % keys[0]))
+ raise errors.NotFound(reason=_(u'Auto member rule: %s not found!') % keys[0])
# Define container key
type_attr_default = {'group': 'manager', 'hostgroup': 'fqdn'}
diff --git a/ipalib/plugins/baseldap.py b/ipalib/plugins/baseldap.py
index 66ba4eff..66339cca 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(
diff --git a/ipalib/plugins/config.py b/ipalib/plugins/config.py
index 1455771d..ecf42464 100644
--- a/ipalib/plugins/config.py
+++ b/ipalib/plugins/config.py
@@ -241,8 +241,8 @@ class config_mod(LDAPUpdate):
continue
if obj_attr not in new_allowed_attrs:
raise errors.ValidationError(name=attr,
- error=_('%s default attribute %s would not be allowed!') \
- % (obj, obj_attr))
+ error=_('%(obj)s default attribute %(attr)s would not be allowed!') \
+ % dict(obj=obj, attr=obj_attr))
if 'ipaselinuxusermapdefault' in options and options['ipaselinuxusermapdefault'] is None:
raise errors.ValidationError(name='ipaselinuxusermapdefault',
diff --git a/ipalib/plugins/sudorule.py b/ipalib/plugins/sudorule.py
index 05fba455..ff7b756a 100644
--- a/ipalib/plugins/sudorule.py
+++ b/ipalib/plugins/sudorule.py
@@ -587,8 +587,8 @@ class sudorule_add_option(LDAPQuery):
return dict(result=entry_attrs)
def output_for_cli(self, textui, result, cn, **options):
- textui.print_dashed(_('Added option "%s" to Sudo Rule "%s"') % \
- (options['ipasudoopt'], cn))
+ textui.print_dashed(_('Added option "%(option)s" to Sudo Rule "%(rule)s"') % \
+ dict(option=options['ipasudoopt'], rule=cn))
super(sudorule_add_option, self).output_for_cli(textui, result, cn, options)
@@ -642,8 +642,8 @@ class sudorule_remove_option(LDAPQuery):
return dict(result=entry_attrs)
def output_for_cli(self, textui, result, cn, **options):
- textui.print_dashed(_('Removed option "%s" from Sudo Rule "%s"') % \
- (options['ipasudoopt'], cn))
+ textui.print_dashed(_('Removed option "%(option)s" from Sudo Rule "%(rule)s"') % \
+ dict(option=options['ipasudoopt'], rule=cn))
super(sudorule_remove_option, self).output_for_cli(textui, result, cn, options)
api.register(sudorule_remove_option)
diff --git a/ipaserver/plugins/selfsign.py b/ipaserver/plugins/selfsign.py
index 36850f13..2f13b1fd 100644
--- a/ipaserver/plugins/selfsign.py
+++ b/ipaserver/plugins/selfsign.py
@@ -101,7 +101,7 @@ class ra(rabase.rabase):
except errors.CertificateOperationError, e:
raise e
except NSPRError, e:
- raise errors.CertificateOperationError(error=_('unable to decode csr: %s' % e))
+ raise errors.CertificateOperationError(error=_('unable to decode csr: %s') % e)
# certutil wants the CSR to have have a header and footer. Add one
# if it isn't there.