I'm attempting to sort a list of strings in a locale-aware manner. I've used the Babel library for other i18n-related tasks, but it doesn't support sorting. Python's locale
module provides a strcoll
function, but requires the locale of the process to be set to the one I want to work with. Kind of a pain, but I can live with it.
The problem is that I can't seem to actually set the locale. The documentation for the locale
module gives this example:
import locale
locale.setlocale(locale.LC_ALL, 'de_DE')
When I run that, I get this:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python26\Lib\locale.py", line 494, in setlocale
locale.Error: unsupported locale setting
What am I doing wrong?