Sophie

Sophie

distrib > Mandriva > current > i586 > media > main-updates > by-pkgid > 8f1462e52e1797a02c97073eed0b7f92 > files > 791

python-docs-2.6.5-2.5mdv2010.2.i586.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>23.2. locale — Internationalization services &mdash; Python v2.6.5 documentation</title>
    <link rel="stylesheet" href="../_static/default.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../',
        VERSION:     '2.6.5',
        COLLAPSE_MODINDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../_static/jquery.js"></script>
    <script type="text/javascript" src="../_static/doctools.js"></script>
    <link rel="search" type="application/opensearchdescription+xml"
          title="Search within Python v2.6.5 documentation"
          href="../_static/opensearch.xml"/>
    <link rel="author" title="About these documents" href="../about.html" />
    <link rel="copyright" title="Copyright" href="../copyright.html" />
    <link rel="top" title="Python v2.6.5 documentation" href="../index.html" />
    <link rel="up" title="23. Internationalization" href="i18n.html" />
    <link rel="next" title="24. Program Frameworks" href="frameworks.html" />
    <link rel="prev" title="23.1. gettext — Multilingual internationalization services" href="gettext.html" />
    <link rel="shortcut icon" type="image/png" href="../_static/py.png" />
 

  </head>
  <body>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../modindex.html" title="Global Module Index"
             accesskey="M">modules</a> |</li>
        <li class="right" >
          <a href="frameworks.html" title="24. Program Frameworks"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="gettext.html" title="23.1. gettext — Multilingual internationalization services"
             accesskey="P">previous</a> |</li>
        <li><img src="../_static/py.png" alt=""
                 style="vertical-align: middle; margin-top: -1px"/></li>
        <li><a href="../index.html">Python v2.6.5 documentation</a> &raquo;</li>

          <li><a href="index.html" >The Python Standard Library</a> &raquo;</li>
          <li><a href="i18n.html" accesskey="U">23. Internationalization</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="module-locale">
<h1>23.2. <tt class="xref docutils literal"><span class="pre">locale</span></tt> &#8212; Internationalization services<a class="headerlink" href="#module-locale" title="Permalink to this headline">¶</a></h1>
<p>The <tt class="xref docutils literal"><span class="pre">locale</span></tt> module opens access to the POSIX locale database and
functionality. The POSIX locale mechanism allows programmers to deal with
certain cultural issues in an application, without requiring the programmer to
know all the specifics of each country where the software is executed.</p>
<p id="index-412">The <tt class="xref docutils literal"><span class="pre">locale</span></tt> module is implemented on top of the <tt class="xref docutils literal"><span class="pre">_locale</span></tt> module,
which in turn uses an ANSI C locale implementation if available.</p>
<p>The <tt class="xref docutils literal"><span class="pre">locale</span></tt> module defines the following exception and functions:</p>
<dl class="exception">
<dt id="locale.Error">
<em class="property">exception </em><tt class="descclassname">locale.</tt><tt class="descname">Error</tt><a class="headerlink" href="#locale.Error" title="Permalink to this definition">¶</a></dt>
<dd>Exception raised when <a title="locale.setlocale" class="reference internal" href="#locale.setlocale"><tt class="xref docutils literal"><span class="pre">setlocale()</span></tt></a> fails.</dd></dl>

<dl class="function">
<dt id="locale.setlocale">
<tt class="descclassname">locale.</tt><tt class="descname">setlocale</tt><big>(</big><em>category</em><span class="optional">[</span>, <em>locale</em><span class="optional">]</span><big>)</big><a class="headerlink" href="#locale.setlocale" title="Permalink to this definition">¶</a></dt>
<dd><p>If <em>locale</em> is specified, it may be a string, a tuple of the form <tt class="docutils literal"><span class="pre">(language</span>
<span class="pre">code,</span> <span class="pre">encoding)</span></tt>, or <tt class="xref docutils literal"><span class="pre">None</span></tt>. If it is a tuple, it is converted to a string
using the locale aliasing engine.  If <em>locale</em> is given and not <tt class="xref docutils literal"><span class="pre">None</span></tt>,
<a title="locale.setlocale" class="reference internal" href="#locale.setlocale"><tt class="xref docutils literal"><span class="pre">setlocale()</span></tt></a> modifies the locale setting for the <em>category</em>.  The available
categories are listed in the data description below.  The value is the name of a
locale.  An empty string specifies the user&#8217;s default settings. If the
modification of the locale fails, the exception <a title="locale.Error" class="reference internal" href="#locale.Error"><tt class="xref docutils literal"><span class="pre">Error</span></tt></a> is raised.  If
successful, the new locale setting is returned.</p>
<p>If <em>locale</em> is omitted or <tt class="xref docutils literal"><span class="pre">None</span></tt>, the current setting for <em>category</em> is
returned.</p>
<p><a title="locale.setlocale" class="reference internal" href="#locale.setlocale"><tt class="xref docutils literal"><span class="pre">setlocale()</span></tt></a> is not thread safe on most systems. Applications typically
start with a call of</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">import</span> <span class="nn">locale</span>
<span class="n">locale</span><span class="o">.</span><span class="n">setlocale</span><span class="p">(</span><span class="n">locale</span><span class="o">.</span><span class="n">LC_ALL</span><span class="p">,</span> <span class="s">&#39;&#39;</span><span class="p">)</span>
</pre></div>
</div>
<p>This sets the locale for all categories to the user&#8217;s default setting (typically
specified in the <span class="target" id="index-413"></span><strong class="xref">LANG</strong> environment variable).  If the locale is not
changed thereafter, using multithreading should not cause problems.</p>
<p class="versionchanged">
<span class="versionmodified">Changed in version 2.0: </span>Added support for tuple values of the <em>locale</em> parameter.</p>
</dd></dl>

