Michael P. Jung escreveu:
> The collation for other languages than English is not that simple.
>
> e.g. the German Umlaut "ä" is often seen equivalent to "ae" when
> ordering lists. Thus a list like [u'baf', u'bäx', u'baz'] would be
> sorted [u'bäx', u'baf', u'baz']. There are even some collations that
> just treat 'ä' as an 'a' and some that order 'a' < 'ä'.
>
> In short: The ordering should depend on the locale being used and not on
> some .lower() magic.
>
>
> Ordering strings depending on the language, hat's what locale.strcoll is
> good for:
>
> http://code.activestate.com/recipes/442492/
>
> And don't just use locale.strxfrm as suggested in the user comments
> because it is buggy in python 2.5 and doesn't work with unicode strings:
>
> http://bugs.python.org/issue2481
>
>
> Maybe django should provide a function inside
> the django.utils module and provide sorting based on the current locale
> and/or language of the current request. I guess it's an often made
> mistake to just rely on the string ordering while in reality wanting
> ordering based on the locale.
>
>
> --mp
Great post Michael, i did a python module to do that, and i called the
function isorted (but its principle can be used in a django filter too).
Here is the code:
http://pastebin.com/f1ecba5c7
Please, if you have any comments on how to improve it, or if i have to
do something to add it to django (im a newbie in django core
development) just say it and im sure to do my best.
Also sent this to Marinho to see if we could put in django-plus.
Thanks a lot and i really hope that we can find a way to improve this in
django.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to
django-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/django-developers?hl=en
-~--~~~~--~~--~--~---