#36681: blocktranslate count plural example does not work for all languages
(e.g.
French 0 case)
-------------------------------------+-------------------------------------
Reporter: Sarah Boyce | Type:
| Cleanup/optimization
Status: new | Component:
| Documentation
Version: 5.2 | Severity: Normal
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
https://docs.djangoproject.com/en/5.2/topics/i18n/translation
/#blocktranslate-template-tag
In the blocktranslate docs, there is the following example:
{{{
{% blocktranslate count counter=list|length %}
There is only one {{ name }} object.
{% plural %}
There are {{ counter }} {{ name }} objects.
{% endblocktranslate %}
}}}
If `list` can be empty, the 0 case (which is plural in English) is not
plural in all languages. 0 cats, 1 cat, 2 cats, 3 cats is 0 chat, 1 chat,
2 chats, 3 chats in French (notice that 0 is singular).
This means that the 0 case would say the French translation of `There is
only one {{ name }} object.` as 0 is singular in French (and this would be
a bug).
I believe the example should be updated to something like:
{{{
{% blocktranslate count counter=list|length %}
There is {{ counter }} {{ name }} object.
{% plural %}
There are {{ counter }} {{ name }} objects.
{% endblocktranslate %}
}}}
which would not lead to this issue.
Optionally we could add an admonition about plurals in different languages
and that folks shouldn't assume that pluralization works the same as in
English
--
Ticket URL: <https://code.djangoproject.com/ticket/36681>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/django-updates/0107019a0c64ad4a-b53f59ac-5677-46c5-8c2e-97b017658f5f-000000%40eu-central-1.amazonses.com.