<dl class="function">
<dt id="locale.localeconv">
<tt class="descclassname">locale.</tt><tt class="descname">localeconv</tt><big>(</big><big>)</big><a class="headerlink" href="#locale.localeconv" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the database of the local conventions as a dictionary. This dictionary
has the following strings as keys:</p>
<table border="1" class="docutils">
<colgroup>
<col width="24%" />
<col width="41%" />
<col width="35%" />
</colgroup>
<thead valign="bottom">
<tr><th class="head">Category</th>
<th class="head">Key</th>
<th class="head">Meaning</th>
</tr>
</thead>
<tbody valign="top">
<tr><td><a title="locale.LC_NUMERIC" class="reference internal" href="#locale.LC_NUMERIC"><tt class="xref docutils literal"><span class="pre">LC_NUMERIC</span></tt></a></td>
<td><tt class="docutils literal"><span class="pre">'decimal_point'</span></tt></td>
<td>Decimal point character.</td>
</tr>
<tr><td>&nbsp;</td>
<td><tt class="docutils literal"><span class="pre">'grouping'</span></tt></td>
<td>Sequence of numbers specifying
which relative positions the
<tt class="docutils literal"><span class="pre">'thousands_sep'</span></tt> is
expected.  If the sequence is
terminated with
<a title="locale.CHAR_MAX" class="reference internal" href="#locale.CHAR_MAX"><tt class="xref docutils literal"><span class="pre">CHAR_MAX</span></tt></a>, no further
grouping is performed. If the
sequence terminates with a
<tt class="docutils literal"><span class="pre">0</span></tt>,  the last group size is
repeatedly used.</td>
</tr>
<tr><td>&nbsp;</td>
<td><tt class="docutils literal"><span class="pre">'thousands_sep'</span></tt></td>
<td>Character used between groups.</td>
</tr>
<tr><td><a title="locale.LC_MONETARY" class="reference internal" href="#locale.LC_MONETARY"><tt class="xref docutils literal"><span class="pre">LC_MONETARY</span></tt></a></td>
<td><tt class="docutils literal"><span class="pre">'int_curr_symbol'</span></tt></td>
<td>International currency symbol.</td>
</tr>
<tr><td>&nbsp;</td>
<td><tt class="docutils literal"><span class="pre">'currency_symbol'</span></tt></td>
<td>Local currency symbol.</td>
</tr>
<tr><td>&nbsp;</td>
<td><tt class="docutils literal"><span class="pre">'p_cs_precedes/n_cs_precedes'</span></tt></td>
<td>Whether the currency symbol
precedes the value (for
positive resp. negative
values).</td>
</tr>
<tr><td>&nbsp;</td>
<td><tt class="docutils literal"><span class="pre">'p_sep_by_space/n_sep_by_space'</span></tt></td>
<td>Whether the currency symbol is
separated from the value  by a
space (for positive resp.
negative values).</td>
</tr>
<tr><td>&nbsp;</td>
<td><tt class="docutils literal"><span class="pre">'mon_decimal_point'</span></tt></td>
<td>Decimal point used for
monetary values.</td>
</tr>
<tr><td>&nbsp;</td>
<td><tt class="docutils literal"><span class="pre">'frac_digits'</span></tt></td>
<td>Number of fractional digits
used in local formatting of
monetary values.</td>
</tr>
<tr><td>&nbsp;</td>
<td><tt class="docutils literal"><span class="pre">'int_frac_digits'</span></tt></td>
<td>Number of fractional digits
used in international
formatting of monetary values.</td>
</tr>
<tr><td>&nbsp;</td>
<td><tt class="docutils literal"><span class="pre">'mon_thousands_sep'</span></tt></td>
<td>Group separator used for
monetary values.</td>
</tr>
<tr><td>&nbsp;</td>
<td><tt class="docutils literal"><span class="pre">'mon_grouping'</span></tt></td>
<td>Equivalent to <tt class="docutils literal"><span class="pre">'grouping'</span></tt>,
used for monetary values.</td>
</tr>
<tr><td>&nbsp;</td>
<td><tt class="docutils literal"><span class="pre">'positive_sign'</span></tt></td>
<td>Symbol used to annotate a
positive monetary value.</td>
</tr>
<tr><td>&nbsp;</td>
<td><tt class="docutils literal"><span class="pre">'negative_sign'</span></tt></td>
<td>Symbol used to annotate a
negative monetary value.</td>
</tr>
<tr><td>&nbsp;</td>
<td><tt class="docutils literal"><span class="pre">'p_sign_posn/n_sign_posn'</span></tt></td>
<td>The position of the sign (for
positive resp. negative
values), see below.</td>
</tr>
</tbody>
</table>
<p>All numeric values can be set to <a title="locale.CHAR_MAX" class="reference internal" href="#locale.CHAR_MAX"><tt class="xref docutils literal"><span class="pre">CHAR_MAX</span></tt></a> to indicate that there is no
value specified in this locale.</p>
<p>The possible values for <tt class="docutils literal"><span class="pre">'p_sign_posn'</span></tt> and <tt class="docutils literal"><span class="pre">'n_sign_posn'</span></tt> are given below.</p>
<table border="1" class="docutils">
<colgroup>
<col width="25%" />
<col width="75%" />
</colgroup>
<thead valign="bottom">
<tr><th class="head">Value</th>
<th class="head">Explanation</th>
</tr>
</thead>
<tbody valign="top">
<tr><td><tt class="docutils literal"><span class="pre">0</span></tt></td>
<td>Currency and value are surrounded by
parentheses.</td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">1</span></tt></td>
<td>The sign should precede the value and
currency symbol.</td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">2</span></tt></td>
<td>The sign should follow the value and
currency symbol.</td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">3</span></tt></td>
<td>The sign should immediately precede the
value.</td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">4</span></tt></td>
<td>The sign should immediately follow the
value.</td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">CHAR_MAX</span></tt></td>
<td>Nothing is specified in this locale.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="locale.nl_langinfo">
<tt class="descclassname">locale.</tt><tt class="descname">nl_langinfo</tt><big>(</big><em>option</em><big>)</big><a class="headerlink" href="#locale.nl_langinfo" title="Permalink to this definition">¶</a></dt>
<dd><p>Return some locale-specific information as a string.  This function is not
available on all systems, and the set of possible options might also vary
across platforms.  The possible argument values are numbers, for which
symbolic constants are available in the locale module.</p>
<p>The <a title="locale.nl_langinfo" class="reference internal" href="#locale.nl_langinfo"><tt class="xref docutils literal"><span class="pre">nl_langinfo()</span></tt></a> function accepts one of the following keys.  Most
descriptions are taken from the corresponding description in the GNU C
library.</p>
<dl class="data">
<dt id="locale.CODESET">
<tt class="descclassname">locale.</tt><tt class="descname">CODESET</tt><a class="headerlink" href="#locale.CODESET" title="Permalink to this definition">¶</a></dt>
<dd>Get a string with the name of the character encoding used in the
selected locale.</dd></dl>

