Improve pluralization

This commit is contained in:
Roberto Rosario
2015-01-24 14:46:13 -04:00
parent febe21db1b
commit 850ad53fb1
3 changed files with 31 additions and 31 deletions

View File

@@ -210,12 +210,15 @@ def document_delete(request, document_id=None, document_id_list=None):
'delete_view': True,
'previous': previous,
'next': next,
'title': ungettext(
'Are you sure you wish to delete the selected document?',
'Are you sure you wish to delete the selected documents?',
len(documents)
)
}
if len(documents) == 1:
context['object'] = documents[0]
context['title'] = _('Are you sure you wish to delete the document: %s?') % ', '.join([unicode(d) for d in documents])
elif len(documents) > 1:
context['title'] = _('Are you sure you wish to delete the documents: %s?') % ', '.join([unicode(d) for d in documents])
return render_to_response('main/generic_confirm.html', context,
context_instance=RequestContext(request))
@@ -301,13 +304,15 @@ def document_document_type_edit(request, document_id=None, document_id_list=None
'submit_label': _('Submit'),
'previous': previous,
'next': next,
'title': ungettext(
'Change the type of the selected document.',
'Change the type of the selected documents.',
len(documents)
)
}
if len(documents) == 1:
context['object'] = documents[0]
context['title'] = _('Are you sure you wish to change the type of the document: %s?') % ', '.join([unicode(d) for d in documents])
elif len(documents) > 1:
context['title'] = _('Are you sure you wish to change the type of the documents: %s?') % ', '.join([unicode(d) for d in documents])
return render_to_response('main/generic_form.html', context,
context_instance=RequestContext(request))
@@ -485,15 +490,13 @@ def document_update_page_count(request, document_id=None, document_id_list=None)
)
return HttpResponseRedirect(previous)
title = ungettext(
_('Are you sure you wish to reset the page count of this document?'),
_('Are you sure you wish to reset the page count of these documents?'),
len(documents)
)
context = {
'previous': previous,
'title': title,
'title': ungettext(
'Are you sure you wish to reset the page count of the selected document?',
'Are you sure you wish to reset the page count of the selected documents?',
len(documents)
)
}
if len(documents) == 1:
@@ -542,15 +545,17 @@ def document_clear_transformations(request, document_id=None, document_id_list=N
context = {
'delete_view': True,
'previous': previous,
'next': next,
'previous': previous,
'title': ungettext(
'Are you sure you wish to clear all the page transformations for the selected document?',
'Are you sure you wish to clear all the page transformations for the selected documents?',
len(documents)
)
}
if len(documents) == 1:
context['object'] = documents[0]
context['title'] = _('Are you sure you wish to clear all the page transformations for document: %s?') % ', '.join([unicode(d) for d in documents])
elif len(documents) > 1:
context['title'] = _('Are you sure you wish to clear all the page transformations for documents: %s?') % ', '.join([unicode(d) for d in documents])
return render_to_response('main/generic_confirm.html', context,
context_instance=RequestContext(request))

View File

@@ -265,17 +265,18 @@ def folder_document_remove(request, folder_id, document_id=None, document_id_lis
return HttpResponseRedirect(next)
context = {
'previous': previous,
'next': next,
'object': folder
'object': folder,
'previous': previous,
'title': ungettext(
'Are you sure you wish to remove the selected document from the folder: %(folder)s?',
'Are you sure you wish to remove the selected documents from the folder: %(folder)s?',
len(folder_documents)
) % {'folder': folder}
}
if len(folder_documents) == 1:
context['object'] = folder_documents[0]
context['title'] = _('Are you sure you wish to remove the document: %(document)s from the folder "%(folder)s"?') % {
'document': ', '.join([unicode(d) for d in folder_documents]), 'folder': folder}
elif len(folder_documents) > 1:
context['title'] = _('Are you sure you wish to remove the documents: %(documents)s from the folder "%(folder)s"?') % {
'documents': ', '.join([unicode(d) for d in folder_documents]), 'folder': folder}
return render_to_response('main/generic_confirm.html', context,
context_instance=RequestContext(request))

View File

@@ -169,12 +169,6 @@ def tag_delete(request, tag_id=None, tag_id_list=None):
context = {
'delete_view': True,
'previous': previous,
'next': next,
}
context = {
'form': form,
'previous': previous,
'message': _('Will be removed from all documents.'),
'next': next,
'title': ungettext(
@@ -184,7 +178,7 @@ def tag_delete(request, tag_id=None, tag_id_list=None):
)
}
if len(documents) == 1:
if len(tags) == 1:
context['object'] = tags[0]
return render_to_response('main/generic_confirm.html', context,