summaryrefslogtreecommitdiffstats
path: root/ipalib
diff options
context:
space:
mode:
authorJohn Dennis <jdennis@redhat.com>2010-03-05 16:11:21 -0500
committerJason Gerard DeRose <jderose@redhat.com>2010-03-08 21:10:36 -0700
commitb75d06e18938015ad6eafe53e15aa2d7a2f92f02 (patch)
tree856e8b5457e91cb1a9bd628ef8ce82c99dc79657 /ipalib
parentb9df4f7f29a638d3646c5ff1ffc33c00f7d715c6 (diff)
downloadfreeipa-b75d06e18938015ad6eafe53e15aa2d7a2f92f02.tar.gz
freeipa-b75d06e18938015ad6eafe53e15aa2d7a2f92f02.tar.xz
freeipa-b75d06e18938015ad6eafe53e15aa2d7a2f92f02.zip
localize doc strings
A number of doc strings were not localized, wrap them in _(). Some messages were not localized, wrap them in _() Fix a couple of failing tests: The method name in RPC should not be unicode. The doc attribute must use the .msg attribute for comparison. Also clean up imports of _() The import should come from ipalib or ipalib.text, not ugettext from request.
Diffstat (limited to 'ipalib')
-rw-r--r--ipalib/cli.py2
-rw-r--r--ipalib/frontend.py6
-rw-r--r--ipalib/output.py7
-rw-r--r--ipalib/plugins/aci.py2
-rw-r--r--ipalib/plugins/baseldap.py8
-rw-r--r--ipalib/plugins/cert.py2
-rw-r--r--ipalib/plugins/config.py2
-rw-r--r--ipalib/plugins/group.py2
-rw-r--r--ipalib/plugins/migration.py46
-rw-r--r--ipalib/plugins/misc.py8
-rw-r--r--ipalib/plugins/netgroup.py2
-rw-r--r--ipalib/plugins/pwpolicy.py2
-rw-r--r--ipalib/plugins/service.py2
13 files changed, 48 insertions, 43 deletions
diff --git a/ipalib/cli.py b/ipalib/cli.py
index a05722d7..904d34d4 100644
--- a/ipalib/cli.py
+++ b/ipalib/cli.py
@@ -40,7 +40,7 @@ import util
from errors import PublicError, CommandError, HelpError, InternalError, NoSuchNamespaceError, ValidationError, NotFound
from constants import CLI_TAB
from parameters import Password, Bytes, File
-from request import ugettext as _
+from text import _
def to_cli(name):
diff --git a/ipalib/frontend.py b/ipalib/frontend.py
index e3828bf8..ba2e44ed 100644
--- a/ipalib/frontend.py
+++ b/ipalib/frontend.py
@@ -782,12 +782,12 @@ class Command(HasParam):
if isinstance(o, (Entry, ListOfEntries)):
yield Flag('all',
cli_name='all',
- doc='retrieve all attributes',
+ doc=_('retrieve all attributes'),
exclude='webui',
)
yield Flag('raw',
cli_name='raw',
- doc='print entries as stored on the server',
+ doc=_('print entries as stored on the server'),
exclude='webui',
)
return
@@ -880,7 +880,7 @@ class LocalOrRemote(Command):
takes_options = (
Flag('server?',
- doc='Forward to server instead of running locally',
+ doc=_('Forward to server instead of running locally'),
),
)
diff --git a/ipalib/output.py b/ipalib/output.py
index 757e7155..354d802f 100644
--- a/ipalib/output.py
+++ b/ipalib/output.py
@@ -24,6 +24,7 @@ Simple description of return values.
from inspect import getdoc
from types import NoneType
from plugable import ReadOnly, lock
+from text import _
class Output(ReadOnly):
@@ -88,7 +89,7 @@ class Output(ReadOnly):
class Entry(Output):
type = dict
- doc = 'A dictionary representing an LDAP entry'
+ doc = _('A dictionary representing an LDAP entry')
emsg = """%s.validate_output() => %s.validate():
@@ -96,7 +97,7 @@ emsg = """%s.validate_output() => %s.validate():
class ListOfEntries(Output):
type = (list, tuple)
- doc = 'A list of LDAP entries'
+ doc = _('A list of LDAP entries')
def validate(self, cmd, entries):
assert isinstance(entries, self.type)
@@ -107,7 +108,7 @@ class ListOfEntries(Output):
)
-result = Output('result', doc='All commands should at least have a result')
+result = Output('result', doc=_('All commands should at least have a result'))
summary = Output('summary', (unicode, NoneType),
'User-friendly description of action performed'
diff --git a/ipalib/plugins/aci.py b/ipalib/plugins/aci.py
index 4914efe1..03e5639f 100644
--- a/ipalib/plugins/aci.py
+++ b/ipalib/plugins/aci.py
@@ -78,7 +78,7 @@ _valid_permissions_values = [
class ListOfACI(output.Output):
type = (list, tuple)
- doc = 'A list of ACI values'
+ doc = _('A list of ACI values')
def validate(self, cmd, entries):
assert isinstance(entries, self.type)
diff --git a/ipalib/plugins/baseldap.py b/ipalib/plugins/baseldap.py
index 2266d851..31f4b4e7 100644
--- a/ipalib/plugins/baseldap.py
+++ b/ipalib/plugins/baseldap.py
@@ -381,11 +381,11 @@ class LDAPAddMember(LDAPModMember):
output.Entry('result'),
output.Output('failed',
type=dict,
- doc='Members that could not be added',
+ doc=_('Members that could not be added'),
),
output.Output('completed',
type=int,
- doc='Number of members added',
+ doc=_('Number of members added'),
),
)
@@ -454,11 +454,11 @@ class LDAPRemoveMember(LDAPModMember):
output.Entry('result'),
output.Output('completed',
type=int,
- doc='Number of members removed',
+ doc=_('Number of members removed'),
),
output.Output('failed',
type=dict,
- doc='Members that could not be removed',
+ doc=_('Members that could not be removed'),
),
)
diff --git a/ipalib/plugins/cert.py b/ipalib/plugins/cert.py
index e266c9ac..a2ecce42 100644
--- a/ipalib/plugins/cert.py
+++ b/ipalib/plugins/cert.py
@@ -201,7 +201,7 @@ class cert_request(VirtualCommand):
has_output = (
Output('result',
type=dict,
- doc='Dictionary mapping variable name to value',
+ doc=_('Dictionary mapping variable name to value'),
),
)
diff --git a/ipalib/plugins/config.py b/ipalib/plugins/config.py
index 31e29f57..b89f17ca 100644
--- a/ipalib/plugins/config.py
+++ b/ipalib/plugins/config.py
@@ -85,7 +85,7 @@ class config(LDAPObject):
Str('ipagroupsearchfields?',
cli_name='groupsearch',
label='Group search fields',
- doc='A comma-separated list of fields to search when searching for groups',
+ doc=_('A comma-separated list of fields to search when searching for groups'),
),
Bool('ipamigrationenabled?',
cli_name='enable_migration',
diff --git a/ipalib/plugins/group.py b/ipalib/plugins/group.py
index 14b73cea..a7852940 100644
--- a/ipalib/plugins/group.py
+++ b/ipalib/plugins/group.py
@@ -148,7 +148,7 @@ class group_mod(LDAPUpdate):
takes_options = LDAPUpdate.takes_options + (
Flag('posix',
cli_name='posix',
- doc='change to posix group',
+ doc=_('change to posix group'),
),
)
diff --git a/ipalib/plugins/migration.py b/ipalib/plugins/migration.py
index 5ae63567..d64aeaca 100644
--- a/ipalib/plugins/migration.py
+++ b/ipalib/plugins/migration.py
@@ -32,14 +32,13 @@ from ipalib import Command, List, Password, Str
from ipalib.cli import to_cli
from ipaserver.plugins.ldap2 import ldap2
from ipalib import _
+from ipalib.text import Gettext # FIXME: remove once the other Gettext FIXME is removed
# USER MIGRATION CALLBACKS AND VARS
-_krb_err_msg = 'Kerberos principal %s already exists. ' \
- 'Use \'ipa user-mod\' to set it manually.'
-_grp_err_msg = 'Failed to add user to the default group. ' \
- 'Use \'ipa group-add-member\' to add manually.'
+_krb_err_msg = _('Kerberos principal %s already exists. Use \'ipa user-mod\' to set it manually.')
+_grp_err_msg = _('Failed to add user to the default group. Use \'ipa group-add-member\' to add manually.')
def _pre_migrate_user(ldap, pkey, dn, entry_attrs, failed, config, ctx):
@@ -168,7 +167,7 @@ class migrate_ds(Command):
),
Password('bindpw',
cli_name='password',
- doc='bind password',
+ doc=_('bind password'),
),
)
@@ -198,30 +197,34 @@ class migrate_ds(Command):
has_output = (
output.Output('result',
type=dict,
- doc='Lists of objects migrated; categorized by type.',
+ doc=_('Lists of objects migrated; categorized by type.'),
),
output.Output('failed',
type=dict,
- doc='Lists of objects that could not be migrated; ' \
- 'categorized by type.',
+ doc=_('Lists of objects that could not be migrated; categorized by type.'),
),
output.Output('enabled',
type=bool,
- doc='False if migration mode was disabled.',
+ doc=_('False if migration mode was disabled.'),
),
)
- exclude_doc = 'comma-separated list of %s to exclude from migration'
- truncated_err_msg = 'search results for objects to be migrated ' \
- 'have been truncated by the server; migration ' \
- 'process might be uncomplete\n'
- migration_disabled_msg = 'Migration mode is disabled. ' \
- 'Use \'ipa config-mod\' to enable it.'
- pwd_migration_msg = 'Passwords have been migrated in pre-hashed format. ' \
- 'IPA is unable to generate Kerberos keys unless provided ' \
- 'with clear text passwords. All migrated users need to ' \
- 'login at https://your.domain/ipa/migration/ before they ' \
- 'can use their Kerberos accounts.'
+ exclude_doc = _('comma-separated list of %s to exclude from migration')
+
+ truncated_err_msg = _('''\
+search results for objects to be migrated
+have been truncated by the server;
+migration process might be uncomplete\n''')
+
+ migration_disabled_msg = _('''\
+Migration mode is disabled. Use \'ipa config-mod\' to enable it.''')
+
+ pwd_migration_msg = _('''\
+Passwords have been migrated in pre-hashed format.
+IPA is unable to generate Kerberos keys unless provided
+with clear text passwords. All migrated users need to
+login at https://your.domain/ipa/migration/ before they
+can use their Kerberos accounts.''')
def get_options(self):
"""
@@ -233,7 +236,8 @@ class migrate_ds(Command):
for ldap_obj_name in self.migrate_objects:
ldap_obj = self.api.Object[ldap_obj_name]
name = 'exclude_%ss' % to_cli(ldap_obj_name)
- doc = self.exclude_doc % ldap_obj.object_name_plural
+ # FIXME: can't substitute strings static Gettext instance
+ doc = Gettext(self.exclude_doc % ldap_obj.object_name_plural)
yield List(
'%s?' % name, cli_name=name, doc=doc, default=tuple(),
autofill=True
diff --git a/ipalib/plugins/misc.py b/ipalib/plugins/misc.py
index 0584654f..428c7120 100644
--- a/ipalib/plugins/misc.py
+++ b/ipalib/plugins/misc.py
@@ -43,15 +43,15 @@ class env(LocalOrRemote):
has_output = (
Output('result',
type=dict,
- doc='Dictionary mapping variable name to value',
+ doc=_('Dictionary mapping variable name to value'),
),
Output('total',
type=int,
- doc='Total number of variables env (>= count)',
+ doc=_('Total number of variables env (>= count)'),
),
Output('count',
type=int,
- doc='Number of variables returned (<= total)',
+ doc=_('Number of variables returned (<= total)'),
),
summary,
)
@@ -100,7 +100,7 @@ class plugins(LocalOrRemote):
Output('result', dict, 'Dictionary mapping plugin names to bases'),
Output('count',
type=int,
- doc='Number of plugins loaded',
+ doc=_('Number of plugins loaded'),
),
summary,
)
diff --git a/ipalib/plugins/netgroup.py b/ipalib/plugins/netgroup.py
index 124b860e..6fd0670b 100644
--- a/ipalib/plugins/netgroup.py
+++ b/ipalib/plugins/netgroup.py
@@ -65,7 +65,7 @@ class netgroup(LDAPObject):
Str('ipauniqueid?',
cli_name='uuid',
label='IPA unique ID',
- doc='IPA unique ID',
+ doc=_('IPA unique ID'),
flags=['no_create', 'no_update'],
),
Str('member_user?',
diff --git a/ipalib/plugins/pwpolicy.py b/ipalib/plugins/pwpolicy.py
index 9580d157..2d4b7048 100644
--- a/ipalib/plugins/pwpolicy.py
+++ b/ipalib/plugins/pwpolicy.py
@@ -277,7 +277,7 @@ class pwpolicy_del(crud.Delete):
msg_summary = _('Deleted policy for group "%(value)s"')
takes_options = (
Str('group',
- doc='Group to remove policy from',
+ doc=_('Group to remove policy from'),
),
)
diff --git a/ipalib/plugins/service.py b/ipalib/plugins/service.py
index 36988bd3..0a878cac 100644
--- a/ipalib/plugins/service.py
+++ b/ipalib/plugins/service.py
@@ -141,7 +141,7 @@ class service_add(LDAPCreate):
member_attributes = ['managedby']
takes_options = (
Flag('force',
- doc='force principal name even if not in DNS',
+ doc=_('force principal name even if not in DNS'),
),
)
def pre_callback(self, ldap, dn, entry_attrs, attrs_list, *keys, **options):