Switch to oslo.i18n in our code

Note that gettextutils are still indirectly used by fileutils (through log).

Change-Id: I4ea4830ed149aff87146a4b7392d7e48c6a7c793
This commit is contained in:
Yuriy Taraday 2014-08-20 14:39:23 +04:00
parent 9159a168fb
commit 8a2ba06743
6 changed files with 36 additions and 3 deletions

View File

@ -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

32
oslo/concurrency/_i18n.py Normal file
View File

@ -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

View File

@ -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__)

View File

@ -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__)

View File

@ -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

View File

@ -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