From 4bf3df40eeb0551bcd80de3af98c3f64398a0c03 Mon Sep 17 00:00:00 2001 From: Duan Jiong Date: Tue, 21 Mar 2017 12:52:23 +0800 Subject: [PATCH] Remove log translations Log messages are no longer being translated. This removes all use of the _LE, _LI, and _LW translation markers to simplify logging and to avoid confusion with new contributions. See: http://lists.openstack.org/pipermail/openstack-i18n/2016-November/002574.html http://lists.openstack.org/pipermail/openstack-dev/2017-March/113365.html Change-Id: Icbfc8958fe430fdd42a569819a8221a32ab681a5 --- neutronclient/_i18n.py | 12 +----------- neutronclient/i18n.py | 4 ---- neutronclient/osc/v2/networking_bgpvpn/bgpvpn.py | 8 +++----- .../osc/v2/networking_bgpvpn/resource_association.py | 8 +++----- 4 files changed, 7 insertions(+), 25 deletions(-) diff --git a/neutronclient/_i18n.py b/neutronclient/_i18n.py index f5aa76bcf..50ac3c5bf 100644 --- a/neutronclient/_i18n.py +++ b/neutronclient/_i18n.py @@ -17,7 +17,7 @@ DOMAIN = 'neutronclient' _translators = oslo_i18n.TranslatorFactory(domain=DOMAIN) -# The primary translation function using the well-known name "_" +# The translation function using the well-known name "_" _ = _translators.primary # The contextual translation function using the name "_C" @@ -26,16 +26,6 @@ _C = _translators.contextual_form # The plural translation function using the name "_P" _P = _translators.plural_form -# Translators for log levels. -# -# The abbreviated names are meant to reflect the usual use of a short -# name like '_'. The "L" is for "log" and the other letter comes from -# the level. -_LI = _translators.log_info -_LW = _translators.log_warning -_LE = _translators.log_error -_LC = _translators.log_critical - def get_available_languages(): return oslo_i18n.get_available_languages(DOMAIN) diff --git a/neutronclient/i18n.py b/neutronclient/i18n.py index 776628fc7..8e9722c14 100644 --- a/neutronclient/i18n.py +++ b/neutronclient/i18n.py @@ -21,7 +21,3 @@ message = ("moved to neutronclient._i18n; please migrate to local " "http://docs.openstack.org/developer/oslo.i18n/usage.html") _ = moves.moved_function(_i18n._, '_', __name__, message=message) -_LC = moves.moved_function(_i18n._LC, '_LC', __name__, message=message) -_LE = moves.moved_function(_i18n._LE, '_LE', __name__, message=message) -_LW = moves.moved_function(_i18n._LW, '_LW', __name__, message=message) -_LI = moves.moved_function(_i18n._LI, '_LI', __name__, message=message) diff --git a/neutronclient/osc/v2/networking_bgpvpn/bgpvpn.py b/neutronclient/osc/v2/networking_bgpvpn/bgpvpn.py index 1e5dbb0ea..e935650b9 100644 --- a/neutronclient/osc/v2/networking_bgpvpn/bgpvpn.py +++ b/neutronclient/osc/v2/networking_bgpvpn/bgpvpn.py @@ -22,8 +22,6 @@ from osc_lib import exceptions from osc_lib import utils as osc_utils from neutronclient._i18n import _ -from neutronclient._i18n import _LE -from neutronclient._i18n import _LW from neutronclient.osc import utils as nc_osc_utils from neutronclient.osc.v2.networking_bgpvpn import constants @@ -311,11 +309,11 @@ class DeleteBgpvpn(command.Command): try: id = client.find_resource(constants.BGPVPN, id_or_name)['id'] client.delete_bgpvpn(id) - LOG.warning(_LW("BGP VPN %(id)s deleted"), {'id': id}) + LOG.warning("BGP VPN %(id)s deleted", {'id': id}) except Exception as e: fails += 1 - LOG.error(_LE("Failed to delete BGP VPN with name or ID " - "'%(id_or_name)s': %(e)s"), + LOG.error("Failed to delete BGP VPN with name or ID " + "'%(id_or_name)s': %(e)s", {'id_or_name': id_or_name, 'e': e}) if fails > 0: msg = (_("Failed to delete %(fails)s of %(total)s BGP VPN.") % diff --git a/neutronclient/osc/v2/networking_bgpvpn/resource_association.py b/neutronclient/osc/v2/networking_bgpvpn/resource_association.py index 98f54cdbe..485803c47 100644 --- a/neutronclient/osc/v2/networking_bgpvpn/resource_association.py +++ b/neutronclient/osc/v2/networking_bgpvpn/resource_association.py @@ -21,8 +21,6 @@ from osc_lib import exceptions from osc_lib import utils as osc_utils from neutronclient._i18n import _ -from neutronclient._i18n import _LE -from neutronclient._i18n import _LW from neutronclient.osc import utils as nc_osc_utils from neutronclient.osc.v2.networking_bgpvpn import constants @@ -105,13 +103,13 @@ class DeleteBgpvpnResAssoc(command.Command): try: delete_method(bgpvpn['id'], id) LOG.warning( - _LW("%(assoc_res_name)s association %(id)s deleted"), + "%(assoc_res_name)s association %(id)s deleted", {'assoc_res_name': self._assoc_res_name.capitalize(), 'id': id}) except Exception as e: fails += 1 - LOG.error(_LE("Failed to delete %(assoc_res_name)s " - "association with ID '%(id)s': %(e)s"), + LOG.error("Failed to delete %(assoc_res_name)s " + "association with ID '%(id)s': %(e)s", {'assoc_res_name': self._assoc_res_name, 'id': id, 'e': e})