mirror of
https://github.com/searx/searx
synced 2024-11-19 08:29:41 +01:00
generated files of updated Translation page
This commit is contained in:
parent
6d2e372da0
commit
e149103e11
@ -1,80 +1,61 @@
|
||||
Translation
|
||||
===========
|
||||
|
||||
run these commands in the root directory of searx
|
||||
Requirements
|
||||
------------
|
||||
|
||||
Add new language
|
||||
~~~~~~~~~~~~~~~~
|
||||
* Transifex account
|
||||
|
||||
.. code:: shell
|
||||
* Installed CLI tool of Transifex
|
||||
|
||||
pybabel init -i messages.pot -d searx/translations -l it
|
||||
Init Transifex project
|
||||
----------------------
|
||||
|
||||
Update .po files
|
||||
~~~~~~~~~~~~~~~~
|
||||
|
||||
.. code:: shell
|
||||
|
||||
./utils/update-translations.sh
|
||||
|
||||
You may have errors here. In that case, edit the
|
||||
``update-translations.sh`` script to change ``pybabel`` to
|
||||
``pybabel-python2`` or ``pybabel2``
|
||||
|
||||
After this step, you can modify the .po files.
|
||||
|
||||
Compile translations
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. code:: shell
|
||||
|
||||
pybabel compile -d searx/translations
|
||||
|
||||
Transifex stuff
|
||||
~~~~~~~~~~~~~~~
|
||||
|
||||
Init Project
|
||||
^^^^^^^^^^^^
|
||||
After installing ``transifex`` using pip, run the following command to initialize the project.
|
||||
|
||||
.. code:: shell
|
||||
|
||||
tx init # Transifex instance: https://www.transifex.com/asciimoo/searx/
|
||||
|
||||
|
||||
After ``$HOME/.transifexrc`` is created, get a Transifex API key and insert it into the configuration file.
|
||||
|
||||
Create a configuration file for ``tx`` named ``$HOME/.tx/config``.
|
||||
|
||||
.. code:: shell
|
||||
|
||||
[main]
|
||||
host = https://www.transifex.com
|
||||
[searx.messagespo]
|
||||
file_filter = searx/translations/<lang>/LC_MESSAGES/messages.po
|
||||
source_file = messages.pot
|
||||
source_lang = en
|
||||
type = PO
|
||||
|
||||
|
||||
Then run ``tx set``:
|
||||
|
||||
.. code:: shell
|
||||
|
||||
tx set --auto-local -r searx.messagespo 'searx/translations/<lang>/LC_MESSAGES/messages.po' \
|
||||
--source-lang en --type PO --source-file messages.pot --execute
|
||||
|
||||
http://docs.transifex.com/client/init/
|
||||
|
||||
http://docs.transifex.com/client/set/
|
||||
Update translations
|
||||
-------------------
|
||||
|
||||
Get translations
|
||||
^^^^^^^^^^^^^^^^
|
||||
To retrieve the latest translations, pull it from Transifex.
|
||||
|
||||
.. code:: shell
|
||||
|
||||
tx pull -a
|
||||
|
||||
http://docs.transifex.com/client/pull
|
||||
|
||||
Upload source File
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
Then check the new languages. If strings translated are not enough, delete those folders, because
|
||||
those should not be compiled. Call the command below to compile the ``.po`` files.
|
||||
|
||||
.. code:: shell
|
||||
|
||||
tx push -s
|
||||
pybabel compile -d searx/translations
|
||||
|
||||
Upload all Translation
|
||||
^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. code:: shell
|
||||
|
||||
tx push -s -t
|
||||
|
||||
upload specifc Translation
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. code:: shell
|
||||
|
||||
tx push -t -l tr
|
||||
|
||||
http://docs.transifex.com/client/push
|
||||
After the compilation is finished commit the ``.po`` and ``.mo`` files and create a PR.
|
||||
|
@ -42,68 +42,50 @@
|
||||
|
||||
<div class="section" id="translation">
|
||||
<h1>Translation<a class="headerlink" href="#translation" title="Permalink to this headline">¶</a></h1>
|
||||
<p>run these commands in the root directory of searx</p>
|
||||
<div class="section" id="add-new-language">
|
||||
<h2>Add new language<a class="headerlink" href="#add-new-language" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="code shell highlight-default"><div class="highlight"><pre><span></span><span class="n">pybabel</span> <span class="n">init</span> <span class="o">-</span><span class="n">i</span> <span class="n">messages</span><span class="o">.</span><span class="n">pot</span> <span class="o">-</span><span class="n">d</span> <span class="n">searx</span><span class="o">/</span><span class="n">translations</span> <span class="o">-</span><span class="n">l</span> <span class="n">it</span>
|
||||
</pre></div>
|
||||
<div class="section" id="requirements">
|
||||
<h2>Requirements<a class="headerlink" href="#requirements" title="Permalink to this headline">¶</a></h2>
|
||||
<blockquote>
|
||||
<div><ul class="simple">
|
||||
<li>Transifex account</li>
|
||||
<li>Installed CLI tool of Transifex</li>
|
||||
</ul>
|
||||
</div></blockquote>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="update-po-files">
|
||||
<h2>Update .po files<a class="headerlink" href="#update-po-files" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="code shell highlight-default"><div class="highlight"><pre><span></span><span class="o">./</span><span class="n">utils</span><span class="o">/</span><span class="n">update</span><span class="o">-</span><span class="n">translations</span><span class="o">.</span><span class="n">sh</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>You may have errors here. In that case, edit the
|
||||
<code class="docutils literal"><span class="pre">update-translations.sh</span></code> script to change <code class="docutils literal"><span class="pre">pybabel</span></code> to
|
||||
<code class="docutils literal"><span class="pre">pybabel-python2</span></code> or <code class="docutils literal"><span class="pre">pybabel2</span></code></p>
|
||||
<p>After this step, you can modify the .po files.</p>
|
||||
</div>
|
||||
<div class="section" id="compile-translations">
|
||||
<h2>Compile translations<a class="headerlink" href="#compile-translations" title="Permalink to this headline">¶</a></h2>
|
||||
<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>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="transifex-stuff">
|
||||
<h2>Transifex stuff<a class="headerlink" href="#transifex-stuff" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="section" id="init-project">
|
||||
<h3>Init Project<a class="headerlink" href="#init-project" title="Permalink to this headline">¶</a></h3>
|
||||
<div class="section" id="init-transifex-project">
|
||||
<h2>Init Transifex project<a class="headerlink" href="#init-transifex-project" title="Permalink to this headline">¶</a></h2>
|
||||
<p>After installing <code class="docutils literal"><span class="pre">transifex</span></code> using pip, run the following command to initialize the project.</p>
|
||||
<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>
|
||||
|
||||
<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">'searx/translations/<lang>/LC_MESSAGES/messages.po'</span> \
|
||||
</pre></div>
|
||||
</div>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<span class="p">[</span><span class="n">searx</span><span class="o">.</span><span class="n">messagespo</span><span class="p">]</span>
|
||||
<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">/<</span><span class="n">lang</span><span class="o">>/</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>
|
||||
<span class="n">source_file</span> <span class="o">=</span> <span class="n">messages</span><span class="o">.</span><span class="n">pot</span>
|
||||
<span class="n">source_lang</span> <span class="o">=</span> <span class="n">en</span>
|
||||
<span class="nb">type</span> <span class="o">=</span> <span class="n">PO</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>Then run <code class="docutils literal"><span class="pre">tx</span> <span class="pre">set</span></code>:</p>
|
||||
<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">'searx/translations/<lang>/LC_MESSAGES/messages.po'</span> \
|
||||
<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>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p><a class="reference external" href="http://docs.transifex.com/client/init/">http://docs.transifex.com/client/init/</a></p>
|
||||
<p><a class="reference external" href="http://docs.transifex.com/client/set/">http://docs.transifex.com/client/set/</a></p>
|
||||
</div>
|
||||
<div class="section" id="get-translations">
|
||||
<h3>Get translations<a class="headerlink" href="#get-translations" title="Permalink to this headline">¶</a></h3>
|
||||
<div class="section" id="update-translations">
|
||||
<h2>Update translations<a class="headerlink" href="#update-translations" title="Permalink to this headline">¶</a></h2>
|
||||
<p>To retrieve the latest translations, pull it from Transifex.</p>
|
||||
<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>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p><a class="reference external" href="http://docs.transifex.com/client/pull">http://docs.transifex.com/client/pull</a></p>
|
||||
</div>
|
||||
<div class="section" id="upload-source-file">
|
||||
<h3>Upload source File<a class="headerlink" href="#upload-source-file" title="Permalink to this headline">¶</a></h3>
|
||||
<div class="code shell highlight-default"><div class="highlight"><pre><span></span><span class="n">tx</span> <span class="n">push</span> <span class="o">-</span><span class="n">s</span>
|
||||
<p>Then check the new languages. If strings translated are not enough, delete those folders, because
|
||||
those should not be compiled. Call the command below to compile the <code class="docutils literal"><span class="pre">.po</span></code> files.</p>
|
||||
<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>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="upload-all-translation">
|
||||
<h3>Upload all Translation<a class="headerlink" href="#upload-all-translation" title="Permalink to this headline">¶</a></h3>
|
||||
<div class="code shell highlight-default"><div class="highlight"><pre><span></span><span class="n">tx</span> <span class="n">push</span> <span class="o">-</span><span class="n">s</span> <span class="o">-</span><span class="n">t</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="upload-specifc-translation">
|
||||
<h2>upload specifc Translation<a class="headerlink" href="#upload-specifc-translation" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="code shell highlight-default"><div class="highlight"><pre><span></span><span class="n">tx</span> <span class="n">push</span> <span class="o">-</span><span class="n">t</span> <span class="o">-</span><span class="n">l</span> <span class="n">tr</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p><a class="reference external" href="http://docs.transifex.com/client/push">http://docs.transifex.com/client/push</a></p>
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user