summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTres Henry <tres@treshenry.net>2011-10-26 14:32:32 -0700
committerTres Henry <tres@treshenry.net>2011-10-26 14:32:32 -0700
commit0e8ac3c8fde5988e86d631f849c1f3a7298fd2f6 (patch)
treee59cec2b43409df6d5cfa4752aa9079707cf1793
parenta89aded8ae4b3b1dc4a43f167eb110b2821712b3 (diff)
parent5719b50ff3622802be024f5315feb50f904fd4e0 (diff)
downloadtuskar-ui-0e8ac3c8fde5988e86d631f849c1f3a7298fd2f6.tar.gz
Merge pull request #171 from gabrielhurley/gettext_fixes
More Internationalization
-rw-r--r--django-openstack/django_openstack/api.py4
-rw-r--r--django-openstack/django_openstack/auth/views.py2
-rw-r--r--django-openstack/django_openstack/context_processors.py4
-rw-r--r--django-openstack/django_openstack/dash/views/containers.py4
-rw-r--r--django-openstack/django_openstack/dash/views/floating_ips.py12
-rw-r--r--django-openstack/django_openstack/dash/views/images.py52
-rw-r--r--django-openstack/django_openstack/dash/views/keypairs.py6
-rw-r--r--django-openstack/django_openstack/dash/views/networks.py4
-rw-r--r--django-openstack/django_openstack/dash/views/objects.py8
-rw-r--r--django-openstack/django_openstack/dash/views/ports.py16
-rw-r--r--django-openstack/django_openstack/dash/views/security_groups.py5
-rw-r--r--django-openstack/django_openstack/dash/views/snapshots.py6
-rw-r--r--django-openstack/django_openstack/forms.py2
-rw-r--r--django-openstack/django_openstack/syspanel/views/flavors.py12
-rw-r--r--django-openstack/django_openstack/syspanel/views/images.py18
-rw-r--r--django-openstack/django_openstack/syspanel/views/instances.py8
-rw-r--r--django-openstack/django_openstack/syspanel/views/services.py2
-rw-r--r--django-openstack/django_openstack/syspanel/views/tenants.py46
-rw-r--r--django-openstack/django_openstack/syspanel/views/users.py30
19 files changed, 121 insertions, 120 deletions
diff --git a/django-openstack/django_openstack/api.py b/django-openstack/django_openstack/api.py
index 42be30a7..eeb1b996 100644
--- a/django-openstack/django_openstack/api.py
+++ b/django-openstack/django_openstack/api.py
@@ -999,7 +999,7 @@ class GlobalSummary(object):
self.service_list = []
LOG.exception('ApiException fetching service list in instance usage')
messages.error(self.request,
- 'Unable to get service info: %s' % e.message)
+ _('Unable to get service info: %s') % e.message)
return
for service in self.service_list:
@@ -1025,7 +1025,7 @@ class GlobalSummary(object):
' on date range "%s to %s"' % (datetime_start,
datetime_end))
messages.error(self.request,
- 'Unable to get usage info: %s' % e.message)
+ _('Unable to get usage info: %s') % e.message)
return
for usage in self.usage_list:
diff --git a/django-openstack/django_openstack/auth/views.py b/django-openstack/django_openstack/auth/views.py
index 3979ddd6..e0d224ea 100644
--- a/django-openstack/django_openstack/auth/views.py
+++ b/django-openstack/django_openstack/auth/views.py
@@ -80,7 +80,7 @@ class Login(forms.SelfHandlingForm):
# Abort if there are no valid tenants for this user
if not tenant:
messages.error(request,
- 'No tenants present for user: %(user)s' %
+ _('No tenants present for user: %(user)s') %
{"user": data['username']})
return
diff --git a/django-openstack/django_openstack/context_processors.py b/django-openstack/django_openstack/context_processors.py
index 5a73fc40..183f654a 100644
--- a/django-openstack/django_openstack/context_processors.py
+++ b/django-openstack/django_openstack/context_processors.py
@@ -31,8 +31,8 @@ def tenants(request):
try:
return {'tenants': api.token_list_tenants(request, request.user.token)}
except api_exceptions.BadRequest, e:
- messages.error(request, "Unable to retrieve tenant list from\
- keystone: %s" % e.message)
+ messages.error(request, _("Unable to retrieve tenant list from\
+ keystone: %s") % e.message)
return {'tenants': []}
diff --git a/django-openstack/django_openstack/dash/views/containers.py b/django-openstack/django_openstack/dash/views/containers.py
index 2ade9d0b..fada57e5 100644
--- a/django-openstack/django_openstack/dash/views/containers.py
+++ b/django-openstack/django_openstack/dash/views/containers.py
@@ -52,13 +52,13 @@ class DeleteContainer(forms.SelfHandlingForm):
(data['container_name'], str(e)))
else:
messages.info(request,
- 'Successfully deleted container: %s' % \
+ _('Successfully deleted container: %s') % \
data['container_name'])
return shortcuts.redirect(request.build_absolute_uri())
class CreateContainer(forms.SelfHandlingForm):
- name = forms.CharField(max_length="255", label="Container Name")
+ name = forms.CharField(max_length="255", label=_("Container Name"))
def handle(self, request, data):
api.swift_create_container(request, data['name'])
diff --git a/django-openstack/django_openstack/dash/views/floating_ips.py b/django-openstack/django_openstack/dash/views/floating_ips.py
index 79159845..99467268 100644
--- a/django-openstack/django_openstack/dash/views/floating_ips.py
+++ b/django-openstack/django_openstack/dash/views/floating_ips.py
@@ -48,8 +48,8 @@ class ReleaseFloatingIp(forms.SelfHandlingForm):
% data['floating_ip_id'])
except novaclient_exceptions.ClientException, e:
LOG.exception("ClientException in ReleaseFloatingIp")
- messages.error(request, 'Error releasing Floating IP from tenant: \
- %s' % e.message)
+ messages.error(request, _('Error releasing Floating IP '
+ 'from tenant: %s') % e.message)
return shortcuts.redirect(request.build_absolute_uri())
@@ -64,7 +64,7 @@ class FloatingIpAssociate(forms.SelfHandlingForm):
instancelist = kwargs.get('initial', {}).get('instances', [])
self.fields['instance_id'] = forms.ChoiceField(
choices=instancelist,
- label="Instance")
+ label=_("Instance"))
def handle(self, request, data):
try:
@@ -79,7 +79,7 @@ class FloatingIpAssociate(forms.SelfHandlingForm):
"inst": data['instance_id']}))
except novaclient_exceptions.ClientException, e:
LOG.exception("ClientException in FloatingIpAssociate")
- messages.error(request, 'Error associating Floating IP: %s'
+ messages.error(request, _('Error associating Floating IP: %s')
% e.message)
return shortcuts.redirect('dash_floating_ips', request.user.tenant_id)
@@ -121,8 +121,8 @@ class FloatingIpAllocate(forms.SelfHandlingForm):
except novaclient_exceptions.ClientException, e:
LOG.exception("ClientException in FloatingIpAllocate")
- messages.error(request, 'Error allocating Floating IP "%s"\
- to tenant "%s": %s' %
+ messages.error(request, _('Error allocating Floating IP "%s"\
+ to tenant "%s": %s') %
(fip.ip, data['tenant_id'], e.message))
return shortcuts.redirect('dash_floating_ips', request.user.tenant_id)
diff --git a/django-openstack/django_openstack/dash/views/images.py b/django-openstack/django_openstack/dash/views/images.py
index 4ea32968..6d76149e 100644
--- a/django-openstack/django_openstack/dash/views/images.py
+++ b/django-openstack/django_openstack/dash/views/images.py
@@ -43,15 +43,15 @@ LOG = logging.getLogger('django_openstack.dash.views.images')
class UpdateImageForm(forms.SelfHandlingForm):
image_id = forms.CharField(widget=forms.HiddenInput())
- name = forms.CharField(max_length="25", label="Name")
- kernel = forms.CharField(max_length="25", label="Kernel ID",
+ name = forms.CharField(max_length="25", label=_("Name"))
+ kernel = forms.CharField(max_length="25", label=_("Kernel ID"),
required=False)
- ramdisk = forms.CharField(max_length="25", label="Ramdisk ID",
+ ramdisk = forms.CharField(max_length="25", label=_("Ramdisk ID"),
required=False)
- architecture = forms.CharField(label="Architecture", required=False)
- container_format = forms.CharField(label="Container Format",
+ architecture = forms.CharField(label=_("Architecture"), required=False)
+ container_format = forms.CharField(label=_("Container Format"),
required=False)
- disk_format = forms.CharField(label="Disk Format")
+ disk_format = forms.CharField(label=_("Disk Format"))
def handle(self, request, data):
image_id = data['image_id']
@@ -108,11 +108,11 @@ class UpdateImageForm(forms.SelfHandlingForm):
class LaunchForm(forms.SelfHandlingForm):
- name = forms.CharField(max_length=80, label="Server Name")
+ name = forms.CharField(max_length=80, label=_("Server Name"))
image_id = forms.CharField(widget=forms.HiddenInput())
tenant_id = forms.CharField(widget=forms.HiddenInput())
user_data = forms.CharField(widget=forms.Textarea,
- label="User Data",
+ label=_("User Data"),
required=False)
# make the dropdown populate when the form is loaded not when django is
@@ -122,12 +122,12 @@ class LaunchForm(forms.SelfHandlingForm):
flavorlist = kwargs.get('initial', {}).get('flavorlist', [])
self.fields['flavor'] = forms.ChoiceField(
choices=flavorlist,
- label="Flavor",
+ label=_("Flavor"),
help_text="Size of Image to launch")
keynamelist = kwargs.get('initial', {}).get('keynamelist', [])
self.fields['key_name'] = forms.ChoiceField(choices=keynamelist,
- label="Key Name",
+ label=_("Key Name"),
required=False,
help_text="Which keypair to use for authentication")
@@ -135,7 +135,7 @@ class LaunchForm(forms.SelfHandlingForm):
'securitygrouplist', [])
self.fields['security_groups'] = forms.MultipleChoiceField(
choices=securitygrouplist,
- label='Security Groups',
+ label=_("Security Groups"),
required=True,
initial=['default'],
widget=forms.SelectMultiple(
@@ -166,7 +166,7 @@ class LaunchForm(forms.SelfHandlingForm):
normalize_newlines(data.get('user_data')),
data.get('security_groups'))
- msg = 'Instance was successfully launched'
+ msg = _('Instance was successfully launched')
LOG.info(msg)
messages.success(request, msg)
return redirect('dash_instances', tenant_id)
@@ -175,7 +175,7 @@ class LaunchForm(forms.SelfHandlingForm):
LOG.exception('ApiException while creating instances of image "%s"'
% image_id)
messages.error(request,
- 'Unable to launch instance: %s' % e.message)
+ _('Unable to launch instance: %s') % e.message)
class DeleteImage(forms.SelfHandlingForm):
@@ -189,16 +189,16 @@ class DeleteImage(forms.SelfHandlingForm):
if image.owner == request.user.username:
api.image_delete(request, image_id)
else:
- messages.info(request, "Unable to delete image, you are not \
- its owner.")
+ messages.info(request, _("Unable to delete image, you are not \
+ its owner."))
return redirect('dash_images_update', tenant_id, image_id)
except glance_exception.ClientConnectionError, e:
LOG.exception("Error connecting to glance")
- messages.error(request, "Error connecting to glance: %s"
+ messages.error(request, _("Error connecting to glance: %s")
% e.message)
except glance_exception.Error, e:
LOG.exception('Error deleting image with id "%s"' % image_id)
- messages.error(request, "Error deleting image: %s: %s"
+ messages.error(request, _("Error deleting image: %s: %s")
% (image_id, e.message))
return redirect(request.build_absolute_uri())
@@ -215,21 +215,21 @@ def index(request, tenant_id):
try:
tenant = api.token_get_tenant(request, request.user.tenant_id)
except api_exceptions.ApiException, e:
- messages.error(request, "Unable to retrienve tenant info\
- from keystone: %s" % e.message)
+ messages.error(request, _("Unable to retrienve tenant info\
+ from keystone: %s") % e.message)
all_images = []
try:
all_images = api.image_list_detailed(request)
if not all_images:
- messages.info(request, "There are currently no images.")
+ messages.info(request, _("There are currently no images."))
except glance_exception.ClientConnectionError, e:
LOG.exception("Error connecting to glance")
- messages.error(request, "Error connecting to glance: %s" % str(e))
+ messages.error(request, _("Error connecting to glance: %s") % str(e))
except glance_exception.Error, e:
LOG.exception("Error retrieving image list")
- messages.error(request, "Error retrieving image list: %s" % str(e))
+ messages.error(request, _("Error retrieving image list: %s") % str(e))
except api_exceptions.ApiException, e:
- msg = "Unable to retreive image info from glance: %s" % str(e)
+ msg = _("Unable to retreive image info from glance: %s") % str(e)
LOG.exception(msg)
messages.error(request, msg)
@@ -285,7 +285,7 @@ def launch(request, tenant_id, image_id):
try:
quotas.ram = int(quotas.ram) / 100
except Exception, e:
- messages.error(request, 'Error parsing quota for %s: %s' %
+ messages.error(request, _('Error parsing quota for %s: %s') %
(image_id, e.message))
return redirect('dash_instances', tenant_id)
@@ -313,11 +313,11 @@ def update(request, tenant_id, image_id):
image = api.image_get(request, image_id)
except glance_exception.ClientConnectionError, e:
LOG.exception("Error connecting to glance")
- messages.error(request, "Error connecting to glance: %s"
+ messages.error(request, _("Error connecting to glance: %s")
% e.message)
except glance_exception.Error, e:
LOG.exception('Error retrieving image with id "%s"' % image_id)
- messages.error(request, "Error retrieving image %s: %s"
+ messages.error(request, _("Error retrieving image %s: %s")
% (image_id, e.message))
form, handled = UpdateImageForm().maybe_handle(request, initial={
diff --git a/django-openstack/django_openstack/dash/views/keypairs.py b/django-openstack/django_openstack/dash/views/keypairs.py
index 646002f2..ef077f4b 100644
--- a/django-openstack/django_openstack/dash/views/keypairs.py
+++ b/django-openstack/django_openstack/dash/views/keypairs.py
@@ -57,7 +57,7 @@ class DeleteKeypair(forms.SelfHandlingForm):
class CreateKeypair(forms.SelfHandlingForm):
- name = forms.CharField(max_length="20", label="Keypair Name",
+ name = forms.CharField(max_length="20", label=_("Keypair Name"),
validators=[validators.RegexValidator('\w+')])
def handle(self, request, data):
@@ -78,9 +78,9 @@ class CreateKeypair(forms.SelfHandlingForm):
class ImportKeypair(forms.SelfHandlingForm):
- name = forms.CharField(max_length="20", label="Keypair Name",
+ name = forms.CharField(max_length="20", label=_("Keypair Name"),
validators=[validators.RegexValidator('\w+')])
- public_key = forms.CharField(label='Public Key', widget=forms.Textarea)
+ public_key = forms.CharField(label=_("Public Key"), widget=forms.Textarea)
def handle(self, request, data):
try:
diff --git a/django-openstack/django_openstack/dash/views/networks.py b/django-openstack/django_openstack/dash/views/networks.py
index 8a2b5a19..95682197 100644
--- a/django-openstack/django_openstack/dash/views/networks.py
+++ b/django-openstack/django_openstack/dash/views/networks.py
@@ -46,7 +46,7 @@ LOG = logging.getLogger('django_openstack.dash.views.networks')
class CreateNetwork(forms.SelfHandlingForm):
- name = forms.CharField(required=True, label="Network Name")
+ name = forms.CharField(required=True, label=_("Network Name"))
def handle(self, request, data):
network_name = data['name']
@@ -80,7 +80,7 @@ class DeleteNetwork(forms.SelfHandlingForm):
_('Unable to delete network %(network)s: %(msg)s') %
{"network": data['network'], "msg": e.message})
else:
- msg = 'Network %s has been deleted.' % data['network']
+ msg = _('Network %s has been deleted.') % data['network']
LOG.info(msg)
messages.success(request, msg)
diff --git a/django-openstack/django_openstack/dash/views/objects.py b/django-openstack/django_openstack/dash/views/objects.py
index 80fd8c10..f8d34e55 100644
--- a/django-openstack/django_openstack/dash/views/objects.py
+++ b/django-openstack/django_openstack/dash/views/objects.py
@@ -73,8 +73,8 @@ class DeleteObject(forms.SelfHandlingForm):
class UploadObject(forms.SelfHandlingForm):
- name = forms.CharField(max_length="255", label="Object Name")
- object_file = forms.FileField(label="File")
+ name = forms.CharField(max_length="255", label=_("Object Name"))
+ object_file = forms.FileField(label=_("File"))
container_name = forms.CharField(widget=forms.HiddenInput())
def handle(self, request, data):
@@ -90,10 +90,10 @@ class UploadObject(forms.SelfHandlingForm):
class CopyObject(forms.SelfHandlingForm):
new_container_name = forms.ChoiceField(
- label="Container to store object in")
+ label=_("Container to store object in"))
new_object_name = forms.CharField(max_length="255",
- label="New object name")
+ label=_("New object name"))
orig_container_name = forms.CharField(widget=forms.HiddenInput())
orig_object_name = forms.CharField(widget=forms.HiddenInput())
diff --git a/django-openstack/django_openstack/dash/views/ports.py b/django-openstack/django_openstack/dash/views/ports.py
index 7e720a54..7a2e9012 100644
--- a/django-openstack/django_openstack/dash/views/ports.py
+++ b/django-openstack/django_openstack/dash/views/ports.py
@@ -40,7 +40,7 @@ LOG = logging.getLogger('django_openstack.dash.views.ports')
class CreatePort(forms.SelfHandlingForm):
network = forms.CharField(widget=forms.HiddenInput())
- ports_num = forms.IntegerField(required=True, label="Number of Ports")
+ ports_num = forms.IntegerField(required=True, label=_("Number of Ports"))
def handle(self, request, data):
try:
@@ -86,7 +86,7 @@ class AttachPort(forms.SelfHandlingForm):
network = forms.CharField(widget=forms.HiddenInput())
port = forms.CharField(widget=forms.HiddenInput())
vif_id = forms.CharField(widget=forms.Select(),
- label="Select VIF to connect")
+ label=_("Select VIF to connect"))
def handle(self, request, data):
try:
@@ -97,10 +97,10 @@ class AttachPort(forms.SelfHandlingForm):
data['network'], data['port'], body)
except Exception, e:
messages.error(request,
- 'Unable to attach port %s to VIF %s: %s' %
+ _('Unable to attach port %s to VIF %s: %s') %
(data['port'], data['vif_id'], e.message,))
else:
- msg = 'Port %s connected to VIF %s.' % \
+ msg = _('Port %s connected to VIF %s.') % \
(data['port'], data['vif_id'])
LOG.info(msg)
messages.success(request, msg)
@@ -117,10 +117,10 @@ class DetachPort(forms.SelfHandlingForm):
api.quantum_detach_port(request, data['network'], data['port'])
except Exception, e:
messages.error(request,
- 'Unable to detach port %s: %s' %
+ _('Unable to detach port %s: %s') %
(data['port'], e.message,))
else:
- msg = 'Port %s detached.' % (data['port'])
+ msg = _('Port %s detached.') % (data['port'])
LOG.info(msg)
messages.success(request, msg)
return shortcuts.redirect(request.build_absolute_uri())
@@ -139,10 +139,10 @@ class TogglePort(forms.SelfHandlingForm):
data['network'], data['port'], body)
except Exception, e:
messages.error(request,
- 'Unable to set port state to %s: %s' %
+ _('Unable to set port state to %s: %s') %
(data['state'], e.message,))
else:
- msg = 'Port %s state set to %s.' % (data['port'], data['state'])
+ msg = _('Port %s state set to %s.') % (data['port'], data['state'])
LOG.info(msg)
messages.success(request, msg)
return shortcuts.redirect(request.build_absolute_uri())
diff --git a/django-openstack/django_openstack/dash/views/security_groups.py b/django-openstack/django_openstack/dash/views/security_groups.py
index 96956dc3..8b88331d 100644
--- a/django-openstack/django_openstack/dash/views/security_groups.py
+++ b/django-openstack/django_openstack/dash/views/security_groups.py
@@ -106,7 +106,7 @@ class AddRule(forms.SelfHandlingForm):
data['from_port'],
data['to_port'],
data['cidr'])
- messages.info(request, 'Successfully added rule: %s' \
+ messages.info(request, _('Successfully added rule: %s') \
% rule.id)
except novaclient_exceptions.ClientException, e:
LOG.exception("ClientException in AddRule")
@@ -178,7 +178,8 @@ def edit_rules(request, tenant_id, security_group_id):
security_group = api.security_group_get(request, security_group_id)
except novaclient_exceptions.ClientException, e:
LOG.exception("ClientException in security_groups rules edit")
- messages.error(request, 'Error getting security_group: %s' % e.message)
+ messages.error(request, _('Error getting security_group: %s')
+ % e.message)
return shortcuts.redirect('dash_security_groups', tenant_id)
return shortcuts.render_to_response(
diff --git a/django-openstack/django_openstack/dash/views/snapshots.py b/django-openstack/django_openstack/dash/views/snapshots.py
index 99a22d09..47b5a7b0 100644
--- a/django-openstack/django_openstack/dash/views/snapshots.py
+++ b/django-openstack/django_openstack/dash/views/snapshots.py
@@ -48,7 +48,7 @@ class CreateSnapshot(forms.SelfHandlingForm):
tenant_id = forms.CharField(widget=forms.HiddenInput())
instance_id = forms.CharField(widget=forms.TextInput(
attrs={'readonly': 'readonly'}))
- name = forms.CharField(max_length="20", label="Snapshot Name")
+ name = forms.CharField(max_length="20", label=_("Snapshot Name"))
def handle(self, request, data):
try:
@@ -63,7 +63,7 @@ class CreateSnapshot(forms.SelfHandlingForm):
{"name": data['name'], "inst": instance.name})
return shortcuts.redirect('dash_snapshots', data['tenant_id'])
except api_exceptions.ApiException, e:
- msg = 'Error Creating Snapshot: %s' % e.message
+ msg = _('Error Creating Snapshot: %s') % e.message
LOG.exception(msg)
messages.error(request, msg)
return shortcuts.redirect(request.build_absolute_uri())
@@ -101,7 +101,7 @@ def create(request, tenant_id, instance_id):
try:
instance = api.server_get(request, instance_id)
except api_exceptions.ApiException, e:
- msg = "Unable to retreive instance: %s" % str(e)
+ msg = _("Unable to retreive instance: %s") % e
LOG.exception(msg)
messages.error(request, msg)
return shortcuts.redirect('dash_instances', tenant_id)
diff --git a/django-openstack/django_openstack/forms.py b/django-openstack/django_openstack/forms.py
index b366580f..201add43 100644
--- a/django-openstack/django_openstack/forms.py
+++ b/django-openstack/django_openstack/forms.py
@@ -177,7 +177,7 @@ class SelfHandlingForm(Form):
return form, form.handle(request, data)
except Exception as e:
LOG.exception('Nonspecific error while handling form')
- messages.error(request, 'Unexpected error: %s' % e.message)
+ messages.error(request, _('Unexpected error: %s') % e.message)
return form, None
diff --git a/django-openstack/django_openstack/syspanel/views/flavors.py b/django-openstack/django_openstack/syspanel/views/flavors.py
index b6f830fb..e15f9561 100644
--- a/django-openstack/django_openstack/syspanel/views/flavors.py
+++ b/django-openstack/django_openstack/syspanel/views/flavors.py
@@ -41,11 +41,11 @@ LOG = logging.getLogger('django_openstack.syspanel.views.flavors')
class CreateFlavor(forms.SelfHandlingForm):
- flavorid = forms.CharField(max_length="10", label="Flavor ID")
- name = forms.CharField(max_length="25", label="Name")
- vcpus = forms.CharField(max_length="5", label="VCPUs")
- memory_mb = forms.CharField(max_length="5", label="Memory MB")
- disk_gb = forms.CharField(max_length="5", label="Disk GB")
+ flavorid = forms.CharField(max_length="10", label=_("Flavor ID"))
+ name = forms.CharField(max_length="25", label=_("Name"))
+ vcpus = forms.CharField(max_length="5", label=_("VCPUs"))
+ memory_mb = forms.CharField(max_length="5", label=_("Memory MB"))
+ disk_gb = forms.CharField(max_length="5", label=_("Disk GB"))
def handle(self, request, data):
api.flavor_create(request,
@@ -81,7 +81,7 @@ class DeleteFlavor(forms.SelfHandlingForm):
@enforce_admin_access
def index(request):
for f in (DeleteFlavor,):
- _, handled = f.maybe_handle(request)
+ form, handled = f.maybe_handle(request)
if handled:
return handled
diff --git a/django-openstack/django_openstack/syspanel/views/images.py b/django-openstack/django_openstack/syspanel/views/images.py
index 1ed87542..8dd8d7aa 100644
--- a/django-openstack/django_openstack/syspanel/views/images.py
+++ b/django-openstack/django_openstack/syspanel/views/images.py
@@ -72,24 +72,24 @@ class ToggleImage(forms.SelfHandlingForm):
class UpdateImageForm(forms.Form):
- name = forms.CharField(max_length="25", label="Name")
- kernel = forms.CharField(max_length="25", label="Kernel ID",
+ name = forms.CharField(max_length="25", label=_("Name"))
+ kernel = forms.CharField(max_length="25", label=_("Kernel ID"),
required=False)
- ramdisk = forms.CharField(max_length="25", label="Ramdisk ID",
+ ramdisk = forms.CharField(max_length="25", label=_("Ramdisk ID"),
required=False)
- architecture = forms.CharField(label="Architecture", required=False)
- #project_id = forms.CharField(label="Project ID")
- container_format = forms.CharField(label="Container Format",
+ architecture = forms.CharField(label=_("Architecture"), required=False)
+ #project_id = forms.CharField(label=_("Project ID"))
+ container_format = forms.CharField(label=_("Container Format"),
required=False)
- disk_format = forms.CharField(label="Disk Format")
- #is_public = forms.BooleanField(label="Publicly Available", required=False)
+ disk_format = forms.CharField(label=_("Disk Format"))
+ #is_public = forms.BooleanField(label=_("Publicly Available"), required=False)
@login_required
@enforce_admin_access
def index(request):
for f in (DeleteImage, ToggleImage):
- _, handled = f.maybe_handle(request)
+ form, handled = f.maybe_handle(request)
if handled:
return handled
diff --git a/django-openstack/django_openstack/syspanel/views/instances.py b/django-openstack/django_openstack/syspanel/views/instances.py
index 198c84b2..e2074b9d 100644
--- a/django-openstack/django_openstack/syspanel/views/instances.py
+++ b/django-openstack/django_openstack/syspanel/views/instances.py
@@ -180,7 +180,7 @@ def tenant_usage(request, tenant_id):
@enforce_admin_access
def index(request):
for f in (TerminateInstance, RebootInstance):
- _, handled = f.maybe_handle(request)
+ form, handled = f.maybe_handle(request)
if handled:
return handled
@@ -209,7 +209,7 @@ def index(request):
@enforce_admin_access
def refresh(request):
for f in (TerminateInstance, RebootInstance):
- _, handled = f.maybe_handle(request)
+ form, handled = f.maybe_handle(request)
if handled:
return handled
@@ -246,13 +246,13 @@ def detail(request, instance_id):
LOG.exception('ApiException while fetching instance vnc \
connection')
messages.error(request,
- 'Unable to get vnc console for instance %s: %s' %
+ _('Unable to get vnc console for instance %s: %s') %
(instance_id, e.message))
return redirect('dash_instances', tenant_id)
except api_exceptions.ApiException, e:
LOG.exception('ApiException while fetching instance info')
messages.error(request,
- 'Unable to get information for instance %s: %s' %
+ _('Unable to get information for instance %s: %s') %
(instance_id, e.message))
return redirect('dash_instances', tenant_id)
diff --git a/django-openstack/django_openstack/syspanel/views/services.py b/django-openstack/django_openstack/syspanel/views/services.py
index be56f47a..c1c76a69 100644
--- a/django-openstack/django_openstack/syspanel/views/services.py
+++ b/django-openstack/django_openstack/syspanel/views/services.py
@@ -75,7 +75,7 @@ class ToggleService(forms.SelfHandlingForm):
@enforce_admin_access
def index(request):
for f in (ToggleService,):
- _, handled = f.maybe_handle(request)
+ form, handled = f.maybe_handle(request)
if handled:
return handled
diff --git a/django-openstack/django_openstack/syspanel/views/tenants.py b/django-openstack/django_openstack/syspanel/views/tenants.py
index 418d49bb..aa835d60 100644
--- a/django-openstack/django_openstack/syspanel/views/tenants.py
+++ b/django-openstack/django_openstack/syspanel/views/tenants.py
@@ -54,7 +54,7 @@ class AddUser(forms.SelfHandlingForm):
data['user'],
settings.OPENSTACK_KEYSTONE_DEFAULT_ROLE)
messages.success(request,
- '%(user)s was successfully added to %(tenant)s.'
+ _('%(user)s was successfully added to %(tenant)s.')
% {"user": data['user'], "tenant": data['tenant']})
except api_exceptions.ApiException, e:
messages.error(request, _('Unable to create user association: %s')
@@ -74,7 +74,7 @@ class RemoveUser(forms.SelfHandlingForm):
data['user'],
settings.OPENSTACK_KEYSTONE_DEFAULT_ROLE)
messages.success(request,
- '%(user)s was successfully removed from %(tenant)s.'
+ _('%(user)s was successfully removed from %(tenant)s.')
% {"user": data['user'], "tenant": data['tenant']})
except api_exceptions.ApiException, e:
messages.error(request, _('Unable to create tenant: %s') %
@@ -83,10 +83,10 @@ class RemoveUser(forms.SelfHandlingForm):
class CreateTenant(forms.SelfHandlingForm):
- name = forms.CharField(label="Name")
+ name = forms.CharField(label=_("Name"))
description = forms.CharField(widget=forms.widgets.Textarea(),
- label="Description")
- enabled = forms.BooleanField(label="Enabled", required=False,
+ label=_("Description"))
+ enabled = forms.BooleanField(label=_("Enabled"), required=False,
initial=True)
def handle(self, request, data):
@@ -109,13 +109,13 @@ class CreateTenant(forms.SelfHandlingForm):
class UpdateTenant(forms.SelfHandlingForm):
- id = forms.CharField(label="ID",
+ id = forms.CharField(label=_("ID"),
widget=forms.TextInput(attrs={'readonly': 'readonly'}))
- name = forms.CharField(label="Name",
+ name = forms.CharField(label=_("Name"),
widget=forms.TextInput(attrs={'readonly': 'readonly'}))
description = forms.CharField(widget=forms.widgets.Textarea(),
- label="Description")
- enabled = forms.BooleanField(required=False, label="Enabled")
+ label=_("Description"))
+ enabled = forms.BooleanField(required=False, label=_("Enabled"))
def handle(self, request, data):
try:
@@ -126,7 +126,7 @@ class UpdateTenant(forms.SelfHandlingForm):
data['description'],
data['enabled'])
messages.success(request,
- '%s was successfully updated.'
+ _('%s was successfully updated.')
% data['name'])
except api_exceptions.ApiException, e:
LOG.exception('ApiException while updating tenant\n'
@@ -139,18 +139,18 @@ class UpdateTenant(forms.SelfHandlingForm):
class UpdateQuotas(forms.SelfHandlingForm):
- tenant_id = forms.CharField(label="ID (name)",
+ tenant_id = forms.CharField(label=_("ID (name)"),
widget=forms.TextInput(attrs={'readonly': 'readonly'}))
- metadata_items = forms.CharField(label="Metadata Items")
- injected_files = forms.CharField(label="Injected Files")
- injected_file_content_bytes = forms.CharField(label="Injected File "
- "Content Bytes")
- cores = forms.CharField(label="VCPUs")
- instances = forms.CharField(label="Instances")
- volumes = forms.CharField(label="Volumes")
- gigabytes = forms.CharField(label="Gigabytes")
- ram = forms.CharField(label="RAM (in MB)")
- floating_ips = forms.CharField(label="Floating IPs")
+ metadata_items = forms.CharField(label=_("Metadata Items"))
+ injected_files = forms.CharField(label=_("Injected Files"))
+ injected_file_content_bytes = forms.CharField(label=_("Injected File "
+ "Content Bytes"))
+ cores = forms.CharField(label=_("VCPUs"))
+ instances = forms.CharField(label=_("Instances"))
+ volumes = forms.CharField(label=_("Volumes"))
+ gigabytes = forms.CharField(label=_("Gigabytes"))
+ ram = forms.CharField(label=_("RAM (in MB)"))
+ floating_ips = forms.CharField(label=_("Floating IPs"))
def handle(self, request, data):
try:
@@ -255,7 +255,7 @@ def update(request, tenant_id):
@enforce_admin_access
def users(request, tenant_id):
for f in (AddUser, RemoveUser,):
- _, handled = f.maybe_handle(request)
+ form, handled = f.maybe_handle(request)
if handled:
return handled
# form, handled = UpdateTenant.maybe_handle(request)
@@ -282,7 +282,7 @@ def users(request, tenant_id):
@enforce_admin_access
def quotas(request, tenant_id):
for f in (UpdateQuotas,):
- _, handled = f.maybe_handle(request)
+ form, handled = f.maybe_handle(request)
if handled:
return handled
diff --git a/django-openstack/django_openstack/syspanel/views/users.py b/django-openstack/django_openstack/syspanel/views/users.py
index cf8f824f..392a98fb 100644
--- a/django-openstack/django_openstack/syspanel/views/users.py
+++ b/django-openstack/django_openstack/syspanel/views/users.py
@@ -50,12 +50,12 @@ class UserForm(forms.Form):
self.fields['tenant_id'].choices = [[tenant.id, tenant.id]
for tenant in tenant_list]
- name = forms.CharField(label="Name")
- email = forms.CharField(label="Email")
- password = forms.CharField(label="Password",
+ name = forms.CharField(label=_("Name"))
+ email = forms.CharField(label=_("Email"))
+ password = forms.CharField(label=_("Password"),
widget=forms.PasswordInput(render_value=False),
required=False)
- tenant_id = forms.ChoiceField(label="Primary Tenant")
+ tenant_id = forms.ChoiceField(label=_("Primary Tenant"))
class UserUpdateForm(forms.Form):
@@ -65,15 +65,15 @@ class UserUpdateForm(forms.Form):
self.fields['tenant_id'].choices = [[tenant.id, tenant.id]
for tenant in tenant_list]
- id = forms.CharField(label="ID",
+ id = forms.CharField(label=_("ID"),
widget=forms.TextInput(attrs={'readonly': 'readonly'}))
# FIXME: keystone doesn't return the username from a get API call.
- #name = forms.CharField(label="Name")
- email = forms.CharField(label="Email")
- password = forms.CharField(label="Password",
+ #name = forms.CharField(label=_("Name"))
+ email = forms.CharField(label=_("Email"))
+ password = forms.CharField(label=_("Password"),
widget=forms.PasswordInput(render_value=False),
required=False)
- tenant_id = forms.ChoiceField(label="Primary Tenant")
+ tenant_id = forms.ChoiceField(label=_("Primary Tenant"))
class UserDeleteForm(forms.SelfHandlingForm):
@@ -89,8 +89,8 @@ class UserDeleteForm(forms.SelfHandlingForm):
class UserEnableDisableForm(forms.SelfHandlingForm):
- id = forms.CharField(label="ID (username)", widget=forms.HiddenInput())
- enabled = forms.ChoiceField(label="enabled", widget=forms.HiddenInput(),
+ id = forms.CharField(label=_("ID (username)"), widget=forms.HiddenInput())
+ enabled = forms.ChoiceField(label=_("enabled"), widget=forms.HiddenInput(),
choices=[[c, c]
for c in ("disable", "enable")])
@@ -100,11 +100,11 @@ class UserEnableDisableForm(forms.SelfHandlingForm):
try:
api.user_update_enabled(request, user_id, enabled)
- messages.info(request, "User %s %s" %
+ messages.info(request, _("User %s %s") %
(user_id,
"enabled" if enabled else "disabled"))
except api_exceptions.ApiException:
- messages.error(request, "Unable to %s user %s" %
+ messages.error(request, _("Unable to %s user %s") %
("enable" if enabled else "disable",
user_id))
@@ -115,7 +115,7 @@ class UserEnableDisableForm(forms.SelfHandlingForm):
@enforce_admin_access
def index(request):
for f in (UserDeleteForm, UserEnableDisableForm):
- _, handled = f.maybe_handle(request)
+ form, handled = f.maybe_handle(request)
if handled:
return handled
@@ -155,7 +155,7 @@ def update(request, user_id):
updated.append('tenant')
api.user_update_tenant(request, user['id'], user['tenant_id'])
messages.success(request,
- 'Updated %s for %s.'
+ _('Updated %s for %s.')
% (', '.join(updated), user_id))
return redirect('syspanel_users')
else: