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: I3d4ced32372ceb195a056f65c90eb041f41c7f69
This commit is contained in:
Dmitry Tantsur
2020-04-06 13:59:52 +02:00
parent 726c3bd771
commit 570ab42404
3 changed files with 16 additions and 7 deletions

View File

@@ -13,10 +13,14 @@
# License for the specific language governing permissions and limitations
# under the License.
import oslo_i18n
try:
import oslo_i18n
except ImportError:
def _(msg):
return msg
else:
_translators = oslo_i18n.TranslatorFactory(
domain='python-ironic-inspector-client')
_translators = oslo_i18n.TranslatorFactory(
domain='python-ironic-inspector-client')
# The primary translation function using the well-known name "_"
_ = _translators.primary
# The primary translation function using the well-known name "_"
_ = _translators.primary

View File

@@ -0,0 +1,6 @@
---
upgrade:
- |
The dependency on ``oslo.i18n`` is now optional. If you would like messages
from ironic-inspector-client to be translated, you need to install it
explicitly.

View File

@@ -3,7 +3,6 @@
# process, which may cause wedges in the gate later.
keystoneauth1>=3.4.0 # Apache-2.0
osc-lib>=1.8.0 # Apache-2.0
oslo.i18n>=3.15.3 # Apache-2.0
oslo.utils>=3.33.0 # Apache-2.0
pbr!=2.1.0,>=2.0.0 # Apache-2.0
PyYAML>=3.12 # MIT