Make values for IPSec&VPN status be translatable

Add STATUS_DISPLAY_CHOICES in files:
openstack_dashboard/dashboards/project/vpn/tables.py

Change-Id: Ie8f1ea99dc6c11008c98d7dc71c6429673382b04
Partial-Bug: #1418027
This commit is contained in:
Wu Wenxiang 2015-02-04 21:16:03 +08:00
parent 73785576c0
commit 48f4db9b66
1 changed files with 31 additions and 5 deletions

View File

@ -14,11 +14,11 @@
from django.core.urlresolvers import reverse
from django.template.defaultfilters import title # noqa
from django.utils.translation import pgettext_lazy
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ungettext_lazy
from horizon import tables
from horizon.utils import filters
forbid_updates = set(["PENDING_CREATE", "PENDING_UPDATE", "PENDING_DELETE"])
@ -226,6 +226,14 @@ class IPSecSiteConnectionsTable(tables.DataTable):
("Down", True),
("Error", False),
)
STATUS_DISPLAY_CHOICES = (
("Active", pgettext_lazy("Current status of an IPSec Site Connection",
u"Active")),
("Down", pgettext_lazy("Current status of an IPSec Site Connection",
u"Down")),
("Error", pgettext_lazy("Current status of an IPSec Site Connection",
u"Error")),
)
id = tables.Column('id', hidden=True)
name = tables.Column('name_or_id', verbose_name=_('Name'),
link="horizon:project:vpn:ipsecsiteconnectiondetails")
@ -236,10 +244,10 @@ class IPSecSiteConnectionsTable(tables.DataTable):
ipsecpolicy_name = tables.Column('ipsecpolicy_name',
verbose_name=_('IPSec Policy'))
status = tables.Column("status",
filters=(title, filters.replace_underscores),
verbose_name=_("Status"),
status=True,
status_choices=STATUS_CHOICES)
status_choices=STATUS_CHOICES,
display_choices=STATUS_DISPLAY_CHOICES)
class Meta(object):
name = "ipsecsiteconnectionstable"
@ -256,6 +264,24 @@ class VPNServicesTable(tables.DataTable):
("Down", True),
("Error", False),
)
STATUS_DISPLAY_CHOICES = (
("Active", pgettext_lazy("Current status of a VPN Service",
u"Active")),
("Down", pgettext_lazy("Current status of a VPN Service",
u"Down")),
("Error", pgettext_lazy("Current status of a VPN Service",
u"Error")),
("Created", pgettext_lazy("Current status of a VPN Service",
u"Created")),
("Pending_Create", pgettext_lazy("Current status of a VPN Service",
u"Pending Create")),
("Pending_Update", pgettext_lazy("Current status of a VPN Service",
u"Pending Update")),
("Pending_Delete", pgettext_lazy("Current status of a VPN Service",
u"Pending Delete")),
("Inactive", pgettext_lazy("Current status of a VPN Service",
u"Inactive")),
)
id = tables.Column('id', hidden=True)
name = tables.Column("name_or_id", verbose_name=_('Name'),
link="horizon:project:vpn:vpnservicedetails")
@ -263,10 +289,10 @@ class VPNServicesTable(tables.DataTable):
subnet_name = tables.Column('subnet_name', verbose_name=_('Subnet'))
router_name = tables.Column('router_name', verbose_name=_('Router'))
status = tables.Column("status",
filters=(title, filters.replace_underscores),
verbose_name=_("Status"),
status=True,
status_choices=STATUS_CHOICES)
status_choices=STATUS_CHOICES,
display_choices=STATUS_DISPLAY_CHOICES)
class Meta(object):
name = "vpnservicestable"