<!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 — Django 1.4.8 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.4.8', 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 1.4.8 documentation" href="../../index.html" /> <link rel="up" title="Using Django" href="../index.html" /> <link rel="next" title="Translation" href="translation.html" /> <link rel="prev" title="Sending email" 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 1.4.8 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"> « <a href="../email.html" title="Sending email">previous</a> | <a href="../index.html" title="Using Django" accesskey="U">up</a> | <a href="translation.html" title="Translation">next</a> »</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="toctree-wrapper compound"> </div> <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>The goal of internationalization and localization is to allow a single Web application to offer its content in languages and formats tailored to the audience.</p> <p>Django has full support for <a class="reference internal" href="translation.html"><em>translation of text</em></a>, <a class="reference internal" href="formatting.html"><em>formatting of dates, times and numbers</em></a>, and <a class="reference internal" href="timezones.html"><em>time zones</em></a>.</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 translated or formatted for local languages and cultures.</li> <li>It uses these hooks to localize Web apps for particular users according to their preferences.</li> </ul> <p>Obviously, translation depends on the target language, and formatting usually depends on the target country. These informations are provided by browsers in the <tt class="docutils literal"><span class="pre">Accept-Language</span></tt> header. However, the time zone isn’t readily available.</p> </div> <div class="section" id="s-definitions"> <span id="definitions"></span><h2>Definitions<a class="headerlink" href="#definitions" title="Permalink to this headline">¶</a></h2> <p>The words “internationalization” and “localization” often cause confusion; here’s a simplified definition:</p> <dl class="glossary docutils"> <dt id="term-internationalization">internationalization</dt> <dd>Preparing the software for localization. Usually done by developers.</dd> <dt id="term-localization">localization</dt> <dd>Writing the translations and local formats. Usually done by translators.</dd> </dl> <p>More details can be found in the <a class="reference external" href="http://www.w3.org/International/questions/qa-i18n">W3C Web Internationalization FAQ</a>, the <a class="reference external" href="http://en.wikipedia.org/wiki/Internationalization_and_localization">Wikipedia article</a> or the <a class="reference external" href="http://www.gnu.org/software/gettext/manual/gettext.html#Concepts">GNU gettext documentation</a>.</p> <div class="admonition warning"> <p class="first admonition-title">Warning</p> <p class="last">Translation and formatting are controlled by <a class="reference internal" href="../../ref/settings.html#std:setting-USE_I18N"><tt class="xref std std-setting docutils literal"><span class="pre">USE_I18N</span></tt></a> and <a class="reference internal" href="../../ref/settings.html#std:setting-USE_L10N"><tt class="xref std std-setting docutils literal"><span class="pre">USE_L10N</span></tt></a> settings respectively. However, both features involve internationalization and localization. The names of the settings are an unfortunate result of Django’s history.</p> </div> <p>Here are some other 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>. The language part is always is lower case and the country part in upper case. The separator is an underscore.</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>. Both the language and the country parts are in lower case. The separator is a dash.</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> <dt id="term-format-file">format file</dt> <dd>A format file is a Python module that defines the data formats for a given locale.</dd> </dl> </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></li> <li><a class="reference internal" href="#definitions">Definitions</a></li> </ul> </li> </ul> <h3>Browse</h3> <ul> <li>Prev: <a href="../email.html">Sending email</a></li> <li>Next: <a href="translation.html">Translation</a></li> </ul> <h3>You are here:</h3> <ul> <li> <a href="../../index.html">Django 1.4.8 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" /> <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 30, 2013</p> </div> </div> <div id="ft"> <div class="nav"> « <a href="../email.html" title="Sending email">previous</a> | <a href="../index.html" title="Using Django" accesskey="U">up</a> | <a href="translation.html" title="Translation">next</a> »</div> </div> </div> <div class="clearer"></div> </div> </body> </html>