<dl class="data">
<dt id="locale.D_T_FMT">
<tt class="descclassname">locale.</tt><tt class="descname">D_T_FMT</tt><a class="headerlink" href="#locale.D_T_FMT" title="Permalink to this definition">¶</a></dt>
<dd>Get a string that can be used as a format string for <tt class="xref docutils literal"><span class="pre">strftime()</span></tt> to
represent time and date in a locale-specific way.</dd></dl>

<dl class="data">
<dt id="locale.D_FMT">
<tt class="descclassname">locale.</tt><tt class="descname">D_FMT</tt><a class="headerlink" href="#locale.D_FMT" title="Permalink to this definition">¶</a></dt>
<dd>Get a string that can be used as a format string for <tt class="xref docutils literal"><span class="pre">strftime()</span></tt> to
represent a date in a locale-specific way.</dd></dl>

<dl class="data">
<dt id="locale.T_FMT">
<tt class="descclassname">locale.</tt><tt class="descname">T_FMT</tt><a class="headerlink" href="#locale.T_FMT" title="Permalink to this definition">¶</a></dt>
<dd>Get a string that can be used as a format string for <tt class="xref docutils literal"><span class="pre">strftime()</span></tt> to
represent a time in a locale-specific way.</dd></dl>

<dl class="data">
<dt id="locale.T_FMT_AMPM">
<tt class="descclassname">locale.</tt><tt class="descname">T_FMT_AMPM</tt><a class="headerlink" href="#locale.T_FMT_AMPM" title="Permalink to this definition">¶</a></dt>
<dd>Get a format string for <tt class="xref docutils literal"><span class="pre">strftime()</span></tt> to represent time in the am/pm
format.</dd></dl>

<dl class="data">
<dt>
<tt class="descname">DAY_1 ... DAY_7</tt></dt>
<dd><p>Get the name of the n-th day of the week.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">This follows the US convention of <tt class="xref docutils literal"><span class="pre">DAY_1</span></tt> being Sunday, not the
international convention (ISO 8601) that Monday is the first day of the
week.</p>
</div>
</dd></dl>

<dl class="data">
<dt>
<tt class="descname">ABDAY_1 ... ABDAY_7</tt></dt>
<dd>Get the abbreviated name of the n-th day of the week.</dd></dl>

<dl class="data">
<dt>
<tt class="descname">MON_1 ... MON_12</tt></dt>
<dd>Get the name of the n-th month.</dd></dl>

<dl class="data">
<dt>
<tt class="descname">ABMON_1 ... ABMON_12</tt></dt>
<dd>Get the abbreviated name of the n-th month.</dd></dl>

<dl class="data">
<dt id="locale.RADIXCHAR">
<tt class="descclassname">locale.</tt><tt class="descname">RADIXCHAR</tt><a class="headerlink" href="#locale.RADIXCHAR" title="Permalink to this definition">¶</a></dt>
<dd>Get the radix character (decimal dot, decimal comma, etc.)</dd></dl>

<dl class="data">
<dt id="locale.THOUSEP">
<tt class="descclassname">locale.</tt><tt class="descname">THOUSEP</tt><a class="headerlink" href="#locale.THOUSEP" title="Permalink to this definition">¶</a></dt>
<dd>Get the separator character for thousands (groups of three digits).</dd></dl>

<dl class="data">
<dt id="locale.YESEXPR">
<tt class="descclassname">locale.</tt><tt class="descname">YESEXPR</tt><a class="headerlink" href="#locale.YESEXPR" title="Permalink to this definition">¶</a></dt>
<dd><p>Get a regular expression that can be used with the regex function to
recognize a positive response to a yes/no question.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">The expression is in the syntax suitable for the <tt class="xref docutils literal"><span class="pre">regex()</span></tt> function
from the C library, which might differ from the syntax used in <a title="Regular expression operations." class="reference external" href="re.html#module-re"><tt class="xref docutils literal"><span class="pre">re</span></tt></a>.</p>
</div>
</dd></dl>

<dl class="data">
<dt id="locale.NOEXPR">
<tt class="descclassname">locale.</tt><tt class="descname">NOEXPR</tt><a class="headerlink" href="#locale.NOEXPR" title="Permalink to this definition">¶</a></dt>
<dd>Get a regular expression that can be used with the regex(3) function to
recognize a negative response to a yes/no question.</dd></dl>

<dl class="data">
<dt id="locale.CRNCYSTR">
<tt class="descclassname">locale.</tt><tt class="descname">CRNCYSTR</tt><a class="headerlink" href="#locale.CRNCYSTR" title="Permalink to this definition">¶</a></dt>
<dd>Get the currency symbol, preceded by &#8220;-&#8221; if the symbol should appear before
the value, &#8220;+&#8221; if the symbol should appear after the value, or &#8220;.&#8221; if the
symbol should replace the radix character.</dd></dl>

<dl class="data">
<dt id="locale.ERA">
<tt class="descclassname">locale.</tt><tt class="descname">ERA</tt><a class="headerlink" href="#locale.ERA" title="Permalink to this definition">¶</a></dt>
<dd><p>Get a string that represents the era used in the current locale.</p>
<p>Most locales do not define this value.  An example of a locale which does
define this value is the Japanese one.  In Japan, the traditional
representation of dates includes the name of the era corresponding to the
then-emperor&#8217;s reign.</p>
<p>Normally it should not be necessary to use this value directly. Specifying
the <tt class="docutils literal"><span class="pre">E</span></tt> modifier in their format strings causes the <tt class="xref docutils literal"><span class="pre">strftime()</span></tt>
function to use this information.  The format of the returned string is not
specified, and therefore you should not assume knowledge of it on different
systems.</p>
</dd></dl>

