Sophie

Sophie

distrib > Arklinux > devel > i586 > media > main > by-pkgid > 5fcb1fedf34660bc240dc59b7bfcebc4 > files > 463

django-doc-1.2.3-1ark.noarch.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>Internationalization and localization &mdash; Django v1.2 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:     '1.2',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../../_static/jquery.js"></script>
    <script type="text/javascript" src="../../_static/underscore.js"></script>
    <script type="text/javascript" src="../../_static/doctools.js"></script>
    <link rel="top" title="Django v1.2 documentation" href="../../index.html" />
    <link rel="up" title="Using Django" href="../index.html" />
    <link rel="next" title="Internationalization" href="internationalization.html" />
    <link rel="prev" title="Sending e-mail" href="../email.html" />
 
<script type="text/javascript" src="../../templatebuiltins.js"></script>
<script type="text/javascript">
(function($) {
    if (!django_template_builtins) {
       // templatebuiltins.js missing, do nothing.
       return;
    }
    $(document).ready(function() {
        // Hyperlink Django template tags and filters
        var base = "../../ref/templates/builtins.html";
        if (base == "#") {
            // Special case for builtins.html itself
            base = "";
        }
        // Tags are keywords, class '.k'
        $("div.highlight\\-html\\+django span.k").each(function(i, elem) {
             var tagname = $(elem).text();
             if ($.inArray(tagname, django_template_builtins.ttags) != -1) {
                 var fragment = tagname.replace(/_/, '-');
                 $(elem).html("<a href='" + base + "#" + fragment + "'>" + tagname + "</a>");
             }
        });
        // Filters are functions, class '.nf'
        $("div.highlight\\-html\\+django span.nf").each(function(i, elem) {
             var filtername = $(elem).text();
             if ($.inArray(filtername, django_template_builtins.tfilters) != -1) {
                 var fragment = filtername.replace(/_/, '-');
                 $(elem).html("<a href='" + base + "#" + fragment + "'>" + filtername + "</a>");
             }
        });
    });
})(jQuery);
</script>

  </head>
  <body>

    <div class="document">
  <div id="custom-doc" class="yui-t6">
    <div id="hd">
      <h1><a href="../../index.html">Django v1.2 documentation</a></h1>
      <div id="global-nav">
        <a title="Home page" href="../../index.html">Home</a>  |
        <a title="Table of contents" href="../../contents.html">Table of contents</a>  |
        <a title="Global index" href="../../genindex.html">Index</a>  |
        <a title="Module index" href="../../py-modindex.html">Modules</a>
      </div>
      <div class="nav">
    &laquo; <a href="../email.html" title="Sending e-mail">previous</a> 
     |
    <a href="../index.html" title="Using Django" accesskey="U">up</a>
   |
    <a href="internationalization.html" title="Internationalization">next</a> &raquo;</div>
    </div>
    
    <div id="bd">
      <div id="yui-main">
        <div class="yui-b">
          <div class="yui-g" id="topics-i18n-index">
            
  <div class="section" id="s-internationalization-and-localization">
