From 1f333e1aea4f4f3e606a5c10a740a9c5acbdcd04 Mon Sep 17 00:00:00 2001 From: Ben Nemec Date: Wed, 12 Sep 2018 22:28:44 +0000 Subject: [PATCH] Add i18n support There are translatable strings in this library and we need to support that properly. Replace the stub _() with a proper implementation based on oslo.i18n. --- oslo_upgradecheck/upgradecheck.py | 4 +--- requirements.txt | 1 + tox.ini | 3 +++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/oslo_upgradecheck/upgradecheck.py b/oslo_upgradecheck/upgradecheck.py index 416d191..857800d 100644 --- a/oslo_upgradecheck/upgradecheck.py +++ b/oslo_upgradecheck/upgradecheck.py @@ -21,9 +21,7 @@ import enum from oslo_config import cfg import prettytable - -def _(s): - return s +from oslo_upgradecheck._i18n import _ class UpgradeCheckCode(enum.IntEnum): diff --git a/requirements.txt b/requirements.txt index 016756a..1aaf083 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,5 +4,6 @@ Babel>=1.3 oslo.config +oslo.i18n enum34 prettytable diff --git a/tox.ini b/tox.ini index 500b7da..17f7932 100644 --- a/tox.ini +++ b/tox.ini @@ -58,3 +58,6 @@ show-source = True ignore = E123,E125 builtins = _ exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build + +[hacking] +import_exception = oslo_upgradecheck._i18n