<dl class="data">
<dt id="locale.ERA_YEAR">
<tt class="descclassname">locale.</tt><tt class="descname">ERA_YEAR</tt><a class="headerlink" href="#locale.ERA_YEAR" title="Permalink to this definition">¶</a></dt>
<dd>Get the year in the relevant era of the locale.</dd></dl>

<dl class="data">
<dt id="locale.ERA_D_T_FMT">
<tt class="descclassname">locale.</tt><tt class="descname">ERA_D_T_FMT</tt><a class="headerlink" href="#locale.ERA_D_T_FMT" title="Permalink to this definition">¶</a></dt>
<dd>Get a format string for <tt class="xref docutils literal"><span class="pre">strftime()</span></tt> to represent dates and times in a
locale-specific era-based way.</dd></dl>

<dl class="data">
<dt id="locale.ERA_D_FMT">
<tt class="descclassname">locale.</tt><tt class="descname">ERA_D_FMT</tt><a class="headerlink" href="#locale.ERA_D_FMT" title="Permalink to this definition">¶</a></dt>
<dd>Get a format string for <tt class="xref docutils literal"><span class="pre">strftime()</span></tt> to represent time in a
locale-specific era-based way.</dd></dl>

<dl class="data">
<dt id="locale.ALT_DIGITS">
<tt class="descclassname">locale.</tt><tt class="descname">ALT_DIGITS</tt><a class="headerlink" href="#locale.ALT_DIGITS" title="Permalink to this definition">¶</a></dt>
<dd>Get a representation of up to 100 values used to represent the values
0 to 99.</dd></dl>

</dd></dl>

<dl class="function">
<dt id="locale.getdefaultlocale">
<tt class="descclassname">locale.</tt><tt class="descname">getdefaultlocale</tt><big>(</big><span class="optional">[</span><em>envvars</em><span class="optional">]</span><big>)</big><a class="headerlink" href="#locale.getdefaultlocale" title="Permalink to this definition">¶</a></dt>
<dd><p>Tries to determine the default locale settings and returns them as a tuple of
the form <tt class="docutils literal"><span class="pre">(language</span> <span class="pre">code,</span> <span class="pre">encoding)</span></tt>.</p>
<p>According to POSIX, a program which has not called <tt class="docutils literal"><span class="pre">setlocale(LC_ALL,</span> <span class="pre">'')</span></tt>
runs using the portable <tt class="docutils literal"><span class="pre">'C'</span></tt> locale.  Calling <tt class="docutils literal"><span class="pre">setlocale(LC_ALL,</span> <span class="pre">'')</span></tt> lets
it use the default locale as defined by the <span class="target" id="index-414"></span><strong class="xref">LANG</strong> variable.  Since we
do not want to interfere with the current locale setting we thus emulate the
behavior in the way described above.</p>
<p>To maintain compatibility with other platforms, not only the <span class="target" id="index-415"></span><strong class="xref">LANG</strong>
variable is tested, but a list of variables given as envvars parameter.  The
first found to be defined will be used.  <em>envvars</em> defaults to the search path
used in GNU gettext; it must always contain the variable name <tt class="docutils literal"><span class="pre">LANG</span></tt>.  The GNU
gettext search path contains <tt class="docutils literal"><span class="pre">'LANGUAGE'</span></tt>, <tt class="docutils literal"><span class="pre">'LC_ALL'</span></tt>, <tt class="docutils literal"><span class="pre">'LC_CTYPE'</span></tt>, and
<tt class="docutils literal"><span class="pre">'LANG'</span></tt>, in that order.</p>
<p>Except for the code <tt class="docutils literal"><span class="pre">'C'</span></tt>, the language code corresponds to <span class="target" id="index-416"></span><a class="reference external" href="http://tools.ietf.org/html/rfc1766.html"><strong>RFC 1766</strong></a>.
<em>language code</em> and <em>encoding</em> may be <tt class="xref docutils literal"><span class="pre">None</span></tt> if their values cannot be
determined.</p>
<p class="versionadded">
<span class="versionmodified">New in version 2.0.</span></p>
</dd></dl>

<dl class="function">
<dt id="locale.getlocale">
<tt class="descclassname">locale.</tt><tt class="descname">getlocale</tt><big>(</big><span class="optional">[</span><em>category</em><span class="optional">]</span><big>)</big><a class="headerlink" href="#locale.getlocale" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the current setting for the given locale category as sequence containing
<em>language code</em>, <em>encoding</em>. <em>category</em> may be one of the <tt class="xref docutils literal"><span class="pre">LC_*</span></tt> values
except <a title="locale.LC_ALL" class="reference internal" href="#locale.LC_ALL"><tt class="xref docutils literal"><span class="pre">LC_ALL</span></tt></a>.  It defaults to <a title="locale.LC_CTYPE" class="reference internal" href="#locale.LC_CTYPE"><tt class="xref docutils literal"><span class="pre">LC_CTYPE</span></tt></a>.</p>
<p>Except for the code <tt class="docutils literal"><span class="pre">'C'</span></tt>, the language code corresponds to <span class="target" id="index-417"></span><a class="reference external" href="http://tools.ietf.org/html/rfc1766.html"><strong>RFC 1766</strong></a>.
<em>language code</em> and <em>encoding</em> may be <tt class="xref docutils literal"><span class="pre">None</span></tt> if their values cannot be
determined.</p>
<p class="versionadded">
<span class="versionmodified">New in version 2.0.</span></p>
</dd></dl>

<dl class="function">
<dt id="locale.getpreferredencoding">
<tt class="descclassname">locale.</tt><tt class="descname">getpreferredencoding</tt><big>(</big><span class="optional">[</span><em>do_setlocale</em><span class="optional">]</span><big>)</big><a class="headerlink" href="#locale.getpreferredencoding" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the encoding used for text data, according to user preferences.  User
preferences are expressed differently on different systems, and might not be
available programmatically on some systems, so this function only returns a
guess.</p>
<p>On some systems, it is necessary to invoke <a title="locale.setlocale" class="reference internal" href="#locale.setlocale"><tt class="xref docutils literal"><span class="pre">setlocale()</span></tt></a> to obtain the user
preferences, so this function is not thread-safe. If invoking setlocale is not
necessary or desired, <em>do_setlocale</em> should be set to <tt class="xref docutils literal"><span class="pre">False</span></tt>.</p>
<p class="versionadded">
<span class="versionmodified">New in version 2.3.</span></p>
</dd></dl>

