Skip to content

Commit

Permalink
Use oslo.i18n
Browse files Browse the repository at this point in the history
oslo.i18n provides the i18n functions that were provided by
oslo-incubator's gettextutils module. Some tests that were
using internal details of the library were removed.

Change-Id: I44cfd5552e0dd86af21073419d31622f5fdb28e0
  • Loading branch information
Davanum Srinivas committed Jul 18, 2014
1 parent ff756a0 commit 826aed0
Show file tree
Hide file tree
Showing 296 changed files with 411 additions and 366 deletions.
2 changes: 1 addition & 1 deletion doc/source/devref/il8n.rst
Expand Up @@ -21,4 +21,4 @@ in nova/tests/test_localization.py.

The ``_()`` function is found by doing::

from nova.openstack.common.gettextutils import _
from nova.i18n import _
2 changes: 1 addition & 1 deletion nova/api/auth.py
Expand Up @@ -21,7 +21,7 @@
import webob.exc

from nova import context
from nova.openstack.common.gettextutils import _
from nova.i18n import _
from nova.openstack.common import jsonutils
from nova.openstack.common import log as logging
from nova.openstack.common.middleware import request_id
Expand Down
4 changes: 2 additions & 2 deletions nova/api/ec2/__init__.py
Expand Up @@ -32,8 +32,8 @@
from nova.api import validator
from nova import context
from nova import exception
from nova.openstack.common.gettextutils import _
from nova.openstack.common.gettextutils import _LE
from nova.i18n import _
from nova.i18n import _LE
from nova.openstack.common import importutils
from nova.openstack.common import jsonutils
from nova.openstack.common import log as logging
Expand Down
2 changes: 1 addition & 1 deletion nova/api/ec2/cloud.py
Expand Up @@ -38,12 +38,12 @@
from nova.compute import vm_states
from nova import db
from nova import exception
from nova.i18n import _
from nova.image import s3
from nova import network
from nova.network.security_group import neutron_driver
from nova import objects
from nova.objects import base as obj_base
from nova.openstack.common.gettextutils import _
from nova.openstack.common import log as logging
from nova.openstack.common import timeutils
from nova import quota
Expand Down
2 changes: 1 addition & 1 deletion nova/api/ec2/ec2utils.py
Expand Up @@ -21,10 +21,10 @@
from nova import context
from nova import db
from nova import exception
from nova.i18n import _
from nova.network import model as network_model
from nova import objects
from nova.objects import base as obj_base
from nova.openstack.common.gettextutils import _
from nova.openstack.common import log as logging
from nova.openstack.common import memorycache
from nova.openstack.common import timeutils
Expand Down
2 changes: 1 addition & 1 deletion nova/api/metadata/handler.py
Expand Up @@ -27,7 +27,7 @@
from nova.api.metadata import base
from nova import conductor
from nova import exception
from nova.openstack.common.gettextutils import _
from nova.i18n import _
from nova.openstack.common import log as logging
from nova.openstack.common import memorycache
from nova import utils
Expand Down
2 changes: 1 addition & 1 deletion nova/api/metadata/password.py
Expand Up @@ -16,8 +16,8 @@
from webob import exc

from nova import context
from nova.i18n import _
from nova import objects
from nova.openstack.common.gettextutils import _
from nova import utils


Expand Down
2 changes: 1 addition & 1 deletion nova/api/metadata/vendordata_json.py
Expand Up @@ -20,7 +20,7 @@
from oslo.config import cfg

from nova.api.metadata import base
from nova.openstack.common.gettextutils import _
from nova.i18n import _
from nova.openstack.common import jsonutils
from nova.openstack.common import log as logging

Expand Down
12 changes: 4 additions & 8 deletions nova/api/openstack/__init__.py
Expand Up @@ -27,9 +27,9 @@
from nova.api.openstack import extensions
from nova.api.openstack import wsgi
from nova import exception
from nova.i18n import _
from nova.i18n import translate
from nova import notifications
from nova.openstack.common import gettextutils
from nova.openstack.common.gettextutils import _
from nova.openstack.common import log as logging
from nova import utils
from nova import wsgi as base_wsgi
Expand Down Expand Up @@ -107,12 +107,8 @@ def _error(self, inner, req):
# inconsistent with the EC2 API to hide every exception,
# including those that are safe to expose, see bug 1021373
if safe:
if isinstance(inner.msg_fmt, gettextutils.Message):
user_locale = req.best_match_language()
inner_msg = gettextutils.translate(
inner.msg_fmt, user_locale)
else:
inner_msg = unicode(inner)
user_locale = req.best_match_language()
inner_msg = translate(inner.message, user_locale)
outer.explanation = '%s: %s' % (inner.__class__.__name__,
inner_msg)

Expand Down
2 changes: 1 addition & 1 deletion nova/api/openstack/common.py
Expand Up @@ -29,7 +29,7 @@
from nova.compute import utils as compute_utils
from nova.compute import vm_states
from nova import exception
from nova.openstack.common.gettextutils import _
from nova.i18n import _
from nova.openstack.common import log as logging
from nova import quota

Expand Down
2 changes: 1 addition & 1 deletion nova/api/openstack/compute/contrib/admin_actions.py
Expand Up @@ -24,7 +24,7 @@
from nova import compute
from nova.compute import vm_states
from nova import exception
from nova.openstack.common.gettextutils import _
from nova.i18n import _
from nova.openstack.common import log as logging
from nova.openstack.common import strutils

Expand Down
2 changes: 1 addition & 1 deletion nova/api/openstack/compute/contrib/aggregates.py
Expand Up @@ -22,7 +22,7 @@
from nova.api.openstack import extensions
from nova.compute import api as compute_api
from nova import exception
from nova.openstack.common.gettextutils import _
from nova.i18n import _
from nova.openstack.common import log as logging
from nova import utils

Expand Down
Expand Up @@ -19,7 +19,7 @@
from nova.api.openstack import xmlutil
from nova import compute
from nova import exception
from nova.openstack.common.gettextutils import _
from nova.i18n import _
from nova.openstack.common import jsonutils
from nova.openstack.common import log as logging

Expand Down
2 changes: 1 addition & 1 deletion nova/api/openstack/compute/contrib/attach_interfaces.py
Expand Up @@ -21,8 +21,8 @@
from nova.api.openstack import extensions
from nova import compute
from nova import exception
from nova.i18n import _
from nova import network
from nova.openstack.common.gettextutils import _
from nova.openstack.common import log as logging


Expand Down
2 changes: 1 addition & 1 deletion nova/api/openstack/compute/contrib/baremetal_nodes.py
Expand Up @@ -22,7 +22,7 @@
from nova.api.openstack import wsgi
from nova.api.openstack import xmlutil
from nova import exception
from nova.openstack.common.gettextutils import _
from nova.i18n import _
from nova.virt.baremetal import db

authorize = extensions.extension_authorizer('compute', 'baremetal_nodes')
Expand Down
2 changes: 1 addition & 1 deletion nova/api/openstack/compute/contrib/cells.py
Expand Up @@ -28,7 +28,7 @@
from nova.cells import rpcapi as cells_rpcapi
from nova.compute import api as compute
from nova import exception
from nova.openstack.common.gettextutils import _
from nova.i18n import _
from nova.openstack.common import log as logging
from nova.openstack.common import strutils
from nova.openstack.common import timeutils
Expand Down
2 changes: 1 addition & 1 deletion nova/api/openstack/compute/contrib/certificates.py
Expand Up @@ -18,7 +18,7 @@
from nova.api.openstack import wsgi
from nova.api.openstack import xmlutil
import nova.cert.rpcapi
from nova.openstack.common.gettextutils import _
from nova.i18n import _

authorize = extensions.extension_authorizer('compute', 'certificates')

Expand Down
2 changes: 1 addition & 1 deletion nova/api/openstack/compute/contrib/cloudpipe.py
Expand Up @@ -25,9 +25,9 @@
from nova.compute import utils as compute_utils
from nova.compute import vm_states
from nova import exception
from nova.i18n import _
from nova import network
from nova.openstack.common import fileutils
from nova.openstack.common.gettextutils import _
from nova.openstack.common import timeutils
from nova import utils

Expand Down
2 changes: 1 addition & 1 deletion nova/api/openstack/compute/contrib/cloudpipe_update.py
Expand Up @@ -17,8 +17,8 @@

