Fix concatenation in Delete Image action

Remove concatenation and pluralization issues from Delete Image
action

Change-Id: I27d9c9f4c38d68183c16b5d23a6aba6f206d392c
partial-bug: 1307476
This commit is contained in:
Doug Fish 2014-09-16 14:11:42 -05:00
parent d55368b0a1
commit de81c57573

View File

@ -19,6 +19,7 @@ from django.core.urlresolvers import reverse
from django.template import defaultfilters as filters from django.template import defaultfilters as filters
from django.utils.http import urlencode from django.utils.http import urlencode
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ungettext_lazy
from horizon import tables from horizon import tables
from horizon.utils.memoized import memoized # noqa from horizon.utils.memoized import memoized # noqa
@ -56,8 +57,22 @@ class LaunchImage(tables.LinkAction):
class DeleteImage(tables.DeleteAction): class DeleteImage(tables.DeleteAction):
data_type_singular = _("Image") @staticmethod
data_type_plural = _("Images") def action_present(count):
return ungettext_lazy(
u"Delete Image",
u"Delete Images",
count
)
@staticmethod
def action_past(count):
return ungettext_lazy(
u"Deleted Image",
u"Deleted Images",
count
)
policy_rules = (("image", "delete_image"),) policy_rules = (("image", "delete_image"),)
def allowed(self, request, image=None): def allowed(self, request, image=None):