summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2020-04-06 15:31:16 +0000
committerGerrit Code Review <review@openstack.org>2020-04-06 15:31:16 +0000
commit54bd3682268955d92ddfff4b57c9f15f980dfe9b (patch)
tree4b9710fd551b7dde9dc956e49e343bf389486953
parent552ab25d19abb4db424afa0a868bd526cdca2275 (diff)
parent306fbe8e35c8aa9771a4ed1493bf0791d609f967 (diff)
downloadpython-ironicclient-54bd3682268955d92ddfff4b57c9f15f980dfe9b.tar.gz
Merge "Make oslo.i18n an optional dependency"
-rw-r--r--ironicclient/common/i18n.py14
-rw-r--r--releasenotes/notes/oslo-i18n-optional-ff28821441a0807c.yaml5
-rw-r--r--requirements.txt1
3 files changed, 14 insertions, 6 deletions
diff --git a/ironicclient/common/i18n.py b/ironicclient/common/i18n.py
index 90f289a..2561853 100644
--- a/ironicclient/common/i18n.py
+++ b/ironicclient/common/i18n.py
@@ -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
diff --git a/releasenotes/notes/oslo-i18n-optional-ff28821441a0807c.yaml b/releasenotes/notes/oslo-i18n-optional-ff28821441a0807c.yaml
new file mode 100644
index 0000000..68eee87
--- /dev/null
+++ b/releasenotes/notes/oslo-i18n-optional-ff28821441a0807c.yaml
@@ -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.
diff --git a/requirements.txt b/requirements.txt
index 412c047..b53d8cd 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -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