from nova.api.openstack import extensions
from nova.api.openstack import wsgi
from nova.i18n import _
from nova import objects
from nova.openstack.common.gettextutils import _

authorize = extensions.extension_authorizer('compute', 'cloudpipe_update')

Expand Down
2 changes: 1 addition & 1 deletion nova/api/openstack/compute/contrib/console_auth_tokens.py
Expand Up @@ -18,7 +18,7 @@
from nova.api.openstack import extensions
from nova.api.openstack import wsgi
from nova.consoleauth import rpcapi as consoleauth_rpcapi
from nova.openstack.common.gettextutils import _
from nova.i18n import _


authorize = extensions.extension_authorizer('compute', 'console_auth_tokens')
Expand Down
2 changes: 1 addition & 1 deletion nova/api/openstack/compute/contrib/console_output.py
Expand Up @@ -22,7 +22,7 @@
from nova.api.openstack import wsgi
from nova import compute
from nova import exception
from nova.openstack.common.gettextutils import _
from nova.i18n import _


authorize = extensions.extension_authorizer('compute', 'console_output')
Expand Down
2 changes: 1 addition & 1 deletion nova/api/openstack/compute/contrib/consoles.py
Expand Up @@ -18,7 +18,7 @@
from nova.api.openstack import wsgi
from nova import compute
from nova import exception
from nova.openstack.common.gettextutils import _
from nova.i18n import _


authorize = extensions.extension_authorizer('compute', 'consoles')
Expand Down
2 changes: 1 addition & 1 deletion nova/api/openstack/compute/contrib/disk_config.py
Expand Up @@ -19,7 +19,7 @@
from nova.api.openstack import extensions
from nova.api.openstack import wsgi
from nova.api.openstack import xmlutil
from nova.openstack.common.gettextutils import _
from nova.i18n import _
from nova.openstack.common import strutils

ALIAS = 'OS-DCF'
Expand Down
2 changes: 1 addition & 1 deletion nova/api/openstack/compute/contrib/evacuate.py
Expand Up @@ -20,7 +20,7 @@
from nova.api.openstack import wsgi
from nova import compute
from nova import exception
from nova.openstack.common.gettextutils import _
from nova.i18n import _
from nova.openstack.common import strutils
from nova import utils

Expand Down
2 changes: 1 addition & 1 deletion nova/api/openstack/compute/contrib/fixed_ips.py
Expand Up @@ -16,8 +16,8 @@

from nova.api.openstack import extensions
from nova import exception
from nova.i18n import _
from nova import objects
from nova.openstack.common.gettextutils import _

authorize = extensions.extension_authorizer('compute', 'fixed_ips')

Expand Down
2 changes: 1 addition & 1 deletion nova/api/openstack/compute/contrib/flavor_access.py
Expand Up @@ -21,8 +21,8 @@
from nova.api.openstack import wsgi
from nova.api.openstack import xmlutil
from nova import exception
from nova.i18n import _
from nova import objects
from nova.openstack.common.gettextutils import _


