From 66cbfc813ac5caa29b35b659e54935917471f00c Mon Sep 17 00:00:00 2001 From: Frank Wang Date: Thu, 10 Oct 2019 18:53:56 +0800 Subject: [PATCH] install neutron_lib international messages neutron-lib needs to load internationalized file at initialization, otherwise, international logging message will not work. refer to [1] zh_CN neutron_lib.po has been completed. [1] https://review.opendev.org/#/c/536011/ Change-Id: I76ab222da64589528defe434589b92a033ef8cdf Closes-Bug: #1847586 --- neutron_lib/__init__.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/neutron_lib/__init__.py b/neutron_lib/__init__.py index 1f79bbc32..71c0e69eb 100644 --- a/neutron_lib/__init__.py +++ b/neutron_lib/__init__.py @@ -10,10 +10,21 @@ # License for the specific language governing permissions and limitations # under the License. +import gettext + import pbr.version +import six from neutron_lib.db import api # noqa + +if six.PY2: + # pylint: disable=unexpected-keyword-arg + gettext.install('neutron_lib', unicode=1) +else: + gettext.install('neutron_lib') + + # NOTE(boden): neutron_lib.db.api is imported to ensure the ORM event listeners # are registered upon importing any neutron-lib module. For more details see # defect https://bugs.launchpad.net/networking-ovn/+bug/1802369