Update i18n handling to be placement oriented.
The translation domain is set to 'placement' and log translation is removed. Imports are adjusts to reflect the new location. placement/utils.py to only import _, and none of the log translation methods. These are only used in code that will be removed further along in this sequence of changes. Change-Id: Icf9bae4e2f0650b5eb4697afdc287de10153ce24
This commit is contained in:
parent
eaeeea1cfe
commit
53bc5a75b1
@ -67,7 +67,7 @@ import nova.conf
|
||||
import nova.context
|
||||
from placement.db.sqlalchemy import models
|
||||
from placement import exception
|
||||
from nova.i18n import _
|
||||
from placement.i18n import _
|
||||
from placement import safe_utils
|
||||
|
||||
profiler_sqlalchemy = importutils.try_import('osprofiler.sqlalchemy')
|
||||
|
@ -14,7 +14,7 @@ from oslo_log import log as logging
|
||||
from sqlalchemy import MetaData, Table, func, select
|
||||
|
||||
from placement import exception
|
||||
from nova.i18n import _
|
||||
from placement.i18n import _
|
||||
from placement import objects
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
@ -27,7 +27,7 @@ from sqlalchemy.sql import null
|
||||
from placement import db_api as placement_db
|
||||
from placement.db.sqlalchemy import api as db_session
|
||||
from placement import exception
|
||||
from nova.i18n import _
|
||||
from placement.i18n import _
|
||||
|
||||
INIT_VERSION = {}
|
||||
INIT_VERSION['main'] = 215
|
||||
|
@ -23,7 +23,7 @@ from sqlalchemy.types import NullType
|
||||
|
||||
from placement.db.sqlalchemy import api as db
|
||||
from placement import exception
|
||||
from nova.i18n import _
|
||||
from placement.i18n import _
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
from oslo_log import log as logging
|
||||
|
||||
from nova.i18n import _
|
||||
from placement.i18n import _
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
@ -40,7 +40,7 @@ from placement.handlers import root
|
||||
from placement.handlers import trait
|
||||
from placement.handlers import usage
|
||||
from placement import util
|
||||
from nova.i18n import _
|
||||
from placement.i18n import _
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
@ -25,7 +25,7 @@ from placement.policies import aggregate as policies
|
||||
from placement.schemas import aggregate as schema
|
||||
from placement import util
|
||||
from placement import wsgi_wrapper
|
||||
from nova.i18n import _
|
||||
from placement.i18n import _
|
||||
|
||||
|
||||
_INCLUDE_GENERATION_VERSION = (1, 19)
|
||||
|
@ -30,7 +30,7 @@ from placement.policies import allocation as policies
|
||||
from placement.schemas import allocation as schema
|
||||
from placement import util
|
||||
from placement import wsgi_wrapper
|
||||
from nova.i18n import _
|
||||
from placement.i18n import _
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
@ -28,7 +28,7 @@ from placement.policies import allocation_candidate as \
|
||||
from placement.schemas import allocation_candidate as schema
|
||||
from placement import util
|
||||
from placement import wsgi_wrapper
|
||||
from nova.i18n import _
|
||||
from placement.i18n import _
|
||||
|
||||
|
||||
def _transform_allocation_requests_dict(alloc_reqs):
|
||||
|
@ -28,7 +28,7 @@ from placement.schemas import inventory as schema
|
||||
from placement import util
|
||||
from placement import wsgi_wrapper
|
||||
from placement.db import constants as db_const
|
||||
from nova.i18n import _
|
||||
from placement.i18n import _
|
||||
|
||||
|
||||
# NOTE(cdent): We keep our own representation of inventory defaults
|
||||
|
@ -35,7 +35,7 @@ from placement.schemas import reshaper as schema
|
||||
from placement import util
|
||||
from placement import wsgi_wrapper
|
||||
# TODO(cdent): placement needs its own version of this
|
||||
from nova.i18n import _
|
||||
from placement.i18n import _
|
||||
|
||||
|
||||
@wsgi_wrapper.PlacementWsgify
|
||||
|
@ -23,7 +23,7 @@ from placement.policies import resource_class as policies
|
||||
from placement.schemas import resource_class as schema
|
||||
from placement import util
|
||||
from placement import wsgi_wrapper
|
||||
from nova.i18n import _
|
||||
from placement.i18n import _
|
||||
|
||||
|
||||
def _serialize_links(environ, rc):
|
||||
|
@ -28,7 +28,7 @@ from placement.policies import resource_provider as policies
|
||||
from placement.schemas import resource_provider as rp_schema
|
||||
from placement import util
|
||||
from placement import wsgi_wrapper
|
||||
from nova.i18n import _
|
||||
from placement.i18n import _
|
||||
|
||||
|
||||
def _serialize_links(environ, resource_provider):
|
||||
|
@ -25,7 +25,7 @@ from placement.policies import trait as policies
|
||||
from placement.schemas import trait as schema
|
||||
from placement import util
|
||||
from placement import wsgi_wrapper
|
||||
from nova.i18n import _
|
||||
from placement.i18n import _
|
||||
|
||||
|
||||
def _normalize_traits_qs_param(qs):
|
||||
|
@ -23,7 +23,7 @@ from placement.policies import usage as policies
|
||||
from placement.schemas import usage as schema
|
||||
from placement import util
|
||||
from placement import wsgi_wrapper
|
||||
from nova.i18n import _
|
||||
from placement.i18n import _
|
||||
|
||||
|
||||
def _serialize_usages(resource_provider, usage):
|
||||
|
@ -20,23 +20,13 @@ See https://docs.openstack.org/oslo.i18n/latest/user/index.html .
|
||||
|
||||
import oslo_i18n
|
||||
|
||||
DOMAIN = 'nova'
|
||||
DOMAIN = 'placement'
|
||||
|
||||
_translators = oslo_i18n.TranslatorFactory(domain=DOMAIN)
|
||||
|
||||
# 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
|
||||
|
||||
|
||||
def translate(value, user_locale):
|
||||
return oslo_i18n.translate(value, user_locale)
|
||||
|
@ -44,7 +44,7 @@ from placement.objects import project as project_obj
|
||||
from placement.objects import user as user_obj
|
||||
from placement import resource_class_cache as rc_cache
|
||||
from placement.db.sqlalchemy import api_models as models
|
||||
from nova.i18n import _
|
||||
from placement.i18n import _
|
||||
from placement import rc_fields
|
||||
|
||||
_TRAIT_TBL = models.Trait.__table__
|
||||
|
@ -32,7 +32,7 @@ import placement.microversion
|
||||
from placement.objects import consumer as consumer_obj
|
||||
from placement.objects import project as project_obj
|
||||
from placement.objects import user as user_obj
|
||||
from nova.i18n import _
|
||||
from placement.i18n import _
|
||||
|
||||
CONF = cfg.CONF
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
@ -53,7 +53,7 @@ from six.moves import reload_module
|
||||
import nova.conf
|
||||
from placement import debugger
|
||||
from placement import exception
|
||||
from nova.i18n import _, _LE, _LI, _LW
|
||||
from placement.i18n import _
|
||||
import nova.network
|
||||
from placement import safe_utils
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user