Let’s take a list of countries that was originally alphabetized in English, but is now translated to French.
1 2 3 4 5 6 |
|
You can see the incorrect sort order for Germany (“Allemagne”) and the US (“États-Unis”).
Running the standard javascript Array.sort()
will sort it according to the American English language:
1 2 3 4 5 6 7 8 |
|
Note the misplacement of the last three entries. A real internationalized sort of this would be a huge motherbitch to implement, but here is a quick and hacky way to get your ducks in order:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
|
It’s not perfect (I bet that “la Suède” should actually be in the S’s), but it’ll get you a bit closer without too much effort.
2009.10.29: A much better method:
1 2 3 4 |
|