<dl class="function">
<dt id="locale.normalize">
<tt class="descclassname">locale.</tt><tt class="descname">normalize</tt><big>(</big><em>localename</em><big>)</big><a class="headerlink" href="#locale.normalize" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns a normalized locale code for the given locale name.  The returned locale
code is formatted for use with <a title="locale.setlocale" class="reference internal" href="#locale.setlocale"><tt class="xref docutils literal"><span class="pre">setlocale()</span></tt></a>.  If normalization fails, the
original name is returned unchanged.</p>
<p>If the given encoding is not known, the function defaults to the default
encoding for the locale code just like <a title="locale.setlocale" class="reference internal" href="#locale.setlocale"><tt class="xref docutils literal"><span class="pre">setlocale()</span></tt></a>.</p>
<p class="versionadded">
<span class="versionmodified">New in version 2.0.</span></p>
</dd></dl>

<dl class="function">
<dt id="locale.resetlocale">
<tt class="descclassname">locale.</tt><tt class="descname">resetlocale</tt><big>(</big><span class="optional">[</span><em>category</em><span class="optional">]</span><big>)</big><a class="headerlink" href="#locale.resetlocale" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the locale for <em>category</em> to the default setting.</p>
<p>The default setting is determined by calling <a title="locale.getdefaultlocale" class="reference internal" href="#locale.getdefaultlocale"><tt class="xref docutils literal"><span class="pre">getdefaultlocale()</span></tt></a>.
<em>category</em> defaults to <a title="locale.LC_ALL" class="reference internal" href="#locale.LC_ALL"><tt class="xref docutils literal"><span class="pre">LC_ALL</span></tt></a>.</p>
<p class="versionadded">
<span class="versionmodified">New in version 2.0.</span></p>
</dd></dl>

<dl class="function">
<dt id="locale.strcoll">
<tt class="descclassname">locale.</tt><tt class="descname">strcoll</tt><big>(</big><em>string1</em>, <em>string2</em><big>)</big><a class="headerlink" href="#locale.strcoll" title="Permalink to this definition">¶</a></dt>
<dd>Compares two strings according to the current <a title="locale.LC_COLLATE" class="reference internal" href="#locale.LC_COLLATE"><tt class="xref docutils literal"><span class="pre">LC_COLLATE</span></tt></a> setting. As
any other compare function, returns a negative, or a positive value, or <tt class="docutils literal"><span class="pre">0</span></tt>,
depending on whether <em>string1</em> collates before or after <em>string2</em> or is equal to
it.</dd></dl>

<dl class="function">
<dt id="locale.strxfrm">
<tt class="descclassname">locale.</tt><tt class="descname">strxfrm</tt><big>(</big><em>string</em><big>)</big><a class="headerlink" href="#locale.strxfrm" title="Permalink to this definition">¶</a></dt>
<dd><p id="index-418">Transforms a string to one that can be used for the built-in function
<a title="cmp" class="reference external" href="functions.html#cmp"><tt class="xref docutils literal"><span class="pre">cmp()</span></tt></a>, and still returns locale-aware results.  This function can be used
when the same string is compared repeatedly, e.g. when collating a sequence of
strings.</p>
</dd></dl>

<dl class="function">
<dt id="locale.format">
<tt class="descclassname">locale.</tt><tt class="descname">format</tt><big>(</big><em>format</em>, <em>val</em><span class="optional">[</span>, <em>grouping</em><span class="optional">[</span>, <em>monetary</em><span class="optional">]</span><span class="optional">]</span><big>)</big><a class="headerlink" href="#locale.format" title="Permalink to this definition">¶</a></dt>
<dd><p>Formats a number <em>val</em> according to the current <a title="locale.LC_NUMERIC" class="reference internal" href="#locale.LC_NUMERIC"><tt class="xref docutils literal"><span class="pre">LC_NUMERIC</span></tt></a> setting.
The format follows the conventions of the <tt class="docutils literal"><span class="pre">%</span></tt> operator.  For floating point
values, the decimal point is modified if appropriate.  If <em>grouping</em> is true,
also takes the grouping into account.</p>
<p>If <em>monetary</em> is true, the conversion uses monetary thousands separator and
grouping strings.</p>
<p>Please note that this function will only work for exactly one %char specifier.
For whole format strings, use <a title="locale.format_string" class="reference internal" href="#locale.format_string"><tt class="xref docutils literal"><span class="pre">format_string()</span></tt></a>.</p>
<p class="versionchanged">
<span class="versionmodified">Changed in version 2.5: </span>Added the <em>monetary</em> parameter.</p>
</dd></dl>

<dl class="function">
<dt id="locale.format_string">
<tt class="descclassname">locale.</tt><tt class="descname">format_string</tt><big>(</big><em>format</em>, <em>val</em><span class="optional">[</span>, <em>grouping</em><span class="optional">]</span><big>)</big><a class="headerlink" href="#locale.format_string" title="Permalink to this definition">¶</a></dt>
<dd><p>Processes formatting specifiers as in <tt class="docutils literal"><span class="pre">format</span> <span class="pre">%</span> <span class="pre">val</span></tt>, but takes the current
locale settings into account.</p>
<p class="versionadded">
<span class="versionmodified">New in version 2.5.</span></p>
</dd></dl>

<dl class="function">
<dt id="locale.currency">
<tt class="descclassname">locale.</tt><tt class="descname">currency</tt><big>(</big><em>val</em><span class="optional">[</span>, <em>symbol</em><span class="optional">[</span>, <em>grouping</em><span class="optional">[</span>, <em>international</em><span class="optional">]</span><span class="optional">]</span><span class="optional">]</span><big>)</big><a class="headerlink" href="#locale.currency" title="Permalink to this definition">¶</a></dt>
<dd><p>Formats a number <em>val</em> according to the current <a title="locale.LC_MONETARY" class="reference internal" href="#locale.LC_MONETARY"><tt class="xref docutils literal"><span class="pre">LC_MONETARY</span></tt></a> settings.</p>
<p>The returned string includes the currency symbol if <em>symbol</em> is true, which is
the default. If <em>grouping</em> is true (which is not the default), grouping is done
with the value. If <em>international</em> is true (which is not the default), the
international currency symbol is used.</p>
<p>Note that this function will not work with the &#8216;C&#8217; locale, so you have to set a
locale via <a title="locale.setlocale" class="reference internal" href="#locale.setlocale"><tt class="xref docutils literal"><span class="pre">setlocale()</span></tt></a> first.</p>
<p class="versionadded">
<span class="versionmodified">New in version 2.5.</span></p>
</dd></dl>

