On Sat, May 3, 2008 at 5:39 AM, [EMAIL PROTECTED] <[EMAIL PROTECTED]>
wrote:

> Could someone please be kind to explain to me how the pluralize logic
> works in django?
> a.) pluralize template filter


Doc for this is here:
http://www.djangoproject.com/documentation/templates/#pluralize


> b.) Meta.verbose_name_plural
>

Doc for this is here:
http://www.djangoproject.com/documentation/model-api/#verbose-name-plural


> As default, I am expecting the pluralize to convert "country" to
> "countries". For exapmle, this doesn't happen in admin so I define the
> verbose_name_plural in the Meta inner class.
>

Per the doc, the default pluralize (filter) behavior is to simply add an s.
If that is not correct for the word in question, then you have to tell the
filter what the correct suffix is.  The doc also has an example of how to
specify that pluralize should change a -y to an -ies.

For the model's verbose plural name, again the doc states the default
behavior is to add an s.  If that isn't correct, then you need to specify
verbose_name_plural, as you have.


> Its straightforward to implement a function that can seemlessly handle
> this correctly as default, even if it was to read the pluralization
> rules from a rules.<language_code> files or something equivalent.
>

Is it?  Maybe.  I don't know if anyone has proposed smartening-up Django's
pluralization rules in the past (I'm not even sure if you are proposing it
here?).  My gut feeling is it's probably something that has lots of
exceptions/special cases that would make it hard to get entirely right,
particularly for all languages, but maybe I'm unduly pessimistic.

Karen

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to