From 8a2ba06743b68df26e2083d688f7f3fcc8f11166 Mon Sep 17 00:00:00 2001 From: Yuriy Taraday Date: Wed, 20 Aug 2014 14:39:23 +0400 Subject: [PATCH] Switch to oslo.i18n in our code Note that gettextutils are still indirectly used by fileutils (through log). Change-Id: I4ea4830ed149aff87146a4b7392d7e48c6a7c793 --- openstack-common.conf | 1 - oslo/concurrency/_i18n.py | 32 ++++++++++++++++++++++++++++++++ oslo/concurrency/lockutils.py | 2 +- oslo/concurrency/processutils.py | 2 +- requirements-py3.txt | 1 + requirements.txt | 1 + 6 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 oslo/concurrency/_i18n.py diff --git a/openstack-common.conf b/openstack-common.conf index fed59cb..dbf2dc8 100644 --- a/openstack-common.conf +++ b/openstack-common.conf @@ -3,7 +3,6 @@ # The list of modules to copy from oslo-incubator.git module = fileutils module = fixture -module = gettextutils script = tools/run_cross_tests.sh # The base module to hold the copy of openstack.common diff --git a/oslo/concurrency/_i18n.py b/oslo/concurrency/_i18n.py new file mode 100644 index 0000000..eea7d44 --- /dev/null +++ b/oslo/concurrency/_i18n.py @@ -0,0 +1,32 @@ +# Copyright 2014 Mirantis Inc. +# +# All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from oslo import i18n + +_translators = i18n.TranslatorFactory(domain='oslo.concurrency') + +# The primary translation function using the well-known name "_" +_ = _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 diff --git a/oslo/concurrency/lockutils.py b/oslo/concurrency/lockutils.py index c852b5e..0b8bee9 100644 --- a/oslo/concurrency/lockutils.py +++ b/oslo/concurrency/lockutils.py @@ -28,8 +28,8 @@ import weakref from oslo.config import cfg +from oslo.concurrency._i18n import _, _LE, _LI # noqa from oslo.concurrency.openstack.common import fileutils -from oslo.concurrency.openstack.common.gettextutils import _, _LE, _LI # noqa LOG = logging.getLogger(__name__) diff --git a/oslo/concurrency/processutils.py b/oslo/concurrency/processutils.py index 48e7ac8..98c8ad0 100644 --- a/oslo/concurrency/processutils.py +++ b/oslo/concurrency/processutils.py @@ -30,7 +30,7 @@ from eventlet import greenthread from oslo.utils import strutils import six -from oslo.concurrency.openstack.common.gettextutils import _ # noqa +from oslo.concurrency._i18n import _ # noqa LOG = logging.getLogger(__name__) diff --git a/requirements-py3.txt b/requirements-py3.txt index 797c05d..af65f46 100644 --- a/requirements-py3.txt +++ b/requirements-py3.txt @@ -3,6 +3,7 @@ Babel>=0.9.6 iso8601>=0.1.9 fixtures>=0.3.14 oslo.config>=1.4.0.0a3 +oslo.i18n>=0.1.0 oslo.utils>=0.2.0 posix_ipc six>=1.7.0 diff --git a/requirements.txt b/requirements.txt index 65ec2c5..a3dfbfb 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,6 +4,7 @@ eventlet>=0.13.0 greenlet>=0.3.2 fixtures>=0.3.14 oslo.config>=1.4.0.0a3 +oslo.i18n>=0.2.0 oslo.utils>=0.2.0 posix_ipc six>=1.7.0