From 590b109888d10939552e6e34a18f446dde9cb7ce Mon Sep 17 00:00:00 2001 From: YuikoTakada Date: Mon, 16 Feb 2015 02:32:10 +0000 Subject: [PATCH] Support i18n Currently, log format is not following to oslo.i18n. This patch set makes ironic-discoverd possible to use oslo.i18n. Change-Id: I623281239cb12abffbeb377ec6f77f8aa9b90c0c Partial-Bug: #1411272 --- ironic_discoverd/common/__init__.py | 0 ironic_discoverd/common/i18n.py | 31 +++++++++++++++++++++++++++++ requirements.txt | 1 + setup.py | 2 +- 4 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 ironic_discoverd/common/__init__.py create mode 100644 ironic_discoverd/common/i18n.py diff --git a/ironic_discoverd/common/__init__.py b/ironic_discoverd/common/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/ironic_discoverd/common/i18n.py b/ironic_discoverd/common/i18n.py new file mode 100644 index 000000000..6c6c923f2 --- /dev/null +++ b/ironic_discoverd/common/i18n.py @@ -0,0 +1,31 @@ +# Copyright 2015 NEC Corporation +# All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from oslo import oslo_i18n + +_translators = oslo_i18n.TranslatorFactory(domain='ironic-discoverd') + +# The primary translation function using the well-known name "_" +_ = _translators.primary + +# Translators for log levels. +# +# The abbreviated names are meant to reflect the usual use of a short +# name like '_'. The "L" is for "log" and the other letter comes from +# the level. +_LI = _translators.log_info +_LW = _translators.log_warning +_LE = _translators.log_error +_LC = _translators.log_critical diff --git a/requirements.txt b/requirements.txt index d7a4fb0b6..3f1dc1727 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,5 +3,6 @@ Flask>=0.10,<1.0 python-ironicclient>=0.2.1 python-keystoneclient>=1.0.0 requests>=2.2.0,!=2.4.0 +oslo.i18n>=1.3.0 # Apache-2.0 six>=1.7.0 stevedore>=1.1.0 diff --git a/setup.py b/setup.py index 47965e17d..35f19df8e 100644 --- a/setup.py +++ b/setup.py @@ -20,7 +20,7 @@ setup( author_email = "dtantsur@redhat.com", url = "https://pypi.python.org/pypi/ironic-discoverd", packages = ['ironic_discoverd', 'ironic_discoverd.plugins', - 'ironic_discoverd.test'], + 'ironic_discoverd.test', 'ironic_discoverd.common'], install_requires = install_requires, entry_points = { 'console_scripts': [