Trivial: Fix i18n support in network/common.py
Some missing i18n problems in network. Change-Id: I45a09a6ada1aad5a64256c0d0a0a2b6e250df670
This commit is contained in:
parent
ca58ab9d09
commit
5a3a7867a8
@ -17,6 +17,7 @@ from openstack import connection
|
|||||||
from openstack import profile
|
from openstack import profile
|
||||||
|
|
||||||
from openstackclient.common import utils
|
from openstackclient.common import utils
|
||||||
|
from openstackclient.i18n import _
|
||||||
|
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
@ -51,7 +52,7 @@ def build_option_parser(parser):
|
|||||||
'--os-network-api-version',
|
'--os-network-api-version',
|
||||||
metavar='<network-api-version>',
|
metavar='<network-api-version>',
|
||||||
default=utils.env('OS_NETWORK_API_VERSION'),
|
default=utils.env('OS_NETWORK_API_VERSION'),
|
||||||
help='Network API version, default=' +
|
help=_("Network API version, default=%s "
|
||||||
DEFAULT_API_VERSION +
|
"(Env: OS_NETWORK_API_VERSION)") % DEFAULT_API_VERSION
|
||||||
' (Env: OS_NETWORK_API_VERSION)')
|
)
|
||||||
return parser
|
return parser
|
||||||
|
@ -16,6 +16,7 @@ import six
|
|||||||
|
|
||||||
from openstackclient.common import command
|
from openstackclient.common import command
|
||||||
from openstackclient.common import exceptions
|
from openstackclient.common import exceptions
|
||||||
|
from openstackclient.i18n import _
|
||||||
|
|
||||||
|
|
||||||
@six.add_metaclass(abc.ABCMeta)
|
@six.add_metaclass(abc.ABCMeta)
|
||||||
@ -94,14 +95,22 @@ class NetworkAndComputeDelete(NetworkAndComputeCommand):
|
|||||||
self.take_action_compute(self.app.client_manager.compute,
|
self.take_action_compute(self.app.client_manager.compute,
|
||||||
parsed_args)
|
parsed_args)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.app.log.error("Failed to delete %s with name or ID "
|
msg = _("Failed to delete %(resource)s with name or ID "
|
||||||
"'%s': %s" % (self.resource, r, e))
|
"'%(name_or_id)s': %(e)s") % {
|
||||||
|
"resource": self.resource,
|
||||||
|
"name_or_id": r,
|
||||||
|
"e": e,
|
||||||
|
}
|
||||||
|
self.app.log.error(msg)
|
||||||
ret += 1
|
ret += 1
|
||||||
|
|
||||||
if ret:
|
if ret:
|
||||||
total = len(resources)
|
total = len(resources)
|
||||||
msg = "%s of %s %ss failed to delete." % (ret, total,
|
msg = _("%(num)s of %(total)s %(resource)s failed to delete.") % {
|
||||||
self.resource)
|
"num": ret,
|
||||||
|
"total": total,
|
||||||
|
"resource": self.resource,
|
||||||
|
}
|
||||||
raise exceptions.CommandError(msg)
|
raise exceptions.CommandError(msg)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user