> Is it?  Maybe.  I don't know if anyone has proposed smartening-up Django's
> pluralization rules in the past

I had a look through the mailing-list archive and couldn't spot
anything directly related.

> (I'm not even sure if you are proposing it
> here?).

I pretty much am proposing it here. I wanted to confirm my
understanding of how the pluralize logic currently works in Django.

> 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.
>

Example of some exceptions/special cases are irregular plural nouns.
However, as default pluralize function, I believe we can handle a lot
more cases compared to the current functionality.
Also, by looking at having language specific rules files (maybe
linking this into the internationalization logic), we can quite easily
train the pluralize function to handle more exceptions/special cases
too without needing to modify the source code (decoupling the rules
from the source code, pluralize function).

The code to enhance the pluralize function is pretty straightforward.
I have already implemented this functionality in my own code base that
I would be happy to share. (I can create a patch/diff if there would
be interest.)


Regards,
-Alen

On May 3, 9:52 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> 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-pl...
>
> > 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