translation.html 8.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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="X-UA-Compatible" content="IE=Edge" />
  6. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  7. <title>Translation &#8212; searx 0.12.0 documentation</title>
  8. <link rel="stylesheet" href="../_static/style.css" type="text/css" />
  9. <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
  10. <script type="text/javascript" src="../_static/documentation_options.js"></script>
  11. <script type="text/javascript" src="../_static/jquery.js"></script>
  12. <script type="text/javascript" src="../_static/underscore.js"></script>
  13. <script type="text/javascript" src="../_static/doctools.js"></script>
  14. <link rel="index" title="Index" href="../genindex.html" />
  15. <link rel="search" title="Search" href="../search.html" />
  16. <link rel="prev" title="Plugins" href="plugins.html" />
  17. <link media="only screen and (max-device-width: 480px)" href="../_static/small_flask.css" type= "text/css" rel="stylesheet" />
  18. <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9">
  19. </head><body>
  20. <div class="document">
  21. <div class="documentwrapper">
  22. <div class="bodywrapper">
  23. <div class="body" role="main">
  24. <div class="section" id="translation">
  25. <h1>Translation<a class="headerlink" href="#translation" title="Permalink to this headline">¶</a></h1>
  26. <div class="section" id="requirements">
  27. <h2>Requirements<a class="headerlink" href="#requirements" title="Permalink to this headline">¶</a></h2>
  28. <blockquote>
  29. <div><ul class="simple">
  30. <li>Transifex account</li>
  31. <li>Installed CLI tool of Transifex</li>
  32. </ul>
  33. </div></blockquote>
  34. </div>
  35. <div class="section" id="init-transifex-project">
  36. <h2>Init Transifex project<a class="headerlink" href="#init-transifex-project" title="Permalink to this headline">¶</a></h2>
  37. <p>After installing <code class="docutils literal notranslate"><span class="pre">transifex</span></code> using pip, run the following command to initialize the project.</p>
  38. <div class="code shell highlight-default notranslate"><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>
  39. </pre></div>
  40. </div>
  41. <p>After <code class="docutils literal notranslate"><span class="pre">$HOME/.transifexrc</span></code> is created, get a Transifex API key and insert it into the configuration file.</p>
  42. <p>Create a configuration file for <code class="docutils literal notranslate"><span class="pre">tx</span></code> named <code class="docutils literal notranslate"><span class="pre">$HOME/.tx/config</span></code>.</p>
  43. <div class="code shell highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">[</span><span class="n">main</span><span class="p">]</span>
  44. <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>
  45. <span class="p">[</span><span class="n">searx</span><span class="o">.</span><span class="n">messagespo</span><span class="p">]</span>
  46. <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>
  47. <span class="n">source_file</span> <span class="o">=</span> <span class="n">messages</span><span class="o">.</span><span class="n">pot</span>
  48. <span class="n">source_lang</span> <span class="o">=</span> <span class="n">en</span>
  49. <span class="nb">type</span> <span class="o">=</span> <span class="n">PO</span>
  50. </pre></div>
  51. </div>
  52. <p>Then run <code class="docutils literal notranslate"><span class="pre">tx</span> <span class="pre">set</span></code>:</p>
  53. <div class="code shell highlight-default notranslate"><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> \
  54. <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>
  55. </pre></div>
  56. </div>
  57. </div>
  58. <div class="section" id="update-translations">
  59. <h2>Update translations<a class="headerlink" href="#update-translations" title="Permalink to this headline">¶</a></h2>
  60. <p>To retrieve the latest translations, pull it from Transifex.</p>
  61. <div class="code shell highlight-default notranslate"><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>
  62. </pre></div>
  63. </div>
  64. <p>Then check the new languages. If strings translated are not enough, delete those folders, because
  65. those should not be compiled. Call the command below to compile the <code class="docutils literal notranslate"><span class="pre">.po</span></code> files.</p>
  66. <div class="code shell highlight-default notranslate"><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>
  67. </pre></div>
  68. </div>
  69. <p>After the compilation is finished commit the <code class="docutils literal notranslate"><span class="pre">.po</span></code> and <code class="docutils literal notranslate"><span class="pre">.mo</span></code> files and create a PR.</p>
  70. </div>
  71. </div>
  72. </div>
  73. </div>
  74. </div>
  75. <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
  76. <div class="sphinxsidebarwrapper">
  77. <h3><a href="../index.html">Table Of Contents</a></h3>
  78. <ul>
  79. <li><a class="reference internal" href="#">Translation</a><ul>
  80. <li><a class="reference internal" href="#requirements">Requirements</a></li>
  81. <li><a class="reference internal" href="#init-transifex-project">Init Transifex project</a></li>
  82. <li><a class="reference internal" href="#update-translations">Update translations</a></li>
  83. </ul>
  84. </li>
  85. </ul>
  86. <div class="sidebar_container body">
  87. <h1>Searx</h1>
  88. <ul>
  89. <li><a href="../index.html">Home</a></li>
  90. <li><a href="https://github.com/asciimoo/searx">Source</a></li>
  91. <li><a href="../blog/blog.html">Blog</a></li>
  92. <li><a href="https://github.com/asciimoo/searx/wiki">Wiki</a></li>
  93. <li><a href="https://github.com/asciimoo/searx/wiki/Searx-instances">Public instances</a></li>
  94. </ul>
  95. <hr />
  96. <ul>
  97. <li><a href="https://twitter.com/Searx_engine">Twitter</a></li>
  98. </ul>
  99. </div>
  100. <div role="note" aria-label="source link">
  101. <h3>This Page</h3>
  102. <ul class="this-page-menu">
  103. <li><a href="../_sources/dev/translation.rst.txt"
  104. rel="nofollow">Show Source</a></li>
  105. </ul>
  106. </div>
  107. <div id="searchbox" style="display: none" role="search">
  108. <h3>Quick search</h3>
  109. <div class="searchformwrapper">
  110. <form class="search" action="../search.html" method="get">
  111. <input type="text" name="q" />
  112. <input type="submit" value="Go" />
  113. <input type="hidden" name="check_keywords" value="yes" />
  114. <input type="hidden" name="area" value="default" />
  115. </form>
  116. </div>
  117. </div>
  118. <script type="text/javascript">$('#searchbox').show(0);</script>
  119. </div>
  120. </div>
  121. <div class="clearer"></div>
  122. </div>
  123. <div class="footer">
  124. &copy; Copyright 2015-2017, Adam Tauber.
  125. </div>
  126. </body>
  127. </html>