Merge "Make oslo.i18n an optional dependency"
This commit is contained in:
commit
c9d3ef2c21
@ -14,10 +14,10 @@
|
||||
import sys
|
||||
|
||||
from oslo_config import cfg
|
||||
import oslo_i18n as i18n
|
||||
from oslo_log import log
|
||||
|
||||
from ironic.api import app
|
||||
from ironic.common import i18n
|
||||
from ironic.common import service
|
||||
|
||||
|
||||
|
@ -25,6 +25,6 @@ import eventlet
|
||||
|
||||
eventlet.monkey_patch(os=False)
|
||||
|
||||
import oslo_i18n as i18n # noqa for I202 due to 'import eventlet' above
|
||||
from ironic.common import i18n # noqa for I202 due to 'import eventlet' above
|
||||
|
||||
i18n.install('ironic')
|
||||
|
@ -19,9 +19,20 @@ See https://docs.openstack.org/oslo.i18n/latest/user/
|
||||
|
||||
"""
|
||||
|
||||
import oslo_i18n as i18n
|
||||
try:
|
||||
import oslo_i18n as i18n
|
||||
except ImportError:
|
||||
def _(msg):
|
||||
return msg
|
||||
|
||||
_translators = i18n.TranslatorFactory(domain='ironic')
|
||||
def install(domain):
|
||||
# NOTE(dtantsur): this is called before logging is initialized, so we
|
||||
# cannot really log a warning here.
|
||||
pass
|
||||
else:
|
||||
_translators = i18n.TranslatorFactory(domain='ironic')
|
||||
|
||||
# The primary translation function using the well-known name "_"
|
||||
_ = _translators.primary
|
||||
# The primary translation function using the well-known name "_"
|
||||
_ = _translators.primary
|
||||
|
||||
install = i18n.install
|
||||
|
@ -0,0 +1,5 @@
|
||||
---
|
||||
upgrade:
|
||||
- |
|
||||
The dependency on ``oslo.i18n`` is now optional. If you would like messages
|
||||
from ironic to be translated, you need to install it explicitly.
|
@ -21,7 +21,6 @@ oslo.config>=5.2.0 # Apache-2.0
|
||||
oslo.context>=2.19.2 # Apache-2.0
|
||||
oslo.db>=4.40.0 # Apache-2.0
|
||||
oslo.rootwrap>=5.8.0 # Apache-2.0
|
||||
oslo.i18n>=3.15.3 # Apache-2.0
|
||||
oslo.log>=3.36.0 # Apache-2.0
|
||||
oslo.middleware>=3.31.0 # Apache-2.0
|
||||
oslo.policy>=1.30.0 # Apache-2.0
|
||||
|
Loading…
Reference in New Issue
Block a user