mirror of
https://github.com/django/django.git
synced 2024-12-22 17:16:24 +00:00
Adjusted formatting of ngettext docs code examples.
This commit is contained in:
parent
98e05ccde4
commit
62f477d171
@ -204,7 +204,8 @@ For example::
|
|||||||
page = ngettext(
|
page = ngettext(
|
||||||
'there is %(count)d object',
|
'there is %(count)d object',
|
||||||
'there are %(count)d objects',
|
'there are %(count)d objects',
|
||||||
count) % {
|
count,
|
||||||
|
) % {
|
||||||
'count': count,
|
'count': count,
|
||||||
}
|
}
|
||||||
return HttpResponse(page)
|
return HttpResponse(page)
|
||||||
@ -228,7 +229,7 @@ sophisticated, but will produce incorrect results for some languages::
|
|||||||
text = ngettext(
|
text = ngettext(
|
||||||
'There is %(count)d %(name)s available.',
|
'There is %(count)d %(name)s available.',
|
||||||
'There are %(count)d %(name)s available.',
|
'There are %(count)d %(name)s available.',
|
||||||
count
|
count,
|
||||||
) % {
|
) % {
|
||||||
'count': count,
|
'count': count,
|
||||||
'name': name
|
'name': name
|
||||||
@ -240,7 +241,7 @@ In a case like this, consider something like the following::
|
|||||||
text = ngettext(
|
text = ngettext(
|
||||||
'There is %(count)d %(name)s object available.',
|
'There is %(count)d %(name)s object available.',
|
||||||
'There are %(count)d %(name)s objects available.',
|
'There are %(count)d %(name)s objects available.',
|
||||||
count
|
count,
|
||||||
) % {
|
) % {
|
||||||
'count': count,
|
'count': count,
|
||||||
'name': Report._meta.verbose_name,
|
'name': Report._meta.verbose_name,
|
||||||
@ -259,11 +260,11 @@ In a case like this, consider something like the following::
|
|||||||
text = ngettext(
|
text = ngettext(
|
||||||
'There is %(count)d %(name)s available.',
|
'There is %(count)d %(name)s available.',
|
||||||
'There are %(count)d %(plural_name)s available.',
|
'There are %(count)d %(plural_name)s available.',
|
||||||
count
|
count,
|
||||||
) % {
|
) % {
|
||||||
'count': Report.objects.count(),
|
'count': Report.objects.count(),
|
||||||
'name': Report._meta.verbose_name,
|
'name': Report._meta.verbose_name,
|
||||||
'plural_name': Report._meta.verbose_name_plural
|
'plural_name': Report._meta.verbose_name_plural,
|
||||||
}
|
}
|
||||||
|
|
||||||
You would get an error when running :djadmin:`django-admin
|
You would get an error when running :djadmin:`django-admin
|
||||||
|
Loading…
Reference in New Issue
Block a user