Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > f9d20baf2d42bbb9f9c5746dba0abad5 > files > 192

python-translate-doc-1.10.0-3.mga4.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>moz2po &mdash; Translate Toolkit 1.9.0 documentation</title>
    
    <link rel="stylesheet" href="../_static/basic.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    <link rel="stylesheet" href="../_static/bootstrap.css" type="text/css" />
    <link rel="stylesheet" href="../_static/bootstrap-sphinx.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../',
        VERSION:     '1.9.0',
        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>
    <script type="text/javascript" src="../_static/bootstrap.js"></script>
    <script type="text/javascript" src="../_static/bootstrap-sphinx.js"></script>
    <link rel="top" title="Translate Toolkit 1.9.0 documentation" href="../index.html" />
    <link rel="up" title="Converters" href="index.html" />
    <link rel="next" title="oo2po" href="oo2po.html" />
    <link rel="prev" title="General Usage" href="general_usage.html" /> 
  </head>
  <body>
  <div id="navbar" class="navbar navbar-fixed-top">
    <div class="navbar-inner">
      <div class="container-fluid">
        <a class="brand" href="../index.html">Translate Toolkit</a>
        <span class="navbar-text pull-left"><b>1.9.0</b></span>
          <ul class="nav">
            <li class="divider-vertical"></li>
            
              <li class="dropdown">
  <a href="#" class="dropdown-toggle" data-toggle="dropdown">Site <b class="caret"></b></a>
  <ul class="dropdown-menu globaltoc"><ul class="simple">
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../features.html">Features</a></li>
<li class="toctree-l1"><a class="reference internal" href="../installation.html">Installation</a></li>
<li class="toctree-l1"><a class="reference internal" href="index.html">Converters</a></li>
<li class="toctree-l1"><a class="reference internal" href="index.html#tools">Tools</a></li>
<li class="toctree-l1"><a class="reference internal" href="index.html#scripts">Scripts</a></li>
<li class="toctree-l1"><a class="reference internal" href="../guides/index.html">Use Cases</a></li>
<li class="toctree-l1"><a class="reference internal" href="../formats/index.html">Supported formats</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../styleguide.html">Translate Styleguide</a></li>
<li class="toctree-l1"><a class="reference internal" href="../styleguide.html#documentation">Documentation</a></li>
<li class="toctree-l1"><a class="reference internal" href="../development/building.html">Building</a></li>
<li class="toctree-l1"><a class="reference internal" href="../development/contributing.html">Contributing</a></li>
<li class="toctree-l1"><a class="reference internal" href="../development/developers.html">Translate Toolkit Developers Guide</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../api/index.html">API</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../changelog.html">Important Changes</a></li>
<li class="toctree-l1"><a class="reference internal" href="../history.html">History of the Translate Toolkit</a></li>
<li class="toctree-l1"><a class="reference internal" href="../license.html">License</a></li>
</ul>
</ul>
</li>
              
<li class="dropdown">
  <a href="#" class="dropdown-toggle" data-toggle="dropdown">Page <b class="caret"></b></a>
  <ul class="dropdown-menu localtoc"><ul>
<li><a class="reference internal" href="#">moz2po</a><ul>
<li><a class="reference internal" href="#usage">Usage</a></li>
<li><a class="reference internal" href="#examples">Examples</a><ul>
<li><a class="reference internal" href="#creating-pot-files">Creating POT files</a></li>
<li><a class="reference internal" href="#creating-po-files-from-existing-non-po-translations">Creating PO files from existing non-PO translations</a></li>
<li><a class="reference internal" href="#creating-an-xpi-or-cvs-ready-translations">Creating an XPI or CVS ready translations</a></li>
</ul>
</li>
<li><a class="reference internal" href="#issues">Issues</a></li>
</ul>
</li>
</ul>
</ul>
</li>
            
            
              
  <li><a href="general_usage.html"
         title="previous chapter">&laquo; General Usage</a></li>
  <li><a href="oo2po.html"
         title="next chapter">oo2po &raquo;</a></li>
            
            
              
            
          </ul>
          
            
<form class="navbar-search pull-right" action="../search.html" method="get">
  <input type="text" name="q" placeholder="Search" />
  <input type="hidden" name="check_keywords" value="yes" />
  <input type="hidden" name="area" value="default" />
