diff options
| author | Mark McLoughlin <markmc@redhat.com> | 2013-04-01 02:15:32 +0100 |
|---|---|---|
| committer | Mark McLoughlin <markmc@redhat.com> | 2013-04-10 10:24:27 +0100 |
| commit | 5e7ef210c01d3db8c79b969da3aeda50d57c4923 (patch) | |
| tree | 80de4494fdae7b3c7374238ef9c07266324c1c03 /doc | |
| parent | 05f5106c198a596f22adadab1ddf6929ab9c247a (diff) | |
| download | nova-5e7ef210c01d3db8c79b969da3aeda50d57c4923.tar.gz nova-5e7ef210c01d3db8c79b969da3aeda50d57c4923.tar.xz nova-5e7ef210c01d3db8c79b969da3aeda50d57c4923.zip | |
Add NOVA_LOCALEDIR env variable
Part of fixing bug #995287
Syncs these two commits from oslo-incubator:
Support overriding oslo localedir too
Add a gettextutils.install() helper function
to get a new gettextutils.install() function which allows the default
localedir to be overwritten via an environment variable.
Note that gettextutils.install() must be called before any other nova
modules are imported since some modules attempt to translate strings
at import time (e.g. the 'message' attributes on classes in
nova.exception). This is broken and inefficient, but fixing it involves
adding something like spinx's l_() function and would be very invaisve.
Also, note that calling gettextutils.install() in nova.cmd.__init__
means that no program which uses a different translation domain should
ever import any of the modules under nova.cmd.
Change-Id: I86562b3a65d371673bb21f7179eecc7602bc0775
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/source/devref/il8n.rst | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/doc/source/devref/il8n.rst b/doc/source/devref/il8n.rst index ce708449d..900ea8a28 100644 --- a/doc/source/devref/il8n.rst +++ b/doc/source/devref/il8n.rst @@ -24,10 +24,14 @@ in nova/tests/test_localization.py. The ``_()`` function is brought into the global scope by doing:: - import gettext - gettext.install("nova", unicode=1) + from nova.openstack.common import gettextutils + gettextutils.install('nova') These lines are needed in any toplevel script before any nova modules are imported. If this code is missing, it may result in an error that looks like:: NameError: name '_' is not defined + +The gettextutils.install() function also queries the NOVA_LOCALEDIR environment +variable to allow overriding the default localedir with a specific custom +location for Nova's message catalog. |