<dl class="function">
<dt id="locale.str">
<tt class="descclassname">locale.</tt><tt class="descname">str</tt><big>(</big><em>float</em><big>)</big><a class="headerlink" href="#locale.str" title="Permalink to this definition">¶</a></dt>
<dd>Formats a floating point number using the same format as the built-in function
<tt class="docutils literal"><span class="pre">str(float)</span></tt>, but takes the decimal point into account.</dd></dl>

<dl class="function">
<dt id="locale.atof">
<tt class="descclassname">locale.</tt><tt class="descname">atof</tt><big>(</big><em>string</em><big>)</big><a class="headerlink" href="#locale.atof" title="Permalink to this definition">¶</a></dt>
<dd>Converts a string to a floating point number, following the <a title="locale.LC_NUMERIC" class="reference internal" href="#locale.LC_NUMERIC"><tt class="xref docutils literal"><span class="pre">LC_NUMERIC</span></tt></a>
settings.</dd></dl>

<dl class="function">
<dt id="locale.atoi">
<tt class="descclassname">locale.</tt><tt class="descname">atoi</tt><big>(</big><em>string</em><big>)</big><a class="headerlink" href="#locale.atoi" title="Permalink to this definition">¶</a></dt>
<dd>Converts a string to an integer, following the <a title="locale.LC_NUMERIC" class="reference internal" href="#locale.LC_NUMERIC"><tt class="xref docutils literal"><span class="pre">LC_NUMERIC</span></tt></a> conventions.</dd></dl>

<dl class="data">
<dt id="locale.LC_CTYPE">
<tt class="descclassname">locale.</tt><tt class="descname">LC_CTYPE</tt><a class="headerlink" href="#locale.LC_CTYPE" title="Permalink to this definition">¶</a></dt>
<dd><p id="index-419">Locale category for the character type functions.  Depending on the settings of
this category, the functions of module <a title="Common string operations." class="reference external" href="string.html#module-string"><tt class="xref docutils literal"><span class="pre">string</span></tt></a> dealing with case change
their behaviour.</p>
</dd></dl>

<dl class="data">
<dt id="locale.LC_COLLATE">
<tt class="descclassname">locale.</tt><tt class="descname">LC_COLLATE</tt><a class="headerlink" href="#locale.LC_COLLATE" title="Permalink to this definition">¶</a></dt>
<dd>Locale category for sorting strings.  The functions <a title="locale.strcoll" class="reference internal" href="#locale.strcoll"><tt class="xref docutils literal"><span class="pre">strcoll()</span></tt></a> and
<a title="locale.strxfrm" class="reference internal" href="#locale.strxfrm"><tt class="xref docutils literal"><span class="pre">strxfrm()</span></tt></a> of the <tt class="xref docutils literal"><span class="pre">locale</span></tt> module are affected.</dd></dl>

<dl class="data">
<dt id="locale.LC_TIME">
<tt class="descclassname">locale.</tt><tt class="descname">LC_TIME</tt><a class="headerlink" href="#locale.LC_TIME" title="Permalink to this definition">¶</a></dt>
<dd>Locale category for the formatting of time.  The function <a title="time.strftime" class="reference external" href="time.html#time.strftime"><tt class="xref docutils literal"><span class="pre">time.strftime()</span></tt></a>
follows these conventions.</dd></dl>

<dl class="data">
<dt id="locale.LC_MONETARY">
<tt class="descclassname">locale.</tt><tt class="descname">LC_MONETARY</tt><a class="headerlink" href="#locale.LC_MONETARY" title="Permalink to this definition">¶</a></dt>
<dd>Locale category for formatting of monetary values.  The available options are
available from the <a title="locale.localeconv" class="reference internal" href="#locale.localeconv"><tt class="xref docutils literal"><span class="pre">localeconv()</span></tt></a> function.</dd></dl>

<dl class="data">
<dt id="locale.LC_MESSAGES">
<tt class="descclassname">locale.</tt><tt class="descname">LC_MESSAGES</tt><a class="headerlink" href="#locale.LC_MESSAGES" title="Permalink to this definition">¶</a></dt>
<dd>Locale category for message display. Python currently does not support
application specific locale-aware messages.  Messages displayed by the operating
system, like those returned by <a title="os.strerror" class="reference external" href="os.html#os.strerror"><tt class="xref docutils literal"><span class="pre">os.strerror()</span></tt></a> might be affected by this
category.</dd></dl>

<dl class="data">
<dt id="locale.LC_NUMERIC">
<tt class="descclassname">locale.</tt><tt class="descname">LC_NUMERIC</tt><a class="headerlink" href="#locale.LC_NUMERIC" title="Permalink to this definition">¶</a></dt>
<dd>Locale category for formatting numbers.  The functions <a title="locale.format" class="reference internal" href="#locale.format"><tt class="xref docutils literal"><span class="pre">format()</span></tt></a>,
<a title="locale.atoi" class="reference internal" href="#locale.atoi"><tt class="xref docutils literal"><span class="pre">atoi()</span></tt></a>, <a title="locale.atof" class="reference internal" href="#locale.atof"><tt class="xref docutils literal"><span class="pre">atof()</span></tt></a> and <a title="locale.str" class="reference internal" href="#locale.str"><tt class="xref docutils literal"><span class="pre">str()</span></tt></a> of the <tt class="xref docutils literal"><span class="pre">locale</span></tt> module are
affected by that category.  All other numeric formatting operations are not
affected.</dd></dl>

