#5425: [newforms-admin] - incorrect plurals in admin pagination template
-----------------------------------------------------+----------------------
Reporter: Petr Marhoun <[EMAIL PROTECTED]> | Owner: nobody
Status: reopened | Component:
Admin interface
Version: newforms-admin | Resolution:
Keywords: admin, internationalization | Stage:
Design decision needed
Has_patch: 1 | Needs_docs: 0
Needs_tests: 0 | Needs_better_patch: 0
-----------------------------------------------------+----------------------
Changes (by Petr Marhoun <[EMAIL PROTECTED]>):
* keywords: admin, templates, pagination => admin, internationalization
* status: closed => reopened
* resolution: duplicate =>
* summary: [newforms-admin] - more flexible pagination template => [
newforms-admin] - incorrect plurals in admin
pagination template
Comment:
I don't understand what exactly you propose. I suppose I have this model:
{{{
#!python
class Object(models.Model):
# ...
class Meta:
verbose_name = _('object')
verbose_name_plural = _('object')
}}}
If the current code would be in python, it would be something as:
{{{
#!python
if n == 1:
text = '%i %s' % (count, verbose_name)
else:
text = '%i %s' % (count, verbose_name_plural)
}}}
The result is:
* 1 object; 2 objects; 5 objects - ok in English
* 1 objekt; 2 objekty; 10 objekty - not ok in Czech
* 1 объект; 2 объекта; 10 объекта - probably not ok in Russian
I propose this little change:
{{{
#!python
if n == 1:
text = _('%{count}i %{verbose_name}s') % {'count': count,
'verbose_name': verbose_name}
else:
text = _('%{count}i %{verbose_name_plural}s') % {'count': count,
'verbose_name_plural': verbose_name_plural}
}}}
After translation the result would be:
* 1 object; 2 objects; 5 objects - ok in English
* Objekt: 1; Objekty: 2; Objekty: 10 - quite ok in Czech
* Oбъект: 1; Oбъекта: 2; Oбъекта: 10 - maybe quite ok in Russian
I tried another solution:
{{{
#!python
class Object(models.Model):
# ...
class Meta:
verbose_name = lambda n: ungettext('object', 'objects', n) % {'n'
: n}
}}}
Then I changed django.db.models.options.Options to check if verbose_name
was function. It worked and it was backward-compatible but I think that
this problem doesn't deserve such complex solution.
So I try to imagine which patch you propose. Should make-messages.py be
smarted? I think it is possible - expressions in models after verbose_name
would be considered as pluralized messages. Options class and template
would count with it. But is it worth? Is my solution really not good
enough for Russian?
--
Ticket URL: <http://code.djangoproject.com/ticket/5425#comment:7>
Django Code <http://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 post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---