Using a locale-dependent sorting function in Ruby/Rails
- by knuton
What is a good approach to sorting an array of strings in accordance with the current locale?
For example the standard Array#sort puts "Ä" after "Z", which is not correct in German.
I would have expected the gem I18n to offer a hook for defining my own sorting algorithms or providing collation strings or objects. In my imagination, passing this proc or string to the sort function, would make it behave as necessary. I know that this is possible in Python, for example.
Google has not helped me this time. Can you?
Any advice appreciated!