diff --git a/openstack_dashboard/dashboards/identity/domains/tables.py b/openstack_dashboard/dashboards/identity/domains/tables.py index 8338525028..a70693994c 100644 --- a/openstack_dashboard/dashboards/identity/domains/tables.py +++ b/openstack_dashboard/dashboards/identity/domains/tables.py @@ -18,6 +18,7 @@ from django.conf import settings from django.core.urlresolvers import reverse from django.utils.http import urlencode from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ungettext_lazy from keystoneclient import exceptions @@ -87,9 +88,23 @@ class EditDomainLink(tables.LinkAction): class DeleteDomainsAction(tables.DeleteAction): + @staticmethod + def action_present(count): + return ungettext_lazy( + u"Delete Domain", + u"Delete Domains", + count + ) + + @staticmethod + def action_past(count): + return ungettext_lazy( + u"Deleted Domain", + u"Deleted Domains", + count + ) + name = "delete" - data_type_singular = _("Domain") - data_type_plural = _("Domains") policy_rules = (('identity', 'identity:delete_domain'),) def allowed(self, request, datum): diff --git a/openstack_dashboard/dashboards/identity/groups/tables.py b/openstack_dashboard/dashboards/identity/groups/tables.py index 782e2758bd..60cf35adda 100644 --- a/openstack_dashboard/dashboards/identity/groups/tables.py +++ b/openstack_dashboard/dashboards/identity/groups/tables.py @@ -17,6 +17,7 @@ import logging from django.core.urlresolvers import reverse from django.template import defaultfilters from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ungettext_lazy from horizon import tables @@ -58,9 +59,23 @@ class EditGroupLink(tables.LinkAction): class DeleteGroupsAction(tables.DeleteAction): + @staticmethod + def action_present(count): + return ungettext_lazy( + u"Delete Group", + u"Delete Groups", + count + ) + + @staticmethod + def action_past(count): + return ungettext_lazy( + u"Deleted Group", + u"Deleted Groups", + count + ) + name = "delete" - data_type_singular = _("Group") - data_type_plural = _("Groups") policy_rules = (("identity", "identity:delete_group"),) def allowed(self, request, datum): @@ -120,11 +135,23 @@ class UserFilterAction(tables.FilterAction): class RemoveMembers(tables.DeleteAction): + @staticmethod + def action_present(count): + return ungettext_lazy( + u"Remove User", + u"Remove Users", + count + ) + + @staticmethod + def action_past(count): + return ungettext_lazy( + u"Removed User", + u"Removed Users", + count + ) + name = "removeGroupMember" - action_present = _("Remove") - action_past = _("Removed") - data_type_singular = _("User") - data_type_plural = _("Users") policy_rules = (("identity", "identity:remove_user_from_group"),) def allowed(self, request, user=None): @@ -179,11 +206,23 @@ class GroupMembersTable(UsersTable): class AddMembers(tables.BatchAction): + @staticmethod + def action_present(count): + return ungettext_lazy( + u"Add User", + u"Add Users", + count + ) + + @staticmethod + def action_past(count): + return ungettext_lazy( + u"Added User", + u"Added Users", + count + ) + name = "addMember" - action_present = _("Add") - action_past = _("Added") - data_type_singular = _("User") - data_type_plural = _("Users") icon = "plus" requires_input = True success_url = constants.GROUPS_MANAGE_URL diff --git a/openstack_dashboard/dashboards/identity/projects/tables.py b/openstack_dashboard/dashboards/identity/projects/tables.py index 817797de3b..856295b652 100644 --- a/openstack_dashboard/dashboards/identity/projects/tables.py +++ b/openstack_dashboard/dashboards/identity/projects/tables.py @@ -14,6 +14,7 @@ from django.core.exceptions import ValidationError # noqa from django.core.urlresolvers import reverse from django.utils.http import urlencode from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ungettext_lazy from horizon import exceptions from horizon import forms @@ -109,8 +110,22 @@ class ModifyQuotas(tables.LinkAction): class DeleteTenantsAction(tables.DeleteAction): - data_type_singular = _("Project") - data_type_plural = _("Projects") + @staticmethod + def action_present(count): + return ungettext_lazy( + u"Delete Project", + u"Delete Projects", + count + ) + + @staticmethod + def action_past(count): + return ungettext_lazy( + u"Deleted Project", + u"Deleted Projects", + count + ) + policy_rules = (("identity", "identity:delete_project"),) def allowed(self, request, project): diff --git a/openstack_dashboard/dashboards/identity/roles/tables.py b/openstack_dashboard/dashboards/identity/roles/tables.py index 4296fbfaf6..d9a27fa66b 100644 --- a/openstack_dashboard/dashboards/identity/roles/tables.py +++ b/openstack_dashboard/dashboards/identity/roles/tables.py @@ -13,6 +13,7 @@ # under the License. from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ungettext_lazy from horizon import tables @@ -44,8 +45,21 @@ class EditRoleLink(tables.LinkAction): class DeleteRolesAction(tables.DeleteAction): - data_type_singular = _("Role") - data_type_plural = _("Roles") + @staticmethod + def action_present(count): + return ungettext_lazy( + u"Delete Role", + u"Delete Roles", + count + ) + + @staticmethod + def action_past(count): + return ungettext_lazy( + u"Deleted Role", + u"Deleted Roles", + count + ) policy_rules = (("identity", "identity:delete_role"),) def allowed(self, request, role):