Fix some missing i18n support problems in compute

Found and Fix some missing i18n support problems in compute/client.py

Change-Id: I54374f4eddafd9f80b6ccdaf8f8c30e098df105e
Partial-bug: #1574965
This commit is contained in:
Huanxuan Ao 2016-06-03 10:23:58 +08:00
parent 9f65a9954c
commit 95d5d9f761

View File

@ -17,6 +17,7 @@ import logging
from openstackclient.common import exceptions
from openstackclient.common import utils
from openstackclient.i18n import _
LOG = logging.getLogger(__name__)
@ -82,9 +83,9 @@ def build_option_parser(parser):
'--os-compute-api-version',
metavar='<compute-api-version>',
default=utils.env('OS_COMPUTE_API_VERSION'),
help='Compute API version, default=' +
DEFAULT_API_VERSION +
' (Env: OS_COMPUTE_API_VERSION)')
help=_("Compute API version, default=%s "
"(Env: OS_COMPUTE_API_VERSION)") % DEFAULT_API_VERSION
)
return parser
@ -118,10 +119,9 @@ def check_api_version(check_version):
novaclient.API_MIN_VERSION,
novaclient.API_MAX_VERSION,
):
raise exceptions.CommandError(
"versions supported by client: %s - %s" % (
novaclient.API_MIN_VERSION.get_string(),
novaclient.API_MAX_VERSION.get_string(),
),
)
msg = _("versions supported by client: %(min)s - %(max)s") % {
"min": novaclient.API_MIN_VERSION.get_string(),
"max": novaclient.API_MAX_VERSION.get_string(),
}
raise exceptions.CommandError(msg)
return True