<dl class="data">
<dt id="locale.LC_ALL">
<tt class="descclassname">locale.</tt><tt class="descname">LC_ALL</tt><a class="headerlink" href="#locale.LC_ALL" title="Permalink to this definition">¶</a></dt>
<dd>Combination of all locale settings.  If this flag is used when the locale is
changed, setting the locale for all categories is attempted. If that fails for
any category, no category is changed at all.  When the locale is retrieved using
this flag, a string indicating the setting for all categories is returned. This
string can be later used to restore the settings.</dd></dl>

<dl class="data">
<dt id="locale.CHAR_MAX">
<tt class="descclassname">locale.</tt><tt class="descname">CHAR_MAX</tt><a class="headerlink" href="#locale.CHAR_MAX" title="Permalink to this definition">¶</a></dt>
<dd>This is a symbolic constant used for different values returned by
<a title="locale.localeconv" class="reference internal" href="#locale.localeconv"><tt class="xref docutils literal"><span class="pre">localeconv()</span></tt></a>.</dd></dl>

<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">locale</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">loc</span> <span class="o">=</span> <span class="n">locale</span><span class="o">.</span><span class="n">getlocale</span><span class="p">()</span> <span class="c"># get current locale</span>
<span class="go"># use German locale; name might vary with platform</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">locale</span><span class="o">.</span><span class="n">setlocale</span><span class="p">(</span><span class="n">locale</span><span class="o">.</span><span class="n">LC_ALL</span><span class="p">,</span> <span class="s">&#39;de_DE&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">locale</span><span class="o">.</span><span class="n">strcoll</span><span class="p">(</span><span class="s">&#39;f</span><span class="se">\xe4</span><span class="s">n&#39;</span><span class="p">,</span> <span class="s">&#39;foo&#39;</span><span class="p">)</span> <span class="c"># compare a string containing an umlaut</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">locale</span><span class="o">.</span><span class="n">setlocale</span><span class="p">(</span><span class="n">locale</span><span class="o">.</span><span class="n">LC_ALL</span><span class="p">,</span> <span class="s">&#39;&#39;</span><span class="p">)</span> <span class="c"># use user&#39;s preferred locale</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">locale</span><span class="o">.</span><span class="n">setlocale</span><span class="p">(</span><span class="n">locale</span><span class="o">.</span><span class="n">LC_ALL</span><span class="p">,</span> <span class="s">&#39;C&#39;</span><span class="p">)</span> <span class="c"># use default (C) locale</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">locale</span><span class="o">.</span><span class="n">setlocale</span><span class="p">(</span><span class="n">locale</span><span class="o">.</span><span class="n">LC_ALL</span><span class="p">,</span> <span class="n">loc</span><span class="p">)</span> <span class="c"># restore saved locale</span>
</pre></div>
</div>
<div class="section" id="background-details-hints-tips-and-caveats">
<h2>23.2.1. Background, details, hints, tips and caveats<a class="headerlink" href="#background-details-hints-tips-and-caveats" title="Permalink to this headline">¶</a></h2>
<p>The C standard defines the locale as a program-wide property that may be
relatively expensive to change.  On top of that, some implementation are broken
in such a way that frequent locale changes may cause core dumps.  This makes the
locale somewhat painful to use correctly.</p>
<p>Initially, when a program is started, the locale is the <tt class="docutils literal"><span class="pre">C</span></tt> locale, no matter
what the user&#8217;s preferred locale is.  The program must explicitly say that it
wants the user&#8217;s preferred locale settings by calling <tt class="docutils literal"><span class="pre">setlocale(LC_ALL,</span> <span class="pre">'')</span></tt>.</p>
<p>It is generally a bad idea to call <a title="locale.setlocale" class="reference internal" href="#locale.setlocale"><tt class="xref docutils literal"><span class="pre">setlocale()</span></tt></a> in some library routine,
since as a side effect it affects the entire program.  Saving and restoring it
is almost as bad: it is expensive and affects other threads that happen to run
before the settings have been restored.</p>
<p>If, when coding a module for general use, you need a locale independent version
of an operation that is affected by the locale (such as <a title="string.lower" class="reference external" href="string.html#string.lower"><tt class="xref docutils literal"><span class="pre">string.lower()</span></tt></a>, or
certain formats used with <a title="time.strftime" class="reference external" href="time.html#time.strftime"><tt class="xref docutils literal"><span class="pre">time.strftime()</span></tt></a>), you will have to find a way to
do it without using the standard library routine.  Even better is convincing
yourself that using locale settings is okay.  Only as a last resort should you
document that your module is not compatible with non-<tt class="docutils literal"><span class="pre">C</span></tt> locale settings.</p>
<p id="index-420">The case conversion functions in the <a title="Common string operations." class="reference external" href="string.html#module-string"><tt class="xref docutils literal"><span class="pre">string</span></tt></a> module are affected by the
locale settings.  When a call to the <a title="locale.setlocale" class="reference internal" href="#locale.setlocale"><tt class="xref docutils literal"><span class="pre">setlocale()</span></tt></a> function changes the
<a title="locale.LC_CTYPE" class="reference internal" href="#locale.LC_CTYPE"><tt class="xref docutils literal"><span class="pre">LC_CTYPE</span></tt></a> settings, the variables <tt class="docutils literal"><span class="pre">string.lowercase</span></tt>,
<tt class="docutils literal"><span class="pre">string.uppercase</span></tt> and <tt class="docutils literal"><span class="pre">string.letters</span></tt> are recalculated.  Note that code
that uses these variable through &#8216;<a class="reference external" href="../reference/simple_stmts.html#from"><tt class="xref docutils literal"><span class="pre">from</span></tt></a> ... <a class="reference external" href="../reference/simple_stmts.html#import"><tt class="xref docutils literal"><span class="pre">import</span></tt></a> ...&#8217;,
e.g. <tt class="docutils literal"><span class="pre">from</span> <span class="pre">string</span> <span class="pre">import</span> <span class="pre">letters</span></tt>, is not affected by subsequent
<a title="locale.setlocale" class="reference internal" href="#locale.setlocale"><tt class="xref docutils literal"><span class="pre">setlocale()</span></tt></a> calls.</p>
<p>The only way to perform numeric operations according to the locale is to use the
special functions defined by this module: <a title="locale.atof" class="reference internal" href="#locale.atof"><tt class="xref docutils literal"><span class="pre">atof()</span></tt></a>, <a title="locale.atoi" class="reference internal" href="#locale.atoi"><tt class="xref docutils literal"><span class="pre">atoi()</span></tt></a>,
<a title="locale.format" class="reference internal" href="#locale.format"><tt class="xref docutils literal"><span class="pre">format()</span></tt></a>, <a title="locale.str" class="reference internal" href="#locale.str"><tt class="xref docutils literal"><span class="pre">str()</span></tt></a>.</p>
</div>
<div class="section" id="for-extension-writers-and-programs-that-embed-python">
<span id="embedding-locale"></span><h2>23.2.2. For extension writers and programs that embed Python<a class="headerlink" href="#for-extension-writers-and-programs-that-embed-python" title="Permalink to this headline">¶</a></h2>
<p>Extension modules should never call <a title="locale.setlocale" class="reference internal" href="#locale.setlocale"><tt class="xref docutils literal"><span class="pre">setlocale()</span></tt></a>, except to find out what
the current locale is.  But since the return value can only be used portably to
restore it, that is not very useful (except perhaps to find out whether or not
the locale is <tt class="docutils literal"><span class="pre">C</span></tt>).</p>
<p>When Python code uses the <tt class="xref docutils literal"><span class="pre">locale</span></tt> module to change the locale, this also
affects the embedding application.  If the embedding application doesn&#8217;t want
this to happen, it should remove the <tt class="xref docutils literal"><span class="pre">_locale</span></tt> extension module (which does
all the work) from the table of built-in modules in the <tt class="docutils literal"><span class="pre">config.c</span></tt> file,
and make sure that the <tt class="xref docutils literal"><span class="pre">_locale</span></tt> module is not accessible as a shared
library.</p>
</div>
<div class="section" id="access-to-message-catalogs">
<span id="locale-gettext"></span><h2>23.2.3. Access to message catalogs<a class="headerlink" href="#access-to-message-catalogs" title="Permalink to this headline">¶</a></h2>
<p>The locale module exposes the C library&#8217;s gettext interface on systems that
provide this interface.  It consists of the functions <tt class="xref docutils literal"><span class="pre">gettext()</span></tt>,
<tt class="xref docutils literal"><span class="pre">dgettext()</span></tt>, <tt class="xref docutils literal"><span class="pre">dcgettext()</span></tt>, <tt class="xref docutils literal"><span class="pre">textdomain()</span></tt>, <tt class="xref docutils literal"><span class="pre">bindtextdomain()</span></tt>,
and <tt class="xref docutils literal"><span class="pre">bind_textdomain_codeset()</span></tt>.  These are similar to the same functions in
the <a title="Multilingual internationalization services." class="reference external" href="gettext.html#module-gettext"><tt class="xref docutils literal"><span class="pre">gettext</span></tt></a> module, but use the C library&#8217;s binary format for message
catalogs, and the C library&#8217;s search algorithms for locating message catalogs.</p>
<p>Python applications should normally find no need to invoke these functions, and
should use <a title="Multilingual internationalization services." class="reference external" href="gettext.html#module-gettext"><tt class="xref docutils literal"><span class="pre">gettext</span></tt></a> instead.  A known exception to this rule are
applications that link use additional C libraries which internally invoke
<tt class="xref docutils literal"><span class="pre">gettext()</span></tt> or <tt class="xref docutils literal"><span class="pre">dcgettext()</span></tt>.  For these applications, it may be
necessary to bind the text domain, so that the libraries can properly locate
their message catalogs.</p>
</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
            <h3><a href="../contents.html">Table Of Contents</a></h3>
            <ul>
