Browse Source

Initial i18n commit for endpoints. All endpoints must install

gettext, which injects the _ function into the builtins.
changes/30/930/1
jaypipes@gmail.com 10 years ago
parent
commit
a6645d8a43
5 changed files with 17 additions and 0 deletions
  1. +3
    -0
      bin/nova-api
  2. +3
    -0
      bin/nova-compute
  3. +3
    -0
      bin/nova-dhcpbridge
  4. +5
    -0
      nova/tests/__init__.py
  5. +3
    -0
      run_tests.py

+ 3
- 0
bin/nova-api View File

@ -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


+ 3
- 0
bin/nova-compute View File

@ -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


+ 3
- 0
bin/nova-dhcpbridge View File

@ -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


+ 5
- 0
nova/tests/__init__.py View File

@ -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)

+ 3
- 0
run_tests.py View File

@ -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


Loading…
Cancel
Save