Use i18n to translate msg in LOG.xxx()

1.Help messages and output info should support oslo.i18n. So we
should use oslo.i18n in LOG.warning()/LOG.error()/ LOG.info()
/LOG.critical()/LOG.exception().

2.Not all files need to translate msg, tests directory and dev directory
are faced with developers, so they need to nothing.

The more information as follow:
 [1] http://docs.openstack.org/developer/oslo.i18n/guidelines.html
 [2] http://docs.openstack.org/developer/oslo.i18n/usage.html

Co-Authored-By: shizhihui <zhihui.shi@easystack.cn>
Change-Id: Iced712f8833e90f3570497cd033713bdc34c27da
This commit is contained in:
Lu lei 2016-09-07 09:41:15 +08:00 committed by shizhihui
parent b6e1be2f7a
commit 1c714d9e5b
5 changed files with 15 additions and 9 deletions

View File

@ -15,13 +15,15 @@ from debtcollector import removals
from oslo_config import cfg
from oslo_middleware import ssl
from heat.common.i18n import _
ssl_middleware_opts = [
cfg.StrOpt('secure_proxy_ssl_header',
default='X-Forwarded-Proto',
deprecated_group='DEFAULT',
help="The HTTP Header that will be used to determine which "
"the original request protocol scheme was, even if it was "
"removed by an SSL terminator proxy.")
help=_("The HTTP Header that will be used to determine what "
"the original request protocol scheme was, even if "
"it was removed by an SSL terminator proxy."))
]

View File

@ -13,12 +13,14 @@
from oslo_log import log as logging
from heat.common.i18n import _LW
LOG = logging.getLogger(__name__)
def log_fail_msg(manager, entrypoint, exception):
LOG.warning('Encountered exception while loading %(module_name)s: '
'"%(message)s". Not using %(name)s.' %
LOG.warning(_LW('Encountered exception while loading %(module_name)s: '
'"%(message)s". Not using %(name)s.'),
{'module_name': entrypoint.module_name,
'message': exception.message,
'name': entrypoint.name})

View File

@ -32,7 +32,8 @@ _default_backend = "heat.engine.clients.OpenStackClients"
cloud_opts = [
cfg.StrOpt('cloud_backend',
default=_default_backend,
help="Fully qualified class name to use as a client backend.")
help=_("Fully qualified class name to use as "
"a client backend."))
]
cfg.CONF.register_opts(cloud_opts)

View File

@ -42,7 +42,8 @@ _default_keystone_backend = (
keystone_opts = [
cfg.StrOpt('keystone_backend',
default=_default_keystone_backend,
help="Fully qualified class name to use as a keystone backend.")
help=_("Fully qualified class name to use as a "
"keystone backend."))
]
cfg.CONF.register_opts(keystone_opts)

View File

@ -251,8 +251,8 @@ lb_template_default = r'''
# Allow user to provide alternative nested stack template to the above
loadbalancer_opts = [
cfg.StrOpt('loadbalancer_template',
help='Custom template for the built-in '
'loadbalancer nested stack.')]
help=_('Custom template for the built-in '
'loadbalancer nested stack.'))]
cfg.CONF.register_opts(loadbalancer_opts)