|
@@ -42,68 +42,50 @@
|
42
|
42
|
|
43
|
43
|
<div class="section" id="translation">
|
44
|
44
|
<h1>Translation<a class="headerlink" href="#translation" title="Permalink to this headline">¶</a></h1>
|
45
|
|
-<p>run these commands in the root directory of searx</p>
|
46
|
|
-<div class="section" id="add-new-language">
|
47
|
|
-<h2>Add new language<a class="headerlink" href="#add-new-language" title="Permalink to this headline">¶</a></h2>
|
48
|
|
-<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>
|
49
|
|
-</pre></div>
|
50
|
|
-</div>
|
|
45
|
+<div class="section" id="requirements">
|
|
46
|
+<h2>Requirements<a class="headerlink" href="#requirements" title="Permalink to this headline">¶</a></h2>
|
|
47
|
+<blockquote>
|
|
48
|
+<div><ul class="simple">
|
|
49
|
+<li>Transifex account</li>
|
|
50
|
+<li>Installed CLI tool of Transifex</li>
|
|
51
|
+</ul>
|
|
52
|
+</div></blockquote>
|
51
|
53
|
</div>
|
52
|
|
-<div class="section" id="update-po-files">
|
53
|
|
-<h2>Update .po files<a class="headerlink" href="#update-po-files" title="Permalink to this headline">¶</a></h2>
|
54
|
|
-<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>
|
|
54
|
+<div class="section" id="init-transifex-project">
|
|
55
|
+<h2>Init Transifex project<a class="headerlink" href="#init-transifex-project" title="Permalink to this headline">¶</a></h2>
|
|
56
|
+<p>After installing <code class="docutils literal"><span class="pre">transifex</span></code> using pip, run the following command to initialize the project.</p>
|
|
57
|
+<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>
|
55
|
58
|
</pre></div>
|
56
|
59
|
</div>
|
57
|
|
-<p>You may have errors here. In that case, edit the
|
58
|
|
-<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
|
59
|
|
-<code class="docutils literal"><span class="pre">pybabel-python2</span></code> or <code class="docutils literal"><span class="pre">pybabel2</span></code></p>
|
60
|
|
-<p>After this step, you can modify the .po files.</p>
|
61
|
|
-</div>
|
62
|
|
-<div class="section" id="compile-translations">
|
63
|
|
-<h2>Compile translations<a class="headerlink" href="#compile-translations" title="Permalink to this headline">¶</a></h2>
|
64
|
|
-<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>
|
|
60
|
+<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>
|
|
61
|
+<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>
|
|
62
|
+<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>
|
|
63
|
+<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>
|
|
64
|
+<span class="p">[</span><span class="n">searx</span><span class="o">.</span><span class="n">messagespo</span><span class="p">]</span>
|
|
65
|
+<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>
|
|
66
|
+<span class="n">source_file</span> <span class="o">=</span> <span class="n">messages</span><span class="o">.</span><span class="n">pot</span>
|
|
67
|
+<span class="n">source_lang</span> <span class="o">=</span> <span class="n">en</span>
|
|
68
|
+<span class="nb">type</span> <span class="o">=</span> <span class="n">PO</span>
|
65
|
69
|
</pre></div>
|
66
|
70
|
</div>
|
67
|
|
-</div>
|
68
|
|
-<div class="section" id="transifex-stuff">
|
69
|
|
-<h2>Transifex stuff<a class="headerlink" href="#transifex-stuff" title="Permalink to this headline">¶</a></h2>
|
70
|
|
-<div class="section" id="init-project">
|
71
|
|
-<h3>Init Project<a class="headerlink" href="#init-project" title="Permalink to this headline">¶</a></h3>
|
72
|
|
-<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>
|
73
|
|
-
|
74
|
|
-<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> \
|
|
71
|
+<p>Then run <code class="docutils literal"><span class="pre">tx</span> <span class="pre">set</span></code>:</p>
|
|
72
|
+<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> \
|
75
|
73
|
<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>
|
76
|
74
|
</pre></div>
|
77
|
75
|
</div>
|
78
|
|
-<p><a class="reference external" href="http://docs.transifex.com/client/init/">http://docs.transifex.com/client/init/</a></p>
|
79
|
|
-<p><a class="reference external" href="http://docs.transifex.com/client/set/">http://docs.transifex.com/client/set/</a></p>
|
80
|
76
|
</div>
|
81
|
|
-<div class="section" id="get-translations">
|
82
|
|
-<h3>Get translations<a class="headerlink" href="#get-translations" title="Permalink to this headline">¶</a></h3>
|
|
77
|
+<div class="section" id="update-translations">
|
|
78
|
+<h2>Update translations<a class="headerlink" href="#update-translations" title="Permalink to this headline">¶</a></h2>
|
|
79
|
+<p>To retrieve the latest translations, pull it from Transifex.</p>
|
83
|
80
|
<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>
|
84
|
81
|
</pre></div>
|
85
|
82
|
</div>
|
86
|
|
-<p><a class="reference external" href="http://docs.transifex.com/client/pull">http://docs.transifex.com/client/pull</a></p>
|
87
|
|
-</div>
|
88
|
|
-<div class="section" id="upload-source-file">
|
89
|
|
-<h3>Upload source File<a class="headerlink" href="#upload-source-file" title="Permalink to this headline">¶</a></h3>
|
90
|
|
-<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>
|
91
|
|
-</pre></div>
|
92
|
|
-</div>
|
93
|
|
-</div>
|
94
|
|
-<div class="section" id="upload-all-translation">
|
95
|
|
-<h3>Upload all Translation<a class="headerlink" href="#upload-all-translation" title="Permalink to this headline">¶</a></h3>
|
96
|
|
-<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>
|
97
|
|
-</pre></div>
|
98
|
|
-</div>
|
99
|
|
-</div>
|
100
|
|
-</div>
|
101
|
|
-<div class="section" id="upload-specifc-translation">
|
102
|
|
-<h2>upload specifc Translation<a class="headerlink" href="#upload-specifc-translation" title="Permalink to this headline">¶</a></h2>
|
103
|
|
-<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>
|
|
83
|
+<p>Then check the new languages. If strings translated are not enough, delete those folders, because
|
|
84
|
+those should not be compiled. Call the command below to compile the <code class="docutils literal"><span class="pre">.po</span></code> files.</p>
|
|
85
|
+<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>
|
104
|
86
|
</pre></div>
|
105
|
87
|
</div>
|
106
|
|
-<p><a class="reference external" href="http://docs.transifex.com/client/push">http://docs.transifex.com/client/push</a></p>
|
|
88
|
+<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>
|
107
|
89
|
</div>
|
108
|
90
|
</div>
|
109
|
91
|
|