Refs #2202 -- Cleaned up technique of splitting arguments, based upon a suggestion from SmileyChris.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3273 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
b9d9351e85
commit
5ac919b711
|
@ -437,15 +437,12 @@ def pluralize(value, arg='s'):
|
|||
is used instead. If the provided argument contains a comma, the text before
|
||||
the comma is used for the singular case.
|
||||
"""
|
||||
if not ',' in arg:
|
||||
arg = ',' + arg
|
||||
bits = arg.split(',')
|
||||
if len(bits) == 2:
|
||||
singular_suffix = bits[0]
|
||||
plural_suffix = bits[1]
|
||||
elif len(bits) == 1:
|
||||
singular_suffix = ''
|
||||
plural_suffix = bits[0]
|
||||
else:
|
||||
if len(bits) > 2:
|
||||
return ''
|
||||
singular_suffix, plural_suffix = bits[:2]
|
||||
|
||||
try:
|
||||
if int(value) != 1:
|
||||
|
|
Loading…
Reference in New Issue