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: I30d0f5ae6c7428ebbf018e14a3b78c430681c6a6
This commit is contained in:
Dmitry Tantsur 2020-04-06 13:55:29 +02:00
parent 9be0a750a9
commit 306fbe8e35
3 changed files with 14 additions and 6 deletions

View File

@ -13,9 +13,13 @@
# 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='ironicclient')
_translators = oslo_i18n.TranslatorFactory(domain='ironicclient')
# 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,5 @@
---
upgrade:
- |
The dependency on ``oslo.i18n`` is now optional. If you would like messages
from ironicclient to be translated, you need to install it explicitly.

View File

@ -8,7 +8,6 @@ jsonschema>=2.6.0 # MIT
keystoneauth1>=3.4.0 # Apache-2.0
osc-lib>=1.10.0 # Apache-2.0
oslo.config>=5.2.0 # Apache-2.0
oslo.i18n>=3.15.3 # Apache-2.0
oslo.serialization!=2.19.1,>=2.18.0 # Apache-2.0
oslo.utils>=3.33.0 # Apache-2.0
PyYAML>=3.12 # MIT