From a2bcc38b08962ae0f7ffb61c4524c6888d12c2f4 Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Fri, 16 Jan 2015 02:14:35 -0400 Subject: [PATCH] Properly pluralize the messages of the document metadata type add view --- mayan/apps/metadata/views.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/mayan/apps/metadata/views.py b/mayan/apps/metadata/views.py index 4d0d280452..9c8444efc0 100644 --- a/mayan/apps/metadata/views.py +++ b/mayan/apps/metadata/views.py @@ -207,11 +207,18 @@ def metadata_add(request, document_id=None, document_id_list=None): 'form': form, 'next': next, } + if len(documents) == 1: context['object'] = documents[0] - context['title'] = _(u'Add metadata type to document: %s') % ', '.join([unicode(d) for d in documents]) - elif len(documents) > 1: - context['title'] = _(u'Add metadata type to documents: %s') % ', '.join([unicode(d) for d in documents]) + + context['title'] = ungettext( + u'Add metadata types to document: %(document)s', + u'Add metadata types to the %(count)d selected documents', + len(documents) + ) % { + u'count': len(documents), + u'document': documents[0], + } return render_to_response('main/generic_form.html', context, context_instance=RequestContext(request))