Skip to content

Commit 40f51c3

Browse files
author
Tang Chen
committed
Fix i18n support for help and error msg in network
Change-Id: Iab0dc489226601ac4ff123bb758f84ff16989395
1 parent 6ab9e56 commit 40f51c3

7 files changed

Lines changed: 14 additions & 14 deletions

File tree

openstackclient/network/v2/address_scope.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ def take_action(self, parsed_args):
185185
if parsed_args.no_share:
186186
attrs['shared'] = False
187187
if attrs == {}:
188-
msg = "Nothing specified to be set."
188+
msg = _("Nothing specified to be set.")
189189
raise exceptions.CommandError(msg)
190190
client.update_address_scope(obj, **attrs)
191191

openstackclient/network/v2/network.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ def update_parser_network(self, parser):
206206
default_router_grp.add_argument(
207207
'--no-default',
208208
action='store_true',
209-
help=_("Do not use the network as the default external network. "
209+
help=_("Do not use the network as the default external network "
210210
"(default)")
211211
)
212212
_add_provider_network_options(parser)
@@ -243,7 +243,7 @@ def update_parser_common(self, parser):
243243
'network',
244244
metavar="<network>",
245245
nargs="+",
246-
help=("Network(s) to delete (name or ID)")
246+
help=_("Network(s) to delete (name or ID)")
247247
)
248248
return parser
249249

@@ -269,13 +269,13 @@ def update_parser_common(self, parser):
269269
'--external',
270270
action='store_true',
271271
default=False,
272-
help='List external networks',
272+
help=_("List external networks")
273273
)
274274
parser.add_argument(
275275
'--long',
276276
action='store_true',
277277
default=False,
278-
help='List additional fields in output',
278+
help=_("List additional fields in output")
279279
)
280280
return parser
281281

@@ -422,7 +422,7 @@ def take_action(self, parsed_args):
422422

423423
attrs = _get_attrs(self.app.client_manager, parsed_args)
424424
if attrs == {}:
425-
msg = "Nothing specified to be set"
425+
msg = _("Nothing specified to be set")
426426
raise exceptions.CommandError(msg)
427427

428428
client.update_network(obj, **attrs)

openstackclient/network/v2/port.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ def take_action(self, parsed_args):
414414
attrs['fixed_ips'] = []
415415

416416
if attrs == {}:
417-
msg = "Nothing specified to be set"
417+
msg = _("Nothing specified to be set")
418418
raise exceptions.CommandError(msg)
419419
client.update_port(obj, **attrs)
420420

openstackclient/network/v2/router.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ def take_action(self, parsed_args):
411411
attrs['routes'] = obj.routes + parsed_args.routes
412412

413413
if attrs == {}:
414-
msg = "Nothing specified to be set"
414+
msg = _("Nothing specified to be set")
415415
raise exceptions.CommandError(msg)
416416

417417
client.update_router(obj, **attrs)

openstackclient/network/v2/security_group_rule.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -519,8 +519,8 @@ def take_action_compute(self, client, parsed_args):
519519
break
520520

521521
if obj is None:
522-
msg = "Could not find security group rule " \
523-
"with ID %s" % parsed_args.rule
522+
msg = _("Could not find security group rule with ID ") + \
523+
parsed_args.rule
524524
raise exceptions.CommandError(msg)
525525

526526
# NOTE(rtheis): Format security group rule

openstackclient/network/v2/subnet.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,9 @@ def _get_attrs(client_manager, parsed_args, is_create=True):
141141
gateway = parsed_args.gateway.lower()
142142

143143
if not is_create and gateway == 'auto':
144-
raise exceptions.CommandError("Auto option is not available"
145-
" for Subnet Set. Valid options are"
146-
" <ip-address> or none")
144+
msg = _("Auto option is not available for Subnet Set. "
145+
"Valid options are <ip-address> or none")
146+
raise exceptions.CommandError(msg)
147147
elif gateway != 'auto':
148148
if gateway == 'none':
149149
attrs['gateway_ip'] = None

openstackclient/network/v2/subnet_pool.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ def take_action(self, parsed_args):
287287

288288
attrs = _get_attrs(self.app.client_manager, parsed_args)
289289
if attrs == {}:
290-
msg = "Nothing specified to be set"
290+
msg = _("Nothing specified to be set")
291291
raise exceptions.CommandError(msg)
292292

293293
# Existing prefixes must be a subset of the new prefixes.

0 commit comments

Comments
 (0)