Browse Source

Initial i18n commit for endpoints. All endpoints must install

gettext, which injects the _ function into the builtins.
tags/2011.1rc1
jaypipes@gmail.com 8 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 @@
21 21
 Nova API daemon.
22 22
 """
23 23
 
24
+import gettext
24 25
 import os
25 26
 import sys
26 27
 
@@ -32,6 +33,8 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
32 33
 if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')):
33 34
     sys.path.insert(0, possible_topdir)
34 35
 
36
+gettext.install('nova', unicode=1)
37
+
35 38
 from nova import flags
36 39
 from nova import utils
37 40
 from nova import server

+ 3
- 0
bin/nova-compute View File

@@ -21,6 +21,7 @@
21 21
   Twistd daemon for the nova compute nodes.
22 22
 """
23 23
 
24
+import gettext
24 25
 import os
25 26
 import sys
26 27
 
@@ -32,6 +33,8 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
32 33
 if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')):
33 34
     sys.path.insert(0, possible_topdir)
34 35
 
36
+gettext.install('nova', unicode=1)
37
+
35 38
 from nova import service
36 39
 from nova import twistd
37 40
 from nova import utils

+ 3
- 0
bin/nova-dhcpbridge View File

@@ -21,6 +21,7 @@
21 21
 Handle lease database updates from DHCP servers.
22 22
 """
23 23
 
24
+import gettext
24 25
 import logging
25 26
 import os
26 27
 import sys
@@ -33,6 +34,8 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
33 34
 if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')):
34 35
     sys.path.insert(0, possible_topdir)
35 36
 
37
+gettext.install('nova', unicode=1)
38
+
36 39
 from nova import context
37 40
 from nova import db
38 41
 from nova import flags

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

@@ -29,3 +29,8 @@
29 29
 .. moduleauthor:: Manish Singh <yosh@gimp.org>
30 30
 .. moduleauthor:: Andy Smith <andy@anarkystic.com>
31 31
 """
32
+
33
+# See http://code.google.com/p/python-nose/issues/detail?id=373
34
+# The code below enables nosetests to work with i18n _() blocks
35
+import __builtin__
36
+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
40 40
 """
41 41
 
42 42
 import __main__
43
+import gettext
43 44
 import os
44 45
 import sys
45 46
 
47
+gettext.install('nova', unicode=1)
48
+
46 49
 from twisted.scripts import trial as trial_script
47 50
 
48 51
 from nova import flags

Loading…
Cancel
Save