config/sysinv/sysinv/sysinv/sysinv/_i18n.py
Al Bailey 963157eb8f Deprecate sysinv.openstack.common.gettextutils
The gettextutils code dates back to when openstack projects
maintained common code and was later replaced by oslo_utils.

The new convention is to create a new _i18n.py file at the base
level and import it.

See: https://docs.openstack.org/oslo.i18n/latest

Most of the changes in this review are:

Old Code:
  from sysinv.openstack.common.gettextutils import _

New Code:
  from sysinv._i18n import _

This explicitly adds oslo_i18n to requirements.txt

Change-Id: I606ef9fef1e0431340669e9a2f153a038e72b88a
Story: 2006796
Task: 37340
Signed-off-by: Al Bailey <Al.Bailey@windriver.com>
2019-11-04 10:04:20 -06:00

33 lines
708 B
Python

#
# Copyright (c) 2018-2019 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
"""oslo.i18n integration module.
See https://docs.openstack.org/oslo.i18n/latest/user/usage.html
"""
import oslo_i18n
DOMAIN = 'sysinv'
_translators = oslo_i18n.TranslatorFactory(domain=DOMAIN)
# The primary translation function using the well-known name "_"
_ = _translators.primary
# The contextual translation function using the name "_C"
# requires oslo.i18n >=2.1.0
_C = _translators.contextual_form
# The plural translation function using the name "_P"
# requires oslo.i18n >=2.1.0
_P = _translators.plural_form
def get_available_languages():
return oslo_i18n.get_available_languages(DOMAIN)