Skip to content

Commit 908a36f

Browse files
Jenkinsopenstack-gerrit
authored andcommitted
Merge "Fix i18n problems for common files in identity"
2 parents e5dd054 + 304f565 commit 908a36f

2 files changed

Lines changed: 22 additions & 20 deletions

File tree

openstackclient/identity/client.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
from osc_lib import utils
2020

2121
from openstackclient.api import auth
22+
from openstackclient.i18n import _
2223

2324
LOG = logging.getLogger(__name__)
2425

@@ -65,9 +66,9 @@ def build_option_parser(parser):
6566
'--os-identity-api-version',
6667
metavar='<identity-api-version>',
6768
default=utils.env('OS_IDENTITY_API_VERSION'),
68-
help='Identity API version, default=' +
69-
DEFAULT_API_VERSION +
70-
' (Env: OS_IDENTITY_API_VERSION)')
69+
help=_('Identity API version, default=%s '
70+
'(Env: OS_IDENTITY_API_VERSION)') % DEFAULT_API_VERSION,
71+
)
7172
return auth.build_auth_plugins_option_parser(parser)
7273

7374

openstackclient/identity/common.py

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
from osc_lib import exceptions
2424
from osc_lib import utils
2525

26+
from openstackclient.i18n import _
27+
2628

2729
def find_service(identity_client, name_type_or_id):
2830
"""Find a service by id, name or type."""
@@ -37,14 +39,12 @@ def find_service(identity_client, name_type_or_id):
3739
# FIXME(dtroyer): This exception should eventually come from
3840
# common client exceptions
3941
except identity_exc.NotFound:
40-
msg = ("No service with a type, name or ID of '%s' exists."
41-
% name_type_or_id)
42-
raise exceptions.CommandError(msg)
42+
msg = _("No service with a type, name or ID of '%s' exists.")
43+
raise exceptions.CommandError(msg % name_type_or_id)
4344
except identity_exc.NoUniqueMatch:
44-
msg = ("Multiple service matches found for '%s', "
45-
"use an ID to be more specific."
46-
% name_type_or_id)
47-
raise exceptions.CommandError(msg)
45+
msg = _("Multiple service matches found for '%s', "
46+
"use an ID to be more specific.")
47+
raise exceptions.CommandError(msg % name_type_or_id)
4848

4949

5050
def _get_domain_id_if_requested(identity_client, domain_name_or_id):
@@ -131,29 +131,29 @@ def add_user_domain_option_to_parser(parser):
131131
parser.add_argument(
132132
'--user-domain',
133133
metavar='<user-domain>',
134-
help=('Domain the user belongs to (name or ID). '
135-
'This can be used in case collisions between user names '
136-
'exist.')
134+
help=_('Domain the user belongs to (name or ID). '
135+
'This can be used in case collisions between user names '
136+
'exist.'),
137137
)
138138

139139

140140
def add_group_domain_option_to_parser(parser):
141141
parser.add_argument(
142142
'--group-domain',
143143
metavar='<group-domain>',
144-
help=('Domain the group belongs to (name or ID). '
145-
'This can be used in case collisions between group names '
146-
'exist.')
144+
help=_('Domain the group belongs to (name or ID). '
145+
'This can be used in case collisions between group names '
146+
'exist.'),
147147
)
148148

149149

150150
def add_project_domain_option_to_parser(parser):
151151
parser.add_argument(
152152
'--project-domain',
153153
metavar='<project-domain>',
154-
help=('Domain the project belongs to (name or ID). '
155-
'This can be used in case collisions between project names '
156-
'exist.')
154+
help=_('Domain the project belongs to (name or ID). '
155+
'This can be used in case collisions between project names '
156+
'exist.'),
157157
)
158158

159159

@@ -162,5 +162,6 @@ def add_inherited_option_to_parser(parser):
162162
'--inherited',
163163
action='store_true',
164164
default=False,
165-
help=('Specifies if the role grant is inheritable to the sub projects')
165+
help=_('Specifies if the role grant is inheritable to the sub '
166+
'projects'),
166167
)

0 commit comments

Comments
 (0)