Commit a30545c1 by Kálmán Viktor

dashboard: plural gettext for mass create / mass delete

parent 577130c4
...@@ -41,6 +41,7 @@ from django.views.generic import (TemplateView, DetailView, View, DeleteView, ...@@ -41,6 +41,7 @@ from django.views.generic import (TemplateView, DetailView, View, DeleteView,
UpdateView, CreateView, ListView) UpdateView, CreateView, ListView)
from django.contrib import messages from django.contrib import messages
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from django.utils.translation import ungettext as __
from django.template.defaultfilters import title as title_filter from django.template.defaultfilters import title as title_filter
from django.template.loader import render_to_string from django.template.loader import render_to_string
from django.template import RequestContext from django.template import RequestContext
...@@ -1410,8 +1411,10 @@ class VmCreate(LoginRequiredMixin, TemplateView): ...@@ -1410,8 +1411,10 @@ class VmCreate(LoginRequiredMixin, TemplateView):
i.deploy.async(user=request.user) i.deploy.async(user=request.user)
if len(instances) > 1: if len(instances) > 1:
messages.success(request, _("Successfully created %d VMs." % messages.success(request, __(
len(instances))) "Successfully created %(count)d VM.", # this should not happen
"Successfully created %(count)d VMs.", len(instances)) % {
'count': len(instances)})
path = reverse("dashboard.index") path = reverse("dashboard.index")
else: else:
messages.success(request, _("VM successfully created.")) messages.success(request, _("VM successfully created."))
...@@ -1844,8 +1847,10 @@ class VmMassDelete(LoginRequiredMixin, View): ...@@ -1844,8 +1847,10 @@ class VmMassDelete(LoginRequiredMixin, View):
except Exception as e: except Exception as e:
logger.error(e) logger.error(e)
success_message = _("Mass delete complete, the following VMs were " success_message = __(
"deleted: %s.") % u', '.join(names) "Mass delete complete, the following VM was deleted: %s.",
"Mass delete complete, the following VMs were deleted: %s.",
len(names)) % u', '.join(names)
# we can get this only via AJAX ... # we can get this only via AJAX ...
if request.is_ajax(): if request.is_ajax():
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment