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: I5bcba7795894c5f4893c02d9cddb78533011ebd9
This commit is contained in:
Xianghui Zeng 2017-03-22 21:22:15 +08:00
parent 7c563db1d1
commit 05039c5dbd
3 changed files with 4 additions and 17 deletions

View File

@ -12,8 +12,6 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from muranopkgcheck.i18n import _LE
errors = dict() errors = dict()
@ -64,7 +62,7 @@ class Report(object):
kwargs['filename'] = filename or meta.name kwargs['filename'] = filename or meta.name
return CheckError(code=code, message=message, **kwargs) return CheckError(code=code, message=message, **kwargs)
if code not in self.errors: if code not in self.errors:
raise ValueError(_LE('Error {} was not registered').format(code)) raise ValueError('Error {} was not registered'.format(code))
return _report return _report
@ -77,7 +75,7 @@ class Register(object):
def __getattr__(self, code): def __getattr__(self, code):
code = ':'.join((self.prefix, code)) if self.prefix else code code = ':'.join((self.prefix, code)) if self.prefix else code
if code in self.errors: if code in self.errors:
raise ValueError(_LE('Error {} is already registered') raise ValueError('Error {} is already registered'
.format(code)) .format(code))
def _register(**kwargs): def _register(**kwargs):

View File

@ -21,13 +21,3 @@ _translators = oslo_i18n.TranslatorFactory(domain='muranopkgcheck')
# The primary translation function using the well-known name "_" # The primary translation function using the well-known name "_"
_ = _translators.primary _ = _translators.primary
# 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

View File

@ -23,7 +23,6 @@ import stevedore
from muranopkgcheck import error from muranopkgcheck import error
from muranopkgcheck.i18n import _ from muranopkgcheck.i18n import _
from muranopkgcheck.i18n import _LE
from muranopkgcheck import log from muranopkgcheck import log
from muranopkgcheck import pkg_loader from muranopkgcheck import pkg_loader
from muranopkgcheck.validators import VALIDATORS from muranopkgcheck.validators import VALIDATORS
@ -123,8 +122,8 @@ class Manager(object):
@staticmethod @staticmethod
def failure_hook(_, ep, err): def failure_hook(_, ep, err):
LOG.error(_LE('Could not load {plugin}: {error}' LOG.error('Could not load {plugin}: {error}'
'').format(plugin=ep.name, error=err)) ''.format(plugin=ep.name, error=err))
raise err raise err
def validate(self, validators=None, select=None, ignore=None, def validate(self, validators=None, select=None, ignore=None,