<!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>tmserver — 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="poterminology" href="poterminology.html" /> <link rel="prev" title="junitmsgfmt" href="junitmsgfmt.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="#">tmserver</a><ul> <li><a class="reference internal" href="#usage">Usage</a></li> <li><a class="reference internal" href="#testing">Testing</a></li> </ul> </li> </ul> </ul> </li> <li><a href="junitmsgfmt.html" title="previous chapter">« junitmsgfmt</a></li> <li><a href="poterminology.html" title="next chapter">poterminology »</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="tmserver"> <span id="id1"></span><h1>tmserver<a class="headerlink" href="#tmserver" title="Permalink to this headline">¶</a></h1> <p>tmserver is a Translation Memory service that can be queried via HTTP using a simple REST like URL/http and data is exchanged between server and client encoded in JSON</p> <div class="section" id="usage"> <span id="tmserver-usage"></span><h2>Usage<a class="headerlink" href="#usage" title="Permalink to this headline">¶</a></h2> <div class="highlight-python"><pre>tmserver.py --bind=HOSTNAME --port=PORT [--tmdb=TMDBFILE] [--import-translation-file=TMFILE [--import-source-lang=SOURCE_LANG] [--import-target-lang=TARGET_LANG]]</pre> </div> <p>Where:</p> <table border="1" class="docutils"> <colgroup> <col width="14%" /> <col width="86%" /> </colgroup> <tbody valign="top"> <tr class="row-odd"><td>TMDBFILE</td> <td>is the SQLite database file containing translation memory data, if not specified a new temporary database is created</td> </tr> <tr class="row-even"><td>TMFILE</td> <td>is a translation file (po, xliff, etc.) that should be imported into the database (mostly useful when no tmdb file is specified).</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">-h</span>, <span class="option">--help</span></kbd></td> <td>show this help message and exit</td></tr> <tr><td class="option-group" colspan="2"> <kbd><span class="option">-d <var>TMDBFILE</var></span>, <span class="option">--tmdb=<var>TMDBFILE</var></span></kbd></td> </tr> <tr><td> </td><td>translation memory database file</td></tr> <tr><td class="option-group" colspan="2"> <kbd><span class="option">-f <var>TMFILES</var></span>, <span class="option">--import-translation-file=<var>TMFILES</var></span></kbd></td> </tr> <tr><td> </td><td>translation file to import into the database</td></tr> <tr><td class="option-group" colspan="2"> <kbd><span class="option">-t <var>TARGET_LANG</var></span>, <span class="option">--import-target-lang=<var>TARGET_LANG</var></span></kbd></td> </tr> <tr><td> </td><td>target language of translation files</td></tr> <tr><td class="option-group" colspan="2"> <kbd><span class="option">-s <var>SOURCE_LANG</var></span>, <span class="option">--import-source-lang=<var>SOURCE_LANG</var></span></kbd></td> </tr> <tr><td> </td><td>source language of translation files</td></tr> <tr><td class="option-group" colspan="2"> <kbd><span class="option">-b <var>BIND</var></span>, <span class="option">--bind=<var>BIND</var></span></kbd></td> </tr> <tr><td> </td><td>adress to bind server to (default: localhost)</td></tr> <tr><td class="option-group" colspan="2"> <kbd><span class="option">-p <var>PORT</var></span>, <span class="option">--port=<var>PORT</var></span></kbd></td> </tr> <tr><td> </td><td>port to listen on (default: 8888)</td></tr> <tr><td class="option-group" colspan="2"> <kbd><span class="option">--max-candidates=<var>MAX_CANDIDATES</var></span></kbd></td> </tr> <tr><td> </td><td>Maximum number of candidates</td></tr> <tr><td class="option-group" colspan="2"> <kbd><span class="option">--min-similarity=<var>MIN_SIMILARITY</var></span></kbd></td> </tr> <tr><td> </td><td>minimum similarity</td></tr> <tr><td class="option-group" colspan="2"> <kbd><span class="option">--max-length=<var>MAX_LENGTH</var></span></kbd></td> </tr> <tr><td> </td><td>Maxmimum string length</td></tr> <tr><td class="option-group"> <kbd><span class="option">--debug</span></kbd></td> <td>enable debugging features</td></tr> </tbody> </table> </div> <div class="section" id="testing"> <span id="tmserver-testing"></span><h2>Testing<a class="headerlink" href="#testing" title="Permalink to this headline">¶</a></h2> <p>easiest way to run the server for testing is to pass it a large translation file (maybe generated by <a class="reference internal" href="pocompendium.html"><em>pocompendium</em></a>) to create a tmdb database on the fly.</p> <div class="highlight-python"><pre>tmserver -b localhost -p 8080 -f compendium.po -s en_US -t ar</pre> </div> <p>The server can be queried using a webbrowser. the url would be:</p> <div class="highlight-python"><pre>http://HOST:PORT/tmserver/SOURCE_LANG/TARGET_LANG/unit/STRING</pre> </div> <p>So to see suggestions for “open file” try the url <a class="reference external" href="http://localhost:8080/tmserver/en_US/ar/unit/open+file">http://localhost:8080/tmserver/en_US/ar/unit/open+file</a></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> © 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>