<!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>poswap — 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="poclean" href="poclean.html" /> <link rel="prev" title="pocompile" href="pocompile.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="#">poswap</a><ul> <li><a class="reference internal" href="#usage">Usage</a></li> <li><a class="reference internal" href="#examples">Examples</a></li> <li><a class="reference internal" href="#issues">Issues</a></li> </ul> </li> </ul> </ul> </li> <li><a href="pocompile.html" title="previous chapter">« pocompile</a></li> <li><a href="poclean.html" title="next chapter">poclean »</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="poswap"> <span id="id1"></span><h1>poswap<a class="headerlink" href="#poswap" title="Permalink to this headline">¶</a></h1> <p>This tool builds a new translation file with the target text (translation) of the input file(s) as source language of the output file it creates.</p> <p>This makes it possible to have French as the source file for translation, rather than English. Note that this requires no change in the software project and is only a manipulation of the strings in the existing files. The only requirement for this tool is a French translation.</p> <p>It can also be used to convert translatable files that use logical IDs instead of source text into a format usable by human localisers.</p> <div class="section" id="usage"> <span id="poswap-usage"></span><h2>Usage<a class="headerlink" href="#usage" title="Permalink to this headline">¶</a></h2> <div class="highlight-python"><pre>poswap [options] <newsource> [-t current] <new></pre> </div> <p>Where:</p> <table border="1" class="docutils"> <colgroup> <col width="19%" /> <col width="81%" /> </colgroup> <tbody valign="top"> <tr class="row-odd"><td><newsource></td> <td>is the translations (preferably 100% translated) of the preferred source language (like French)</td> </tr> <tr class="row-even"><td><current></td> <td>is the (optional) current English based translation in your intended target language</td> </tr> <tr class="row-odd"><td><new></td> <td>is the intended output file / directory</td> </tr> </tbody> </table> <p>Options:</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’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> </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> </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> </td><td>read from INPUT in pot format</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> </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> </td><td>write to OUTPUT in po, 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> </td><td>read from TEMPLATE in po, pot 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">--reverse</span></kbd></td> <td>Do the inverse operation (converting back to a normal English based file). See the examples.</td></tr> </tbody> </table> </div> <div class="section" id="examples"> <span id="poswap-examples"></span><h2>Examples<a class="headerlink" href="#examples" title="Permalink to this headline">¶</a></h2> <p>Ensure that the two po files / directories correspond 100% to the same pot file before using this.</p> <p>To start a fresh Afrikaans (af) translation from Dutch (nl):</p> <div class="highlight-python"><pre>poswap nl.po nl-af.po</pre> </div> <p>This initialises a new, empty file nl-af.po with Dutch as the source language.</p> <p>To change the nl-af.po file back to the expected English based af.po:</p> <div class="highlight-python"><pre>poswap --reverse nl.po -t nl-af.po af.po</pre> </div> <p>To translate Kurdish (ku) through French (fr):</p> <div class="highlight-python"><pre>poswap -i fr/ -t ku/ -o fr-ku/</pre> </div> <p>This will take the existing (English based) Kurdish translation in ku/ and produce files in fr-ku with French as the source language and Kurdish as the target language.</p> <p>To convert the fr-ku files back to en-ku:</p> <div class="highlight-python"><pre>poswap --reverse -i fr/ -t fr-ku/ -o en-ku/</pre> </div> <p>This recreates the English based Kurdish translation from the French based files previously created in fr-ku/.</p> </div> <div class="section" id="issues"> <span id="poswap-issues"></span><h2>Issues<a class="headerlink" href="#issues" title="Permalink to this headline">¶</a></h2> <ul class="simple"> <li>Behaviour is undetermined if the two files don’t match 100%. If PO files are based in the same template, there should be no problem.</li> <li>We should probably be doing fuzzy matching in future to ease the migration over the lifetime of a changing French translation.</li> </ul> </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> © 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>