Make oslo.i18n an optional dependency
In an ideal world we would have all messages translated to at least major languages. In reality, ironic has never boasted a great set of translation, and according to Zanata only 2.94% of messages are translated for ironic in Train (1.33% for ironic-inspector). Given that ironic-python-agent is not translated at all, using i18n by default seems an overkill. Change-Id: I12287c6b7208af487cc9eee825ae7f38ec707d91
This commit is contained in:
parent
9f93694b9a
commit
1d9c8283b8
@ -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/
|
||||
|
||||
"""
|
||||
|
||||
try:
|
||||
import oslo_i18n as i18n
|
||||
except ImportError:
|
||||
def _(msg):
|
||||
return msg
|
||||
|
||||
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
|
||||
|
||||
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