<span id="internationalization-and-localization"></span><h1>Internationalization and localization<a class="headerlink" href="#internationalization-and-localization" title="Permalink to this headline">¶</a></h1>
<div class="section" id="s-overview">
<span id="overview"></span><h2>Overview<a class="headerlink" href="#overview" title="Permalink to this headline">¶</a></h2>
<p>Django has full support for internationalization of text in code and
templates, and format localization of dates and numbers. Here&#8217;s how it works.</p>
<p>Essentially, Django does two things:</p>
<ul class="simple">
<li>It allows developers and template authors to specify which parts of
their apps should be translatable.</li>
<li>It uses these hooks to translate Web apps for particular users according
to their language preferences.</li>
</ul>
<p>The complete process can be seen as divided in three stages. It is also possible
to identify an identical number of roles with very well defined responsibilities
associated with each of these tasks (although it&#8217;s perfectly normal if you
find yourself performing more than one of these roles):</p>
<ul class="simple">
<li>For application authors wishing to make sure their Django apps can be
used in different locales: <a class="reference internal" href="internationalization.html"><em>Internationalization</em></a>.</li>
<li>For translators wanting to translate Django apps: <a class="reference internal" href="localization.html"><em>Localization</em></a>.</li>
<li>For system administrators/final users setting up internationalized apps or
developers integrating third party apps: <a class="reference internal" href="deployment.html"><em>Deployment of translations</em></a>.</li>
</ul>
<div class="toctree-wrapper compound">
</div>
<p>For more general information about the topic, see the <a class="reference external" href="http://www.gnu.org/software/gettext/manual/gettext.html#Concepts">GNU gettext documentation</a>
and the <a class="reference external" href="http://en.wikipedia.org/wiki/Internationalization_and_localization">Wikipedia article</a>.</p>
</div>
<div class="section" id="s-glossary">
<span id="glossary"></span><h2>Glossary<a class="headerlink" href="#glossary" title="Permalink to this headline">¶</a></h2>
<p>First lets define some terms that will help us to handle a common language:</p>
<dl class="glossary docutils">
<dt id="term-locale-name">locale name</dt>
<dd>A locale name, either a language specification of the form <tt class="docutils literal"><span class="pre">ll</span></tt> or a
combined language and country specification of the form <tt class="docutils literal"><span class="pre">ll_CC</span></tt>.
Examples: <tt class="docutils literal"><span class="pre">it</span></tt>, <tt class="docutils literal"><span class="pre">de_AT</span></tt>, <tt class="docutils literal"><span class="pre">es</span></tt>, <tt class="docutils literal"><span class="pre">pt_BR</span></tt>. Note the underscore in
some of them and the case of the part located to its right.</dd>
<dt id="term-language-code">language code</dt>
<dd>Represents the name of a language. Browsers send the names of the
languages they accept in the <tt class="docutils literal"><span class="pre">Accept-Language</span></tt> HTTP header using this
format. Examples: <tt class="docutils literal"><span class="pre">it</span></tt>, <tt class="docutils literal"><span class="pre">de-at</span></tt>, <tt class="docutils literal"><span class="pre">es</span></tt>, <tt class="docutils literal"><span class="pre">pt-br</span></tt>. Note the <tt class="docutils literal"><span class="pre">-</span></tt>
separator.</dd>
<dt id="term-message-file">message file</dt>
<dd>A message file is a plain-text file, representing a single language,
that contains all available <a class="reference internal" href="#term-translation-string"><em class="xref std std-term">translation strings</em></a> and how they should be represented in the given
language. Message files have a <tt class="docutils literal"><span class="pre">.po</span></tt> file extension.</dd>
<dt id="term-translation-string">translation string</dt>
<dd>A literal that can be translated.</dd>
</dl>
</div>
<div class="section" id="s-specialties-of-django-translation">
<span id="s-specialties-of-django-i18n"></span><span id="specialties-of-django-translation"></span><span id="specialties-of-django-i18n"></span><h2>Specialties of Django translation<a class="headerlink" href="#specialties-of-django-translation" title="Permalink to this headline">¶</a></h2>
<p>Django&#8217;s translation machinery uses the standard <tt class="docutils literal"><span class="pre">gettext</span></tt> module that comes
with Python. If you know <tt class="docutils literal"><span class="pre">gettext</span></tt>, you might note these specialties in the
way Django does translation:</p>
<ul class="simple">
<li>The string domain is <tt class="docutils literal"><span class="pre">django</span></tt> or <tt class="docutils literal"><span class="pre">djangojs</span></tt>. This string domain is
used to differentiate between different programs that store their data
in a common message-file library (usually <tt class="docutils literal"><span class="pre">/usr/share/locale/</span></tt>). The
<tt class="docutils literal"><span class="pre">django</span></tt> domain is used for python and template translation strings
and is loaded into the global translation catalogs. The <tt class="docutils literal"><span class="pre">djangojs</span></tt>
domain is only used for JavaScript translation catalogs to make sure
that those are as small as possible.</li>
<li>Django doesn&#8217;t use <tt class="docutils literal"><span class="pre">xgettext</span></tt> alone. It uses Python wrappers around
<tt class="docutils literal"><span class="pre">xgettext</span></tt> and <tt class="docutils literal"><span class="pre">msgfmt</span></tt>. This is mostly for convenience.</li>
</ul>
<div class="section" id="s-django-technical-message-ids">
<span id="s-technical-messages"></span><span id="django-technical-message-ids"></span><span id="technical-messages"></span><h3>Django technical message IDs<a class="headerlink" href="#django-technical-message-ids" title="Permalink to this headline">¶</a></h3>
<div class="versionchanged">
<span class="title">Changed in Django 1.2:</span> Starting with Django 1.2, technical message IDs are being replaced by <a class="reference internal" href="localization.html#format-localization"><em>Format localization</em></a></div>
<p>Django uses technical message IDs to translate date formats and time formats.
Technical message IDs are <a class="reference internal" href="#term-translation-string"><em class="xref std std-term">translation strings</em></a> and
can be easily recognized; they&#8217;re all upper case. You don&#8217;t translate the
message ID as with other translation strings, you provide the correct local
variant on the provided English value. The format is identical to the format
strings used by the <tt class="docutils literal"><span class="pre">now</span></tt> template tag.</p>
<p>For example, with <tt class="docutils literal"><span class="pre">DATETIME_FORMAT</span></tt> (or <tt class="docutils literal"><span class="pre">DATE_FORMAT</span></tt> or <tt class="docutils literal"><span class="pre">TIME_FORMAT</span></tt>),
this would be the format string that you want to use in your language. A Django
contributor localizing it to Spanish probably would provide a <tt class="docutils literal"><span class="pre">&quot;j</span> <span class="pre">N</span> <span class="pre">Y</span> <span class="pre">P&quot;</span></tt>
&#8220;translation&#8221; for it in the relevant <tt class="docutils literal"><span class="pre">django.po</span></tt> file:</p>
<div class="highlight-python"><pre>msgid "DATETIME_FORMAT"
msgstr "j N Y P"</pre>
</div>
</div>
</div>
</div>


          </div>         
        </div>
      </div>
      
        
          <div class="yui-b" id="sidebar">
            
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
  <h3><a href="../../contents.html">Table Of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">Internationalization and localization</a><ul>