soft_authorize = extensions.soft_extension_authorizer('compute',
Expand Down
2 changes: 1 addition & 1 deletion nova/api/openstack/compute/contrib/flavorextraspecs.py
Expand Up @@ -22,8 +22,8 @@
from nova.api.openstack import xmlutil
from nova.compute import flavors
from nova import exception
from nova.i18n import _
from nova import objects
from nova.openstack.common.gettextutils import _
from nova import utils

authorize = extensions.extension_authorizer('compute', 'flavorextraspecs')
Expand Down
2 changes: 1 addition & 1 deletion nova/api/openstack/compute/contrib/flavormanage.py
Expand Up @@ -18,7 +18,7 @@
from nova.api.openstack import wsgi
from nova.compute import flavors
from nova import exception
from nova.openstack.common.gettextutils import _
from nova.i18n import _


authorize = extensions.extension_authorizer('compute', 'flavormanage')
Expand Down
2 changes: 1 addition & 1 deletion nova/api/openstack/compute/contrib/floating_ip_dns.py
Expand Up @@ -20,8 +20,8 @@
from nova.api.openstack import wsgi
from nova.api.openstack import xmlutil
from nova import exception
from nova.i18n import _
from nova import network
from nova.openstack.common.gettextutils import _
from nova import utils


Expand Down
2 changes: 1 addition & 1 deletion nova/api/openstack/compute/contrib/floating_ips.py
Expand Up @@ -24,8 +24,8 @@
from nova import compute
from nova.compute import utils as compute_utils
from nova import exception
from nova.i18n import _
from nova import network
from nova.openstack.common.gettextutils import _
from nova.openstack.common import log as logging
from nova.openstack.common import uuidutils

Expand Down
2 changes: 1 addition & 1 deletion nova/api/openstack/compute/contrib/floating_ips_bulk.py
Expand Up @@ -18,8 +18,8 @@

from nova.api.openstack import extensions
from nova import exception
from nova.i18n import _
from nova import objects
from nova.openstack.common.gettextutils import _
from nova.openstack.common import log as logging

CONF = cfg.CONF
Expand Down
2 changes: 1 addition & 1 deletion nova/api/openstack/compute/contrib/fping.py
Expand Up @@ -24,7 +24,7 @@
from nova.api.openstack import extensions
from nova import compute
from nova import exception
from nova.openstack.common.gettextutils import _
from nova.i18n import _
from nova import utils

authorize = extensions.extension_authorizer('compute', 'fping')
Expand Down
2 changes: 1 addition & 1 deletion nova/api/openstack/compute/contrib/hosts.py
Expand Up @@ -22,7 +22,7 @@
from nova.api.openstack import xmlutil
from nova import compute
from nova import exception
from nova.openstack.common.gettextutils import _
from nova.i18n import _
from nova.openstack.common import log as logging

LOG = logging.getLogger(__name__)
Expand Down
2 changes: 1 addition & 1 deletion nova/api/openstack/compute/contrib/hypervisors.py
Expand Up @@ -22,7 +22,7 @@
from nova.api.openstack import xmlutil
from nova import compute
from nova import exception
from nova.openstack.common.gettextutils import _
from nova.i18n import _


authorize = extensions.extension_authorizer('compute', 'hypervisors')
Expand Down
Expand Up @@ -21,7 +21,7 @@

from nova.api.openstack import extensions
from nova import compute
from nova.openstack.common.gettextutils import _
from nova.i18n import _
from nova import utils

CONF = cfg.CONF
Expand Down
2 changes: 1 addition & 1 deletion nova/api/openstack/compute/contrib/keypairs.py
Expand Up @@ -24,7 +24,7 @@
from nova.api.openstack import xmlutil
from nova.compute import api as compute_api
from nova import exception
from nova.openstack.common.gettextutils import _
from nova.i18n import _


authorize = extensions.extension_authorizer('compute', 'keypairs')
Expand Down
2 changes: 1 addition & 1 deletion nova/api/openstack/compute/contrib/multinic.py
Expand Up @@ -22,7 +22,7 @@
from nova.api.openstack import wsgi
from nova import compute
from nova import exception
from nova.openstack.common.gettextutils import _
from nova.i18n import _
from nova.openstack.common import log as logging


Expand Down
2 changes: 1 addition & 1 deletion nova/api/openstack/compute/contrib/networks_associate.py
Expand Up @@ -15,8 +15,8 @@
from nova.api.openstack import extensions
from nova.api.openstack import wsgi
from nova import exception
from nova.i18n import _
from nova import network
from nova.openstack.common.gettextutils import _
from nova.openstack.common import log as logging

LOG = logging.getLogger(__name__)
Expand Down
2 changes: 1 addition & 1 deletion nova/api/openstack/compute/contrib/os_networks.py
Expand Up @@ -21,8 +21,8 @@
from nova.api.openstack import extensions
from nova.api.openstack import wsgi
from nova import exception
from nova.i18n import _
from nova import network
from nova.openstack.common.gettextutils import _
from nova.openstack.common import log as logging

LOG = logging.getLogger(__name__)
Expand Down
2 changes: 1 addition & 1 deletion nova/api/openstack/compute/contrib/os_tenant_networks.py
Expand Up @@ -22,8 +22,8 @@
from nova.api.openstack import extensions
from nova import context as nova_context
from nova import exception
from nova.i18n import _
import nova.network
from nova.openstack.common.gettextutils import _
from nova.openstack.common import log as logging
from nova import quota

Expand Down

0 comments on commit 826aed0

Please sign in to comment.