mpt, that's a weak definition of 'alphabetically' for most non-Latin
languages.  When the package name translation contains non-Latin
characters, what's the sorting plan?  Even among romance languages,
sorting is trickier than just stripping accents.  From that Unicode
report linked above:

"In French and a few other languages, however, it is the last accent difference 
that determines the order, as in row 2.
Normal Accent Ordering  cote < coté < côte < côté
French Accent Ordering  cote < côte < coté < côté"

Admittedly, that specific example is contrived, but you get my drift.

Again, my favored solution is this:
import PyICU, os
locale = os.environ['LANG'] # TODO: need to strip @ and .UTF-8
collator = PyICU.Collator.createInstance(PyICU.Locale(locale))
list.sort(key=lambda x: collator.getCollationKey(x).getByteArray())

python-pyicu is in main, on the CD.

-- 
Please sort programs in a locale-friendly way
https://bugs.launchpad.net/bugs/427568
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to