<li><a class="reference internal" href="#overview">Overview</a><ul>
</ul>
</li>
<li><a class="reference internal" href="#glossary">Glossary</a></li>
<li><a class="reference internal" href="#specialties-of-django-translation">Specialties of Django translation</a><ul>
<li><a class="reference internal" href="#django-technical-message-ids">Django technical message IDs</a></li>
</ul>
</li>
</ul>
</li>
</ul>

  <h3>Browse</h3>
  <ul>
    
      <li>Prev: <a href="../email.html">Sending e-mail</a></li>
    
    
      <li>Next: <a href="internationalization.html">Internationalization</a></li>
    
  </ul>
  <h3>You are here:</h3>
  <ul>
      <li>
        <a href="../../index.html">Django v1.2 documentation</a>
        
          <ul><li><a href="../index.html">Using Django</a>
        
        <ul><li>Internationalization and localization</li></ul>
        </li></ul>
      </li>
  </ul>  

  <h3>This Page</h3>
  <ul class="this-page-menu">
    <li><a href="../../_sources/topics/i18n/index.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>
              <h3>Last update:</h3>
              <p class="topless">Oct 20, 2010</p>
          </div> 
        
      
    </div>
    
    <div id="ft">
      <div class="nav">
    &laquo; <a href="../email.html" title="Sending e-mail">previous</a> 
     |
    <a href="../index.html" title="Using Django" accesskey="U">up</a>
   |
    <a href="internationalization.html" title="Internationalization">next</a> &raquo;</div>
    </div>
  </div>

      <div class="clearer"></div>
    </div>
  </body>
</html>