diff options
| author | Matthias Kestenholz <mk@feinheit.ch> | 2020-12-08 12:09:59 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-12-08 12:09:59 +0100 |
| commit | 62f477d1712575f831e96e6868ed1d96030601be (patch) | |
| tree | 7dfe8d104a6330771587c4ada3e5dc8e1455b0d0 /docs | |
| parent | 98e05ccde440cc9b768952cc10bc8285f4924e1f (diff) | |
Adjusted formatting of ngettext docs code examples.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/topics/i18n/translation.txt | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/docs/topics/i18n/translation.txt b/docs/topics/i18n/translation.txt index 4f0c3f66e7..7a7bf85ebc 100644 --- a/docs/topics/i18n/translation.txt +++ b/docs/topics/i18n/translation.txt @@ -204,7 +204,8 @@ For example:: page = ngettext( 'there is %(count)d object', 'there are %(count)d objects', - count) % { + count, + ) % { 'count': count, } return HttpResponse(page) @@ -228,7 +229,7 @@ sophisticated, but will produce incorrect results for some languages:: text = ngettext( 'There is %(count)d %(name)s available.', 'There are %(count)d %(name)s available.', - count + count, ) % { 'count': count, 'name': name @@ -240,7 +241,7 @@ In a case like this, consider something like the following:: text = ngettext( 'There is %(count)d %(name)s object available.', 'There are %(count)d %(name)s objects available.', - count + count, ) % { 'count': count, 'name': Report._meta.verbose_name, @@ -259,11 +260,11 @@ In a case like this, consider something like the following:: text = ngettext( 'There is %(count)d %(name)s available.', 'There are %(count)d %(plural_name)s available.', - count + count, ) % { 'count': Report.objects.count(), '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 |
