title: What is the correct way to set Python's locale on Windows?
body: <p>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 <code>locale</code> module provides a <code>strcoll</code> 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.</p>
  
  <p>The problem is that I can't seem to actually set the locale.  The <a href="http://docs.python.org/library/locale.html" rel="noreferrer">documentation</a> for the <code>locale</code> module gives this example:</p>
  
  <pre><code>import locale
  locale.setlocale(locale.LC_ALL, 'de_DE')
  </code></pre>
  
  <p>When I run that, I get this:</p>
  
  <pre><code>Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
    File "C:\Python26\Lib\locale.py", line 494, in setlocale
  locale.Error: unsupported locale setting
  </code></pre>
  
  <p>What am I doing wrong?</p>