translation.html 7.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  6. <title>Translation &#8212; searx 0.12.0 documentation</title>
  7. <link rel="stylesheet" href="../_static/style.css" type="text/css" />
  8. <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
  9. <script type="text/javascript">
  10. var DOCUMENTATION_OPTIONS = {
  11. URL_ROOT: '../',
  12. VERSION: '0.12.0',
  13. COLLAPSE_INDEX: false,
  14. FILE_SUFFIX: '.html',
  15. HAS_SOURCE: true,
  16. SOURCELINK_SUFFIX: '.txt'
  17. };
  18. </script>
  19. <script type="text/javascript" src="../_static/jquery.js"></script>
  20. <script type="text/javascript" src="../_static/underscore.js"></script>
  21. <script type="text/javascript" src="../_static/doctools.js"></script>
  22. <link rel="index" title="Index" href="../genindex.html" />
  23. <link rel="search" title="Search" href="../search.html" />
  24. <link rel="prev" title="Plugins" href="plugins.html" />
  25. <link media="only screen and (max-device-width: 480px)" href="../_static/small_flask.css" type= "text/css" rel="stylesheet" />
  26. <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9">
  27. </head>
  28. <body>
  29. <div class="document">
  30. <div class="documentwrapper">
  31. <div class="bodywrapper">
  32. <div class="body" role="main">
  33. <div class="section" id="translation">
  34. <h1>Translation<a class="headerlink" href="#translation" title="Permalink to this headline">¶</a></h1>
  35. <div class="section" id="requirements">
  36. <h2>Requirements<a class="headerlink" href="#requirements" title="Permalink to this headline">¶</a></h2>
  37. <blockquote>
  38. <div><ul class="simple">
  39. <li>Transifex account</li>
  40. <li>Installed CLI tool of Transifex</li>
  41. </ul>
  42. </div></blockquote>
  43. </div>
  44. <div class="section" id="init-transifex-project">
  45. <h2>Init Transifex project<a class="headerlink" href="#init-transifex-project" title="Permalink to this headline">¶</a></h2>
  46. <p>After installing <code class="docutils literal"><span class="pre">transifex</span></code> using pip, run the following command to initialize the project.</p>
  47. <div class="code shell highlight-default"><div class="highlight"><pre><span></span><span class="n">tx</span> <span class="n">init</span> <span class="c1"># Transifex instance: https://www.transifex.com/asciimoo/searx/</span>
  48. </pre></div>
  49. </div>
  50. <p>After <code class="docutils literal"><span class="pre">$HOME/.transifexrc</span></code> is created, get a Transifex API key and insert it into the configuration file.</p>
  51. <p>Create a configuration file for <code class="docutils literal"><span class="pre">tx</span></code> named <code class="docutils literal"><span class="pre">$HOME/.tx/config</span></code>.</p>
  52. <div class="code shell highlight-default"><div class="highlight"><pre><span></span><span class="p">[</span><span class="n">main</span><span class="p">]</span>
  53. <span class="n">host</span> <span class="o">=</span> <span class="n">https</span><span class="p">:</span><span class="o">//</span><span class="n">www</span><span class="o">.</span><span class="n">transifex</span><span class="o">.</span><span class="n">com</span>
  54. <span class="p">[</span><span class="n">searx</span><span class="o">.</span><span class="n">messagespo</span><span class="p">]</span>
  55. <span class="n">file_filter</span> <span class="o">=</span> <span class="n">searx</span><span class="o">/</span><span class="n">translations</span><span class="o">/&lt;</span><span class="n">lang</span><span class="o">&gt;/</span><span class="n">LC_MESSAGES</span><span class="o">/</span><span class="n">messages</span><span class="o">.</span><span class="n">po</span>
  56. <span class="n">source_file</span> <span class="o">=</span> <span class="n">messages</span><span class="o">.</span><span class="n">pot</span>
  57. <span class="n">source_lang</span> <span class="o">=</span> <span class="n">en</span>
  58. <span class="nb">type</span> <span class="o">=</span> <span class="n">PO</span>
  59. </pre></div>
  60. </div>
  61. <p>Then run <code class="docutils literal"><span class="pre">tx</span> <span class="pre">set</span></code>:</p>
  62. <div class="code shell highlight-default"><div class="highlight"><pre><span></span><span class="n">tx</span> <span class="nb">set</span> <span class="o">--</span><span class="n">auto</span><span class="o">-</span><span class="n">local</span> <span class="o">-</span><span class="n">r</span> <span class="n">searx</span><span class="o">.</span><span class="n">messagespo</span> <span class="s1">&#39;searx/translations/&lt;lang&gt;/LC_MESSAGES/messages.po&#39;</span> \
  63. <span class="o">--</span><span class="n">source</span><span class="o">-</span><span class="n">lang</span> <span class="n">en</span> <span class="o">--</span><span class="nb">type</span> <span class="n">PO</span> <span class="o">--</span><span class="n">source</span><span class="o">-</span><span class="n">file</span> <span class="n">messages</span><span class="o">.</span><span class="n">pot</span> <span class="o">--</span><span class="n">execute</span>
  64. </pre></div>
  65. </div>
  66. </div>
  67. <div class="section" id="update-translations">
  68. <h2>Update translations<a class="headerlink" href="#update-translations" title="Permalink to this headline">¶</a></h2>
  69. <p>To retrieve the latest translations, pull it from Transifex.</p>
  70. <div class="code shell highlight-default"><div class="highlight"><pre><span></span><span class="n">tx</span> <span class="n">pull</span> <span class="o">-</span><span class="n">a</span>
  71. </pre></div>
  72. </div>
  73. <p>Then check the new languages. If strings translated are not enough, delete those folders, because
  74. those should not be compiled. Call the command below to compile the <code class="docutils literal"><span class="pre">.po</span></code> files.</p>
  75. <div class="code shell highlight-default"><div class="highlight"><pre><span></span><span class="n">pybabel</span> <span class="nb">compile</span> <span class="o">-</span><span class="n">d</span> <span class="n">searx</span><span class="o">/</span><span class="n">translations</span>
  76. </pre></div>
  77. </div>
  78. <p>After the compilation is finished commit the <code class="docutils literal"><span class="pre">.po</span></code> and <code class="docutils literal"><span class="pre">.mo</span></code> files and create a PR.</p>
  79. </div>
  80. </div>
  81. </div>
  82. </div>
  83. </div>
  84. <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
  85. <div class="sphinxsidebarwrapper"><div class="sidebar_container body">
  86. <h1>Searx</h1>
  87. <ul>
  88. <li><a href="../index.html">Home</a></li>
  89. <li><a href="https://github.com/asciimoo/searx">Source</a></li>
  90. <li><a href="../blog/blog.html">Blog</a></li>
  91. <li><a href="https://github.com/asciimoo/searx/wiki">Wiki</a></li>
  92. <li><a href="https://github.com/asciimoo/searx/wiki/Searx-instances">Public instances</a></li>
  93. </ul>
  94. <hr />
  95. <ul>
  96. <li><a href="https://twitter.com/Searx_engine">Twitter</a></li>
  97. </ul>
  98. </div>
  99. </div>
  100. </div>
  101. <div class="clearer"></div>
  102. </div>
  103. <div class="footer">
  104. &copy; Copyright 2015-2017, Adam Tauber.
  105. </div>
  106. </body>
  107. </html>