diff --git a/requirements.txt b/requirements.txt index 8809ec1ca..7eb973696 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,7 +8,7 @@ PasteDeploy==1.5.2 oslo.messaging==1.16.0 oslo.db==2.1.0 oslo.log>=1.8.0 # Apache-2.0 -oslo.i18n==2.1.0 +oslo.i18n>=1.5.0 # Apache-2.0 oslo.utils==1.8.0 # Apache-2.0 pecan>=0.8 keystonemiddleware>=1.0.0 diff --git a/watcher/cmd/applier.py b/watcher/cmd/applier.py index a69f40fb4..ad5eca0b1 100644 --- a/watcher/cmd/applier.py +++ b/watcher/cmd/applier.py @@ -25,11 +25,11 @@ from oslo_config import cfg from oslo_log import log as logging from watcher.applier.framework.manager_applier import ApplierManager - -from watcher.openstack.common._i18n import _LI +from watcher import i18n LOG = logging.getLogger(__name__) CONF = cfg.CONF +_LI = i18n._LI def main(): diff --git a/watcher/cmd/decisionengine.py b/watcher/cmd/decisionengine.py index 16e6024f7..17b2b9d9f 100644 --- a/watcher/cmd/decisionengine.py +++ b/watcher/cmd/decisionengine.py @@ -26,7 +26,8 @@ from oslo_log import log as logging from watcher.decision_engine.framework.manager_decision_engine import \ DecisionEngineManager -from watcher.openstack.common._i18n import _LI +from watcher import i18n + cfg.CONF.import_opt('hostname', 'watcher.metrics_engine.framework.' 'datasources.influxdb_collector', @@ -34,6 +35,7 @@ cfg.CONF.import_opt('hostname', LOG = logging.getLogger(__name__) CONF = cfg.CONF +_LI = i18n._LI def main(): diff --git a/watcher/db/sqlalchemy/api.py b/watcher/db/sqlalchemy/api.py index d5d83b22f..7135fa312 100644 --- a/watcher/db/sqlalchemy/api.py +++ b/watcher/db/sqlalchemy/api.py @@ -29,13 +29,12 @@ from watcher.common import exception from watcher.common import utils from watcher.db import api from watcher.db.sqlalchemy import models +from watcher import i18n from watcher.objects.audit import AuditStatus -from watcher.openstack.common._i18n import _ CONF = cfg.CONF - LOG = log.getLogger(__name__) - +_ = i18n._ _FACADE = None diff --git a/watcher/i18n.py b/watcher/i18n.py new file mode 100644 index 000000000..2646f4c02 --- /dev/null +++ b/watcher/i18n.py @@ -0,0 +1,31 @@ +# Copyright 2014 Huawei Crop. +# 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_i18n import * # noqa + +_translators = TranslatorFactory(domain='glance') + +# 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