</form>
          
          </ul>
        </div>
      </div>
    </div>
  </div>

<div class="container content">
   
  <div class="section" id="po2moz">
<span id="moz2po"></span><span id="id1"></span><h1>moz2po<a class="headerlink" href="#po2moz" title="Permalink to this headline">¶</a></h1>
<p>moz2po converts Mozilla files to PO files.  It wraps converters that handle
.properties, .dtd and some strange Mozilla files.  The tool can extract from an
XPI file or work with files from Mozilla&#8217;s Mercurial repository.  The tools
thus provides a complete roundtrip for Mozilla localisation using PO files and
PO editors.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">This page should only be used as a reference to the command-line
options for moz2po and po2moz. For more about using the Translate Toolkit
and PO files for translating Mozilla products, please see the page on
<a class="reference internal" href="mozilla_l10n_scripts.html"><em>Mozilla L10n Scripts</em></a>.</p>
</div>
<div class="admonition warning">
<p class="first admonition-title">Warning</p>
<p class="last">The conversion to and from XPI files is no longer actively
supported.  The preffered method is to work directly with files in Mozilla&#8217;s
Mercurial version control system.</p>
</div>
<div class="section" id="usage">
<span id="moz2po-usage"></span><h2>Usage<a class="headerlink" href="#usage" title="Permalink to this headline">¶</a></h2>
<div class="highlight-python"><pre>moz2po [options] &lt;xpi|dir&gt; &lt;po&gt;
po2moz [options] &lt;po&gt; &lt;xpi|dir&gt;</pre>
</div>
<p>Where:</p>
<table border="1" class="docutils">
<colgroup>
<col width="15%" />
<col width="85%" />
</colgroup>
<tbody valign="top">
<tr class="row-odd"><td>&lt;xpi&gt;</td>
<td>is a Mozilla language pack</td>
</tr>
<tr class="row-even"><td>&lt;dir&gt;</td>
<td>is a directory containing valid Mozilla files</td>
</tr>
<tr class="row-odd"><td>&lt;po&gt;</td>
<td>is a directory of PO or POT files</td>
</tr>
</tbody>
</table>
<p>Options (moz2po):</p>
<table class="docutils option-list" frame="void" rules="none">
<col class="option" />
<col class="description" />
<tbody valign="top">
<tr><td class="option-group">
<kbd><span class="option">--version</span></kbd></td>
<td>show program&#8217;s version number and exit</td></tr>
<tr><td class="option-group">
<kbd><span class="option">-h</span>, <span class="option">--help</span></kbd></td>
<td>show this help message and exit</td></tr>
<tr><td class="option-group">
<kbd><span class="option">--manpage</span></kbd></td>
<td>output a manpage based on the help</td></tr>
<tr><td class="option-group" colspan="2">
<kbd><span class="option">--progress=<var>PROGRESS</var></span></kbd></td>
</tr>
<tr><td>&nbsp;</td><td>show progress as: <a class="reference internal" href="option_progress.html"><em>dots, none, bar, names, verbose</em></a></td></tr>
<tr><td class="option-group" colspan="2">
<kbd><span class="option">--errorlevel=<var>ERRORLEVEL</var></span></kbd></td>
</tr>
<tr><td>&nbsp;</td><td>show errorlevel as: <a class="reference internal" href="option_errorlevel.html"><em>none, message, exception,
traceback</em></a></td></tr>
<tr><td class="option-group" colspan="2">
<kbd><span class="option">-i<var>INPUT</var></span>, <span class="option">--input=<var>INPUT</var></span></kbd></td>
</tr>
<tr><td>&nbsp;</td><td>read from INPUT in inc, it, *, dtd, properties formats</td></tr>
<tr><td class="option-group" colspan="2">
<kbd><span class="option">-x<var>EXCLUDE</var></span>, <span class="option">--exclude=<var>EXCLUDE</var></span></kbd></td>
</tr>
<tr><td>&nbsp;</td><td>exclude names matching EXCLUDE from input paths</td></tr>
<tr><td class="option-group" colspan="2">
<kbd><span class="option">-o<var>OUTPUT</var></span>, <span class="option">--output=<var>OUTPUT</var></span></kbd></td>
</tr>
<tr><td>&nbsp;</td><td>write to OUTPUT in it.po, it.pot, manifest, xhtml.po, xhtml.pot, ini.po, ini.pot, rdf, js, *, html.po, html.pot, inc.po, inc.pot, dtd.po, dtd.pot, properties.po, properties.pot formats</td></tr>
<tr><td class="option-group" colspan="2">
<kbd><span class="option">-t<var>TEMPLATE</var></span>, <span class="option">--template=<var>TEMPLATE</var></span></kbd></td>
</tr>
<tr><td>&nbsp;</td><td>read from TEMPLATE in it, *, properties, dtd, inc formats</td></tr>
<tr><td class="option-group">
<kbd><span class="option">--psyco=<var>MODE</var></span></kbd></td>
<td>use psyco to speed up the operation, modes: <a class="reference internal" href="option_psyco.html"><em>none,
full, profile</em></a></td></tr>
<tr><td class="option-group">
<kbd><span class="option">-P</span>, <span class="option">--pot</span></kbd></td>
<td>output PO Templates (.pot) rather than PO files (.po)</td></tr>
<tr><td class="option-group" colspan="2">
<kbd><span class="option">--duplicates=<var>DUPLICATESTYLE</var></span></kbd></td>
</tr>
<tr><td>&nbsp;</td><td>what to do with duplicate strings (identical source
text): <a class="reference internal" href="option_duplicates.html"><em>merge, msgctxt</em></a>
(default: &#8216;msgctxt&#8217;)</td></tr>
</tbody>
</table>
<p>Options (po2moz):</p>
<table class="docutils option-list" frame="void" rules="none">
<col class="option" />
<col class="description" />
<tbody valign="top">
<tr><td class="option-group">
<kbd><span class="option">--version</span></kbd></td>
<td>show program&#8217;s version number and exit</td></tr>
<tr><td class="option-group">
<kbd><span class="option">-h</span>, <span class="option">--help</span></kbd></td>
<td>show this help message and exit</td></tr>
<tr><td class="option-group">
<kbd><span class="option">--manpage</span></kbd></td>
<td>output a manpage based on the help</td></tr>
<tr><td class="option-group" colspan="2">
<kbd><span class="option">--progress=<var>PROGRESS</var></span></kbd></td>
</tr>
<tr><td>&nbsp;</td><td>show progress as: <a class="reference internal" href="option_progress.html"><em>dots, none, bar, names, verbose</em></a></td></tr>
<tr><td class="option-group" colspan="2">
<kbd><span class="option">--errorlevel=<var>ERRORLEVEL</var></span></kbd></td>
</tr>
<tr><td>&nbsp;</td><td>show errorlevel as: <a class="reference internal" href="option_errorlevel.html"><em>none, message, exception,
traceback</em></a></td></tr>
<tr><td class="option-group" colspan="2">
<kbd><span class="option">-i<var>INPUT</var></span>, <span class="option">--input=<var>INPUT</var></span></kbd></td>
</tr>
<tr><td>&nbsp;</td><td>read from INPUT in dtd.po, dtd.pot, ini.po, ini.pot, inc.po, inc.pot, manifest, it.po, it.pot, *, html.po, html.pot, js, rdf, properties.po, properties.pot, xhtml.po, xhtml.pot formats</td></tr>
<tr><td class="option-group" colspan="2">
<kbd><span class="option">-x<var>EXCLUDE</var></span>, <span class="option">--exclude=<var>EXCLUDE</var></span></kbd></td>
</tr>
<tr><td>&nbsp;</td><td>exclude names matching EXCLUDE from input paths</td></tr>
<tr><td class="option-group" colspan="2">
<kbd><span class="option">-o<var>OUTPUT</var></span>, <span class="option">--output=<var>OUTPUT</var></span></kbd></td>
</tr>
<tr><td>&nbsp;</td><td>write to OUTPUT in dtd, *, inc, it, properties formats</td></tr>
<tr><td class="option-group" colspan="2">
<kbd><span class="option">-t<var>TEMPLATE</var></span>, <span class="option">--template=<var>TEMPLATE</var></span></kbd></td>
</tr>
<tr><td>&nbsp;</td><td>read from TEMPLATE in dtd, *, inc, it, properties formats</td></tr>
<tr><td class="option-group">
<kbd><span class="option">--psyco=<var>MODE</var></span></kbd></td>
<td>use psyco to speed up the operation, modes: <a class="reference internal" href="option_psyco.html"><em>none,
full, profile</em></a></td></tr>
<tr><td class="option-group" colspan="2">
<kbd><span class="option">-l<var>LOCALE</var></span>, <span class="option">--locale=<var>LOCALE</var></span></kbd></td>
</tr>
<tr><td>&nbsp;</td><td>set output locale (required as this sets the directory names)</td></tr>
<tr><td class="option-group" colspan="2">
<kbd><span class="option">--clonexpi=<var>CLONEXPI</var></span></kbd></td>
</tr>
<tr><td>&nbsp;</td><td>clone xpi structure from the given xpi file</td></tr>
<tr><td class="option-group">
<kbd><span class="option">--fuzzy</span></kbd></td>
<td>use translations marked fuzzy</td></tr>
<tr><td class="option-group">
<kbd><span class="option">--nofuzzy</span></kbd></td>
<td>don&#8217;t use translations marked fuzzy (default)</td></tr>
</tbody>
</table>
</div>
<div class="section" id="examples">
<span id="moz2po-examples"></span><h2>Examples<a class="headerlink" href="#examples" title="Permalink to this headline">¶</a></h2>
<div class="section" id="creating-pot-files">
<span id="moz2po-creating-pot-files"></span><h3>Creating POT files<a class="headerlink" href="#creating-pot-files" title="Permalink to this headline">¶</a></h3>
<div class="admonition-see-also admonition seealso">
<p class="first admonition-title">See also</p>
<p class="last"><a class="reference internal" href="../guides/creating_mozilla_pot_files.html"><em>Creating Mozilla POT files</em></a>.</p>
</div>
<p>After extracting the en-US l10n files, you can run the following command:</p>
<div class="highlight-python"><pre>moz2po -P l10n/en-US pot</pre>
</div>
<p>This creates a set of POT (<tt class="docutils literal"><span class="pre">-P</span></tt>) files in the <tt class="docutils literal"><span class="pre">pot</span></tt> directory from the
Mozilla files in <tt class="docutils literal"><span class="pre">l10n/en-US</span></tt>.</p>
<div class="highlight-python"><pre>moz2po -P en-US.xpi pot</pre>
</div>
<p>Creating set of POT (<tt class="docutils literal"><span class="pre">-P</span></tt>) files from the American English XPI
(<tt class="docutils literal"><span class="pre">en-US.xpi</span></tt>) and placing them in <tt class="docutils literal"><span class="pre">pot</span></tt> for use as PO Templates.</p>
<p>If you want to create a set of POT files with another base language try the
following:</p>
<div class="highlight-python"><pre>moz2po -P fr-FR.xpi fr-pot</pre>
</div>
<p>This will create a set of POT files in <tt class="docutils literal"><span class="pre">fr-pot</span></tt> that have French as your
source language.</p>
</div>
<div class="section" id="creating-po-files-from-existing-non-po-translations">
<span id="moz2po-creating-po-files-from-existing-non-po-translations"></span><h3>Creating PO files from existing non-PO translations<a class="headerlink" href="#creating-po-files-from-existing-non-po-translations" title="Permalink to this headline">¶</a></h3>
<p>If you have existing translations (Mozilla related or other Babelzilla files)
and you wish to convert them to PO for future translation then the following
generic instructions will work:</p>
<div class="highlight-python"><pre>moz2po -t en-US af-ZA af-ZA_pofiles</pre>
</div>
<p>This will combine the untranslated template en-US files from <tt class="docutils literal"><span class="pre">en-US</span></tt> combine
them with your existing translations in <tt class="docutils literal"><span class="pre">af-ZA</span></tt> and output PO files to
<tt class="docutils literal"><span class="pre">af-ZA_pofiles</span></tt>.</p>
<div class="highlight-python"><pre>moz2po -t l10n/fr l10n/xh po/xh</pre>
</div>
<p>For those who are not English fluent you can do the same with another
languages.  In this case <tt class="docutils literal"><span class="pre">msgid</span></tt> will contain the French text from
<tt class="docutils literal"><span class="pre">l10n/fr</span></tt>.  This is useful for translating where the translators other
languages is not English but French, Spanish or Portuguese.  Please make sure
that the source languages i.e. the <tt class="docutils literal"><span class="pre">msgid</span></tt> language is fully translated as
against en-US.</p>
</div>
<div class="section" id="creating-an-xpi-or-cvs-ready-translations">
<span id="moz2po-creating-an-xpi-or-cvs-ready-translations"></span><h3>Creating an XPI or CVS ready translations<a class="headerlink" href="#creating-an-xpi-or-cvs-ready-translations" title="Permalink to this headline">¶</a></h3>
<div class="highlight-python"><pre>po2moz -lzu-ZA -t en-US.xpi zu zu-ZA.xpi</pre>
</div>
<p>Create a Zulu language (<tt class="docutils literal"><span class="pre">-lzu-ZA</span></tt>) XPI called <tt class="docutils literal"><span class="pre">zu-ZA.xpi</span></tt> from translations
found in <tt class="docutils literal"><span class="pre">zu</span></tt> using <tt class="docutils literal"><span class="pre">en-US.xpi</span></tt> as a template.  We use a template to ensure
that our DTD and .properties files appear exactly as those in en-US:</p>
<div class="highlight-python"><pre>po2moz -t l10n/en-US po/xh l10n/xh</pre>
</div>
<p>Create Mozilla files using the templates files in <tt class="docutils literal"><span class="pre">l10n/en-US</span></tt> (see above for
how to create them) with PO translations in <tt class="docutils literal"><span class="pre">po/xh</span></tt> and ouput them to
<tt class="docutils literal"><span class="pre">l10n/xh</span></tt>.  The files now in <tt class="docutils literal"><span class="pre">l10n/xh</span></tt> are ready for submission to Mozilla
and can be used to build a language pack or translated version of Mozilla.</p>
</div>
</div>
<div class="section" id="issues">
<span id="moz2po-issues"></span><h2>Issues<a class="headerlink" href="#issues" title="Permalink to this headline">¶</a></h2>
<p>You can perform the bulk of your work (99%) with moz2po.</p>
<p>Localisation of XHTML is not yet perfect, you might want to work with the files
directly.</p>
<p><a class="reference external" href="http://bugs.locamotion.org/show_bug.cgi?id=129">Bug 129</a> tracks the outstanding features which would allow complete
localisation of Mozilla including; all help, start pages, rdf files, etc. It
also tracks some bugs.</p>
<p>Accesskeys don&#8217;t yet work in .properties files and in several cases where the
Mozilla .dtd files don&#8217;t follow the normal conventions, for example in
<tt class="docutils literal"><span class="pre">security/manager/chrome/pippki/pref-ssl.dtd.po</span></tt>. You might also want to
check the files mentioned in this Mozilla bug <a class="reference external" href="https://bugzilla.mozilla.org/show_bug.cgi?id=329444">329444</a> where mistakes in the
DTD-definitions cause problems in the matching of accelerators with the text.</p>
<p>You might want to give special attention to the following files since it
contains customisations that are not really translations.</p>
<ul class="simple">
<li>mail/chrome/messenger/downloadheaders.dtd.po</li>
<li>toolkit/chrome/global/intl.properties.po</li>
</ul>
<p>Also, all width, height and size specifications need to be edited with feedback
from testing the translated interfaces.</p>
<p>There are some constructed strings in the Mozilla code which we can&#8217;t do much
about. Take good care to read the localisation notes. For an example, see
<tt class="docutils literal"><span class="pre">mail/chrome/messenger/downloadheaders.dtd.po</span></tt>. In that specific file, the
localisation note from the DTD file is lost, so take good care of those.</p>
<p>The file extension of the original Mozilla file is required to tell the Toolkit
how to do the conversion.  Therefore, a file like foo.dtd must be named
foo.dtd.po in order to <a class="reference internal" href=""><em>po2moz</em></a> to recognise it as a DTD file.</p>
</div>
</div>


</div>
<hr>

<footer class="footer">
  <div class="container">
    <p class="pull-right"><a href="#">Back to top ↑</a></p>
    <ul class="unstyled muted">
      <li><small>
        &copy; 2012, Translate.org.za.<br/>
      </small></li>
      <li><small>
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
      </small></li>
    </ul>
  </div>
</footer>
  </body>
</html>