diff options
| author | Jenkins <jenkins@review.openstack.org> | 2013-02-05 11:50:06 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2013-02-05 11:50:06 +0000 |
| commit | aa41734347284a2430dc6f32ce4af23ba84d271d (patch) | |
| tree | 7180e8c1e0749eedca7aa237690e9478539dbefd | |
| parent | fe4b3498b9cb76c2f6255ce52ebe9b657f5cefda (diff) | |
| parent | 6cc6875b383b7f94e0f2cd6ebafeac3159a112d4 (diff) | |
| download | python-neutronclient-aa41734347284a2430dc6f32ce4af23ba84d271d.tar.gz | |
Merge "Remove gettext.install from quantumclient.__init__"
| -rw-r--r-- | quantumclient/__init__.py | 6 | ||||
| -rw-r--r-- | quantumclient/common/__init__.py | 8 | ||||
| -rw-r--r-- | quantumclient/common/exceptions.py | 2 | ||||
| -rw-r--r-- | quantumclient/shell.py | 2 | ||||
| -rw-r--r-- | quantumclient/tests/unit/__init__.py | 22 | ||||
| -rw-r--r-- | quantumclient/v2_0/client.py | 1 |
6 files changed, 34 insertions, 7 deletions
diff --git a/quantumclient/__init__.py b/quantumclient/__init__.py index 5558fdb..034d66e 100644 --- a/quantumclient/__init__.py +++ b/quantumclient/__init__.py @@ -15,9 +15,3 @@ # License for the specific language governing permissions and limitations # under the License. # @author: Tyler Smith, Cisco Systems - -import gettext - - -# gettext must be initialized before any quantumclient imports -gettext.install('quantumclient', unicode=1) diff --git a/quantumclient/common/__init__.py b/quantumclient/common/__init__.py index 7e695ff..1415c50 100644 --- a/quantumclient/common/__init__.py +++ b/quantumclient/common/__init__.py @@ -14,3 +14,11 @@ # License for the specific language governing permissions and limitations # under the License. # @author: Somik Behera, Nicira Networks, Inc. + +import gettext + +t = gettext.translation('quantumclient', fallback=True) + + +def _(msg): + return t.ugettext(msg) diff --git a/quantumclient/common/exceptions.py b/quantumclient/common/exceptions.py index 734a498..22ac67a 100644 --- a/quantumclient/common/exceptions.py +++ b/quantumclient/common/exceptions.py @@ -15,6 +15,8 @@ # License for the specific language governing permissions and limitations # under the License. +from quantumclient.common import _ + """ Quantum base exception handling. """ diff --git a/quantumclient/shell.py b/quantumclient/shell.py index 3b8ae5c..21f64cf 100644 --- a/quantumclient/shell.py +++ b/quantumclient/shell.py @@ -33,7 +33,6 @@ from quantumclient.common import exceptions as exc from quantumclient.common import utils -gettext.install('quantum', unicode=1) VERSION = '2.0' QUANTUM_API_VERSION = '2.0' @@ -564,6 +563,7 @@ class QuantumShell(App): def main(argv=sys.argv[1:]): + gettext.install('quantumclient', unicode=1) try: return QuantumShell(QUANTUM_API_VERSION).run(argv) except exc.QuantumClientException: diff --git a/quantumclient/tests/unit/__init__.py b/quantumclient/tests/unit/__init__.py index e69de29..353303f 100644 --- a/quantumclient/tests/unit/__init__.py +++ b/quantumclient/tests/unit/__init__.py @@ -0,0 +1,22 @@ +# Copyright 2013 OpenStack LLC. +# 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. +# +# vim: tabstop=4 shiftwidth=4 softtabstop=4 + +import gettext + +# Because we installed '_' for quantum cli in shell.py, this help unittest +# have definition of '_' +gettext.install('quantumclient', unicode=1) diff --git a/quantumclient/v2_0/client.py b/quantumclient/v2_0/client.py index 305ea1e..9c045fc 100644 --- a/quantumclient/v2_0/client.py +++ b/quantumclient/v2_0/client.py @@ -21,6 +21,7 @@ import time import urllib from quantumclient.client import HTTPClient +from quantumclient.common import _ from quantumclient.common import exceptions from quantumclient.common.serializer import Serializer |
