Browse Source

generated files of updated Translation page

Noémi Ványi 7 years ago
parent
commit
e149103e11
2 changed files with 55 additions and 92 deletions
  1. 25
    44
      _sources/dev/translation.txt
  2. 30
    48
      dev/translation.html

+ 25
- 44
_sources/dev/translation.txt View File

@@ -1,80 +1,61 @@
1 1
 Translation
2 2
 ===========
3 3
 
4
-run these commands in the root directory of searx
4
+Requirements
5
+------------
5 6
 
6
-Add new language
7
-~~~~~~~~~~~~~~~~
7
+ * Transifex account
8 8
 
9
-.. code:: shell
9
+ * Installed CLI tool of Transifex
10 10
 
11
-    pybabel init -i messages.pot -d searx/translations -l it
11
+Init Transifex project
12
+----------------------
12 13
 
13
-Update .po files
14
-~~~~~~~~~~~~~~~~
14
+After installing ``transifex`` using pip, run the following command to initialize the project.
15 15
 
16 16
 .. code:: shell
17 17
 
18
-    ./utils/update-translations.sh
18
+    tx init # Transifex instance: https://www.transifex.com/asciimoo/searx/
19 19
 
20
-You may have errors here. In that case, edit the
21
-``update-translations.sh`` script to change ``pybabel`` to
22
-``pybabel-python2`` or ``pybabel2``
23 20
 
24
-After this step, you can modify the .po files.
21
+After ``$HOME/.transifexrc`` is created, get a Transifex API key and insert it into the configuration file.
25 22
 
26
-Compile translations
27
-~~~~~~~~~~~~~~~~~~~~
23
+Create a configuration file for ``tx`` named ``$HOME/.tx/config``.
28 24
 
29 25
 .. code:: shell
30 26
 
31
-    pybabel compile -d searx/translations
27
+    [main]
28
+    host = https://www.transifex.com
29
+    [searx.messagespo]
30
+    file_filter = searx/translations/<lang>/LC_MESSAGES/messages.po
31
+    source_file = messages.pot
32
+    source_lang = en
33
+    type = PO
32 34
 
33
-Transifex stuff
34
-~~~~~~~~~~~~~~~
35 35
 
36
-Init Project
37
-^^^^^^^^^^^^
36
+Then run ``tx set``:
38 37
 
39 38
 .. code:: shell
40 39
 
41
-    tx init # Transifex instance: https://www.transifex.com/asciimoo/searx/
42
-
43 40
     tx set --auto-local -r searx.messagespo 'searx/translations/<lang>/LC_MESSAGES/messages.po' \
44 41
     --source-lang en --type PO --source-file messages.pot --execute
45 42
 
46
-http://docs.transifex.com/client/init/
47 43
 
48
-http://docs.transifex.com/client/set/
44
+Update translations
45
+-------------------
49 46
 
50
-Get translations
51
-^^^^^^^^^^^^^^^^
47
+To retrieve the latest translations, pull it from Transifex.
52 48
 
53 49
 .. code:: shell
54 50
 
55 51
     tx pull -a
56 52
 
57
-http://docs.transifex.com/client/pull
58
-
59
-Upload source File
60
-^^^^^^^^^^^^^^^^^^
61
-
62
-.. code:: shell
63
-
64
-    tx push -s
65
-
66
-Upload all Translation
67
-^^^^^^^^^^^^^^^^^^^^^^
53
+Then check the new languages. If strings translated are not enough, delete those folders, because
54
+those should not be compiled. Call the command below to compile the ``.po`` files.
68 55
 
69 56
 .. code:: shell
70 57
 
71
-    tx push -s -t
72
-
73
-upload specifc Translation
74
-~~~~~~~~~~~~~~~~~~~~~~~~~~
75
-
76
-.. code:: shell
58
+    pybabel compile -d searx/translations
77 59
 
78
-    tx push -t -l tr
79 60
 
80
-http://docs.transifex.com/client/push
61
+After the compilation is finished commit the ``.po`` and ``.mo`` files and create a PR.

+ 30
- 48
dev/translation.html View File

@@ -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">/&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>
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">&#39;searx/translations/&lt;lang&gt;/LC_MESSAGES/messages.po&#39;</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">&#39;searx/translations/&lt;lang&gt;/LC_MESSAGES/messages.po&#39;</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