diff options
author | jaypipes@gmail.com <> | 2010-12-11 15:10:24 -0500 |
---|---|---|
committer | jaypipes@gmail.com <> | 2010-12-11 15:10:24 -0500 |
commit | a6645d8a431ed933eef4ea6c42c0224ead6f2272 (patch) | |
tree | b3229bad833591b2fbea5157cae9d96976c2d62b | |
parent | 1a759c3722610d720dd8dabf816db146c1063937 (diff) | |
download | nova-a6645d8a431ed933eef4ea6c42c0224ead6f2272.tar.gz nova-a6645d8a431ed933eef4ea6c42c0224ead6f2272.tar.xz nova-a6645d8a431ed933eef4ea6c42c0224ead6f2272.zip |
Initial i18n commit for endpoints. All endpoints must install
gettext, which injects the _ function into the builtins.
-rwxr-xr-x | bin/nova-api | 3 | ||||
-rwxr-xr-x | bin/nova-compute | 3 | ||||
-rwxr-xr-x | bin/nova-dhcpbridge | 3 | ||||
-rw-r--r-- | nova/tests/__init__.py | 5 | ||||
-rw-r--r-- | run_tests.py | 3 |
5 files changed, 17 insertions, 0 deletions
diff --git a/bin/nova-api b/bin/nova-api index a9c53dbcd..2ae6a099a 100755 --- a/bin/nova-api +++ b/bin/nova-api @@ -21,6 +21,7 @@ Nova API daemon. """ +import gettext import os import sys @@ -32,6 +33,8 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')): sys.path.insert(0, possible_topdir) +gettext.install('nova', unicode=1) + from nova import flags from nova import utils from nova import server diff --git a/bin/nova-compute b/bin/nova-compute index ac6378f75..f57b68584 100755 --- a/bin/nova-compute +++ b/bin/nova-compute @@ -21,6 +21,7 @@ Twistd daemon for the nova compute nodes. """ +import gettext import os import sys @@ -32,6 +33,8 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')): sys.path.insert(0, possible_topdir) +gettext.install('nova', unicode=1) + from nova import service from nova import twistd from nova import utils diff --git a/bin/nova-dhcpbridge b/bin/nova-dhcpbridge index 17c62da0a..81b9b6dd3 100755 --- a/bin/nova-dhcpbridge +++ b/bin/nova-dhcpbridge @@ -21,6 +21,7 @@ Handle lease database updates from DHCP servers. """ +import gettext import logging import os import sys @@ -33,6 +34,8 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')): sys.path.insert(0, possible_topdir) +gettext.install('nova', unicode=1) + from nova import context from nova import db from nova import flags diff --git a/nova/tests/__init__.py b/nova/tests/__init__.py index aaf213923..8dc87d0e2 100644 --- a/nova/tests/__init__.py +++ b/nova/tests/__init__.py @@ -29,3 +29,8 @@ .. moduleauthor:: Manish Singh <yosh@gimp.org> .. moduleauthor:: Andy Smith <andy@anarkystic.com> """ + +# See http://code.google.com/p/python-nose/issues/detail?id=373 +# The code below enables nosetests to work with i18n _() blocks +import __builtin__ +setattr(__builtin__, '_', lambda x: x) diff --git a/run_tests.py b/run_tests.py index 3d427d8af..37a548e4c 100644 --- a/run_tests.py +++ b/run_tests.py @@ -40,9 +40,12 @@ Due to our use of multiprocessing it we frequently get some ignorable """ import __main__ +import gettext import os import sys +gettext.install('nova', unicode=1) + from twisted.scripts import trial as trial_script from nova import flags |