Summary: Affiliates: Sort order of lang and country select should use unicode → Affiliates: Sort order of lang and country select should be unicode aware
Okay the languages are not sorted at all currently (wrong, but I spare you the details), this can be fixed with something like: sorted(d.items(), key=lambda x: x) For unicode-aware sorting, you could do something like this: import locale sorted(c, cmp=lambda x, y: locale.strcoll(x, y)) Obviously more expensive. Also note that there are indications that this does not work on OSX, but on Linux.
If this will take you longer than two minutes to debug, I suggest running the countries through sorted (first command) as well, and leave the unicode-aware sorting as an improvement for a later time. Unicode-aware sorting is hard, let's not block the release on it.
For reference: Discussion on how it *can* work: <http://stackoverflow.com/questions/1097908/how-do-i-sort-unicode-strings-alphabetically-in-python> and that it won't on OSX: <http://stackoverflow.com/questions/3412933/python-not-sorting-unicode-properly-strcoll-doesnt-help>
Commit pushed to https://github.com/mozilla/affiliates https://github.com/mozilla/affiliates/commit/ef5f9a46fbfa450997c63ef5284546b82d2d9106 Unicode-aware sort language and country lists. bug 687667
I agree with Fred. We tried using strcoll, but the sorting doesn't work right. As it is the lists are both sorted by the byte value of the text, so any sorting issues are ones that users may have run into before on other sites and shouldn't be a huge deal. cmore: Can we call this fixed and make true unicode sorting a 1.1 goal?
mkelly: yup, sounds good. We can call this fixed and I will open up another bug for unicode sorting and put it for 1.1.
Status: NEW → RESOLVED
Last Resolved: 8 years ago
Resolution: --- → FIXED
Created attachment 568226 [details] profile edit page. Verified on prod. The sort order for countries on the profile edit page is correct. Bug for updating to cover unicode sort is here: bug 690932.
Product: Firefox Affiliates → Firefox Affiliates Graveyard
You need to log in before you can comment on or make changes to this bug.