Current Path : /usr/share/doc/python-babel-0.9.6/doc/api/ |
Current File : //usr/share/doc/python-babel-0.9.6/doc/api/babel.localedata-module.html |
<?xml version="1.0" encoding="ascii"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>babel.localedata</title> <link rel="stylesheet" href="epydoc.css" type="text/css" /> <script type="text/javascript" src="epydoc.js"></script> </head> <body bgcolor="white" text="black" link="blue" vlink="#204080" alink="#204080"> <!-- ==================== NAVIGATION BAR ==================== --> <table class="navbar" border="0" width="100%" cellpadding="0" bgcolor="#a0c0ff" cellspacing="0"> <tr valign="middle"> <!-- Home link --> <th> <a href="babel-module.html">Home</a> </th> <!-- Tree link --> <th> <a href="module-tree.html">Trees</a> </th> <!-- Index link --> <th> <a href="identifier-index.html">Indices</a> </th> <!-- Help link --> <th> <a href="help.html">Help</a> </th> <!-- Project homepage --> <th class="navbar" align="right" width="100%"> <table border="0" cellpadding="0" cellspacing="0"> <tr><th class="navbar" align="center" ><a class="navbar" target="_top" href="../index.html">Documentation Index</a></th> </tr></table></th> </tr> </table> <table width="100%" cellpadding="0" cellspacing="0"> <tr valign="top"> <td width="100%"> <span class="breadcrumbs"> <a href="babel-module.html">Package babel</a> :: Module localedata </span> </td> <td> <table cellpadding="0" cellspacing="0"> <!-- hide/show private --> </table> </td> </tr> </table> <!-- ==================== MODULE DESCRIPTION ==================== --> <h1 class="epydoc">Module localedata</h1><p class="nomargin-top"></p> Low-level locale data access. <hr /> <div class="fields"> <p><strong>Note:</strong> The <a href="babel.core.Locale-class.html" class="link">Locale</a> class, which uses this module under the hood, provides a more convenient interface for accessing the locale data. </p> </div><!-- ==================== FUNCTIONS ==================== --> <a name="section-Functions"></a> <table class="summary" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr bgcolor="#70b0f0" class="table-header"> <td align="left" colspan="2" class="table-header"> <span class="table-header">Functions</span></td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"><code class="link">bool</code></span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="babel.localedata-module.html#exists" class="summary-sig-name">exists</a>(<span class="summary-sig-arg">name</span>)</span><br /> Check whether locale data is available for the given locale.</td> <td align="right" valign="top"> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"><a href="babel.localedata-module.html#list" class="link">list</a></span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="babel.localedata-module.html#list" class="summary-sig-name">list</a>()</span><br /> Return a list of all locale identifiers for which locale data is available.</td> <td align="right" valign="top"> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"><code class="link">dict</code></span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="babel.localedata-module.html#load" class="summary-sig-name">load</a>(<span class="summary-sig-arg">name</span>, <span class="summary-sig-arg">merge_inherited</span>=<span class="summary-sig-default">True</span>)</span><br /> Load the locale data for the given locale.</td> <td align="right" valign="top"> </td> </tr> </table> </td> </tr> </table> <!-- ==================== FUNCTION DETAILS ==================== --> <a name="section-FunctionDetails"></a> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr bgcolor="#70b0f0" class="table-header"> <td align="left" colspan="2" class="table-header"> <span class="table-header">Function Details</span></td> </tr> </table> <a name="exists"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">exists</span>(<span class="sig-arg">name</span>)</span> </h3> </td><td align="right" valign="top" > </td> </tr></table> Check whether locale data is available for the given locale. <dl class="fields"> <dt>Parameters:</dt> <dd><ul class="nomargin-top"> <li><strong class="pname"><code>name</code></strong> - the locale identifier string</li> </ul></dd> <dt>Returns: <code class="link">bool</code></dt> <dd><code class="link">True</code> if the locale data exists, <code class="link">False</code> otherwise</dd> </dl> </td></tr></table> </div> <a name="list"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">list</span>()</span> </h3> </td><td align="right" valign="top" > </td> </tr></table> Return a list of all locale identifiers for which locale data is available. <dl class="fields"> <dt>Returns: <a href="babel.localedata-module.html#list" class="link">list</a></dt> <dd>a list of locale identifiers (strings)</dd> </dl> <div class="fields"> <p><strong>Since:</strong> version 0.8.1 </p> </div></td></tr></table> </div> <a name="load"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">load</span>(<span class="sig-arg">name</span>, <span class="sig-arg">merge_inherited</span>=<span class="sig-default">True</span>)</span> </h3> </td><td align="right" valign="top" > </td> </tr></table> <p>Load the locale data for the given locale.</p> <p>The locale data is a dictionary that contains much of the data defined by the Common Locale Data Repository (CLDR). This data is stored as a collection of pickle files inside the <tt class="rst-docutils literal">babel</tt> package.</p> <pre class="py-doctest"> <span class="py-prompt">>>> </span>d = load(<span class="py-string">'en_US'</span>) <span class="py-prompt">>>> </span>d[<span class="py-string">'languages'</span>][<span class="py-string">'sv'</span>] <span class="py-output">u'Swedish'</span></pre> <p>Note that the results are cached, and subsequent requests for the same locale return the same dictionary:</p> <pre class="py-doctest"> <span class="py-prompt">>>> </span>d1 = load(<span class="py-string">'en_US'</span>) <span class="py-prompt">>>> </span>d2 = load(<span class="py-string">'en_US'</span>) <span class="py-prompt">>>> </span>d1 <span class="py-keyword">is</span> d2 <span class="py-output">True</span></pre> <dl class="fields"> <dt>Parameters:</dt> <dd><ul class="nomargin-top"> <li><strong class="pname"><code>name</code></strong> - the locale identifier string (or "root")</li> <li><strong class="pname"><code>merge_inherited</code></strong> - whether the inherited data should be merged into the data of the requested locale</li> </ul></dd> <dt>Returns: <code class="link">dict</code></dt> <dd>the locale data</dd> <dt>Raises:</dt> <dd><ul class="nomargin-top"> <li><code><strong class='fraise'>IOError</strong></code> - if no locale data file is found for the given locale identifer, or one of the locales it inherits from</li> </ul></dd> </dl> </td></tr></table> </div> <br /> <!-- ==================== NAVIGATION BAR ==================== --> <table class="navbar" border="0" width="100%" cellpadding="0" bgcolor="#a0c0ff" cellspacing="0"> <tr valign="middle"> <!-- Home link --> <th> <a href="babel-module.html">Home</a> </th> <!-- Tree link --> <th> <a href="module-tree.html">Trees</a> </th> <!-- Index link --> <th> <a href="identifier-index.html">Indices</a> </th> <!-- Help link --> <th> <a href="help.html">Help</a> </th> <!-- Project homepage --> <th class="navbar" align="right" width="100%"> <table border="0" cellpadding="0" cellspacing="0"> <tr><th class="navbar" align="center" ><a class="navbar" target="_top" href="../index.html">Documentation Index</a></th> </tr></table></th> </tr> </table> <table border="0" cellpadding="0" cellspacing="0" width="100%%"> <tr> <td align="left" class="footer"> Generated by Epydoc 3.0.1 on Thu Mar 17 15:12:44 2011 </td> <td align="right" class="footer"> <a target="mainFrame" href="http://epydoc.sourceforge.net" >http://epydoc.sourceforge.net</a> </td> </tr> </table> <script type="text/javascript"> <!-- // Private objects are initially displayed (because if // javascript is turned off then we want them to be // visible); but by default, we want to hide them. So hide // them unless we have a cookie that says to show them. checkCookie(); // --> </script> </body> </html>