<li><a class="reference external" href="#">23.2. <tt class="docutils literal"><span class="pre">locale</span></tt> &#8212; Internationalization services</a><ul>
<li><a class="reference external" href="#background-details-hints-tips-and-caveats">23.2.1. Background, details, hints, tips and caveats</a></li>
<li><a class="reference external" href="#for-extension-writers-and-programs-that-embed-python">23.2.2. For extension writers and programs that embed Python</a></li>
<li><a class="reference external" href="#access-to-message-catalogs">23.2.3. Access to message catalogs</a></li>
</ul>
</li>
</ul>

            <h4>Previous topic</h4>
            <p class="topless"><a href="gettext.html"
                                  title="previous chapter">23.1. <tt class="docutils literal docutils literal docutils literal"><span class="pre">gettext</span></tt> &#8212; Multilingual internationalization services</a></p>
            <h4>Next topic</h4>
            <p class="topless"><a href="frameworks.html"
                                  title="next chapter">24. Program Frameworks</a></p>
            <h3>This Page</h3>
            <ul class="this-page-menu">
              <li><a href="../_sources/library/locale.txt"
                     rel="nofollow">Show Source</a></li>
            </ul>
          <div id="searchbox" style="display: none">
            <h3>Quick search</h3>
              <form class="search" action="../search.html" method="get">
                <input type="text" name="q" size="18" />
                <input type="submit" value="Go" />
                <input type="hidden" name="check_keywords" value="yes" />
                <input type="hidden" name="area" value="default" />
              </form>
              <p class="searchtip" style="font-size: 90%">
              Enter search terms or a module, class or function name.
              </p>
          </div>
          <script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../modindex.html" title="Global Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="frameworks.html" title="24. Program Frameworks"
             >next</a> |</li>
        <li class="right" >
          <a href="gettext.html" title="23.1. gettext — Multilingual internationalization services"
             >previous</a> |</li>
        <li><img src="../_static/py.png" alt=""
                 style="vertical-align: middle; margin-top: -1px"/></li>
        <li><a href="../index.html">Python v2.6.5 documentation</a> &raquo;</li>

          <li><a href="index.html" >The Python Standard Library</a> &raquo;</li>
          <li><a href="i18n.html" >23. Internationalization</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
    &copy; <a href="../copyright.html">Copyright</a> 1990-2010, Python Software Foundation.
    <br />
    The Python Software Foundation is a non-profit corporation.  
    <a href="http://www.python.org/psf/donations/">Please donate.</a>
    <br />
    Last updated on Mar 19, 2010.
    Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.5.
    </div>

  </body>
</html>