Browse Source

Merge pull request #498 from pointhi/gh-pages

[enh] improve translation documentation
Adam Tauber 8 years ago
parent
commit
7483dd8877

+ 21
- 15
_sources/dev/translation.txt View File

6
 Add new language
6
 Add new language
7
 ~~~~~~~~~~~~~~~~
7
 ~~~~~~~~~~~~~~~~
8
 
8
 
9
-``pybabel init -i messages.pot -d searx/translations -l it``
9
+.. code:: shell
10
+
11
+    pybabel init -i messages.pot -d searx/translations -l it
10
 
12
 
11
 Update .po files
13
 Update .po files
12
 ~~~~~~~~~~~~~~~~
14
 ~~~~~~~~~~~~~~~~
13
 
15
 
14
-``./utils/update-translations.sh``
16
+.. code:: shell
17
+
18
+    ./utils/update-translations.sh
15
 
19
 
16
 You may have errors here. In that case, edit the
20
 You may have errors here. In that case, edit the
17
 ``update-translations.sh`` script to change ``pybabel`` to
21
 ``update-translations.sh`` script to change ``pybabel`` to
18
-``pybabel-python2``
22
+``pybabel-python2`` or ``pybabel2``
19
 
23
 
20
 After this step, you can modify the .po files.
24
 After this step, you can modify the .po files.
21
 
25
 
22
 Compile translations
26
 Compile translations
23
 ~~~~~~~~~~~~~~~~~~~~
27
 ~~~~~~~~~~~~~~~~~~~~
24
 
28
 
25
-``pybabel compile -d searx/translations``
29
+.. code:: shell
30
+
31
+    pybabel compile -d searx/translations
26
 
32
 
27
 Transifex stuff
33
 Transifex stuff
28
 ~~~~~~~~~~~~~~~
34
 ~~~~~~~~~~~~~~~
32
 
38
 
33
 .. code:: shell
39
 .. code:: shell
34
 
40
 
41
+    tx init # Transifex instance: https://www.transifex.com/asciimoo/searx/
42
+
35
     tx set --auto-local -r searx.messagespo 'searx/translations/<lang>/LC_MESSAGES/messages.po' \
43
     tx set --auto-local -r searx.messagespo 'searx/translations/<lang>/LC_MESSAGES/messages.po' \
36
     --source-lang en --type PO --source-file messages.pot --execute
44
     --source-lang en --type PO --source-file messages.pot --execute
37
 
45
 
38
-http://docs.transifex.com/developer/client/set
46
+http://docs.transifex.com/client/init/
39
 
47
 
40
-*TODO: mapping between transifex and searx*
48
+http://docs.transifex.com/client/set/
41
 
49
 
42
 Get translations
50
 Get translations
43
 ^^^^^^^^^^^^^^^^
51
 ^^^^^^^^^^^^^^^^
46
 
54
 
47
     tx pull -a
55
     tx pull -a
48
 
56
 
49
-http://docs.transifex.com/developer/client/pull
57
+http://docs.transifex.com/client/pull
50
 
58
 
51
 Upload source File
59
 Upload source File
52
 ^^^^^^^^^^^^^^^^^^
60
 ^^^^^^^^^^^^^^^^^^
53
 
61
 
54
-::
62
+.. code:: shell
55
 
63
 
56
     tx push -s
64
     tx push -s
57
 
65
 
58
 Upload all Translation
66
 Upload all Translation
59
 ^^^^^^^^^^^^^^^^^^^^^^
67
 ^^^^^^^^^^^^^^^^^^^^^^
60
 
68
 
61
-::
69
+.. code:: shell
62
 
70
 
63
     tx push -s -t
71
     tx push -s -t
64
 
72
 
65
-upload specifc Translation (only for admins)
66
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
73
+upload specifc Translation
74
+~~~~~~~~~~~~~~~~~~~~~~~~~~
67
 
75
 
68
-::
76
+.. code:: shell
69
 
77
 
70
     tx push -t -l tr
78
     tx push -t -l tr
71
 
79
 
72
-http://docs.transifex.com/developer/client/push
73
-
74
-*TODO: upload empty files? (new translations)*
80
+http://docs.transifex.com/client/push

+ 2
- 0
_static/pygments.css View File

4
 .highlight .err { border: 1px solid #FF0000 } /* Error */
4
 .highlight .err { border: 1px solid #FF0000 } /* Error */
5
 .highlight .k { color: #007020; font-weight: bold } /* Keyword */
5
 .highlight .k { color: #007020; font-weight: bold } /* Keyword */
6
 .highlight .o { color: #666666 } /* Operator */
6
 .highlight .o { color: #666666 } /* Operator */
7
+.highlight .ch { color: #408090; font-style: italic } /* Comment.Hashbang */
7
 .highlight .cm { color: #408090; font-style: italic } /* Comment.Multiline */
8
 .highlight .cm { color: #408090; font-style: italic } /* Comment.Multiline */
8
 .highlight .cp { color: #007020 } /* Comment.Preproc */
9
 .highlight .cp { color: #007020 } /* Comment.Preproc */
10
+.highlight .cpf { color: #408090; font-style: italic } /* Comment.PreprocFile */
9
 .highlight .c1 { color: #408090; font-style: italic } /* Comment.Single */
11
 .highlight .c1 { color: #408090; font-style: italic } /* Comment.Single */
10
 .highlight .cs { color: #408090; background-color: #fff0f0 } /* Comment.Special */
12
 .highlight .cs { color: #408090; background-color: #fff0f0 } /* Comment.Special */
11
 .highlight .gd { color: #A00000 } /* Generic.Deleted */
13
 .highlight .gd { color: #A00000 } /* Generic.Deleted */

+ 37
- 8
_static/searchtools.js View File

10
  */
10
  */
11
 
11
 
12
 
12
 
13
+/* Non-minified version JS is _stemmer.js if file is provided */ 
13
 /**
14
 /**
14
  * Porter Stemmer
15
  * Porter Stemmer
15
  */
16
  */
373
     }
374
     }
374
 
375
 
375
     // lookup as search terms in fulltext
376
     // lookup as search terms in fulltext
376
-    results = results.concat(this.performTermsSearch(searchterms, excluded, terms, Scorer.term))
377
-                     .concat(this.performTermsSearch(searchterms, excluded, titleterms, Scorer.title));
377
+    results = results.concat(this.performTermsSearch(searchterms, excluded, terms, titleterms));
378
 
378
 
379
     // let the scorer override scores with a custom scoring function
379
     // let the scorer override scores with a custom scoring function
380
     if (Scorer.score) {
380
     if (Scorer.score) {
538
   /**
538
   /**
539
    * search for full-text terms in the index
539
    * search for full-text terms in the index
540
    */
540
    */
541
-  performTermsSearch : function(searchterms, excluded, terms, score) {
541
+  performTermsSearch : function(searchterms, excluded, terms, titleterms) {
542
     var filenames = this._index.filenames;
542
     var filenames = this._index.filenames;
543
     var titles = this._index.titles;
543
     var titles = this._index.titles;
544
 
544
 
545
-    var i, j, file, files;
545
+    var i, j, file;
546
     var fileMap = {};
546
     var fileMap = {};
547
+    var scoreMap = {};
547
     var results = [];
548
     var results = [];
548
 
549
 
549
     // perform the search on the required terms
550
     // perform the search on the required terms
550
     for (i = 0; i < searchterms.length; i++) {
551
     for (i = 0; i < searchterms.length; i++) {
551
       var word = searchterms[i];
552
       var word = searchterms[i];
553
+      var files = [];
554
+      var _o = [
555
+        {files: terms[word], score: Scorer.term},
556
+        {files: titleterms[word], score: Scorer.title}
557
+      ];
558
+
552
       // no match but word was a required one
559
       // no match but word was a required one
553
-      if ((files = terms[word]) === undefined)
560
+      if ($u.every(_o, function(o){return o.files === undefined;})) {
554
         break;
561
         break;
555
-      if (files.length === undefined) {
556
-        files = [files];
557
       }
562
       }
563
+      // found search word in contents
564
+      $u.each(_o, function(o) {
565
+        var _files = o.files;
566
+        if (_files === undefined)
567
+          return
568
+
569
+        if (_files.length === undefined)
570
+          _files = [_files];
571
+        files = files.concat(_files);
572
+
573
+        // set score for the word in each file to Scorer.term
574
+        for (j = 0; j < _files.length; j++) {
575
+          file = _files[j];
576
+          if (!(file in scoreMap))
577
+            scoreMap[file] = {}
578
+          scoreMap[file][word] = o.score;
579
+        }
580
+      });
581
+
558
       // create the mapping
582
       // create the mapping
559
       for (j = 0; j < files.length; j++) {
583
       for (j = 0; j < files.length; j++) {
560
         file = files[j];
584
         file = files[j];
576
       // ensure that none of the excluded terms is in the search result
600
       // ensure that none of the excluded terms is in the search result
577
       for (i = 0; i < excluded.length; i++) {
601
       for (i = 0; i < excluded.length; i++) {
578
         if (terms[excluded[i]] == file ||
602
         if (terms[excluded[i]] == file ||
579
-          $u.contains(terms[excluded[i]] || [], file)) {
603
+            titleterms[excluded[i]] == file ||
604
+            $u.contains(terms[excluded[i]] || [], file) ||
605
+            $u.contains(titleterms[excluded[i]] || [], file)) {
580
           valid = false;
606
           valid = false;
581
           break;
607
           break;
582
         }
608
         }
584
 
610
 
585
       // if we have still a valid result we can add it to the result list
611
       // if we have still a valid result we can add it to the result list
586
       if (valid) {
612
       if (valid) {
613
+        // select one (max) score for the file.
614
+        // for better ranking, we should calculate ranking by using words statistics like basic tf-idf...
615
+        var score = $u.max($u.map(fileMap[file], function(w){return scoreMap[file][w]}));
587
         results.push([filenames[file], titles[file], '', null, score]);
616
         results.push([filenames[file], titles[file], '', null, score]);
588
       }
617
       }
589
     }
618
     }

+ 9
- 9
dev/engine_overview.html View File

190
 </div>
190
 </div>
191
 <div class="section" id="example-code">
191
 <div class="section" id="example-code">
192
 <h3><a class="toc-backref" href="#id7">example code</a><a class="headerlink" href="#example-code" title="Permalink to this headline">¶</a></h3>
192
 <h3><a class="toc-backref" href="#id7">example code</a><a class="headerlink" href="#example-code" title="Permalink to this headline">¶</a></h3>
193
-<div class="code python highlight-python"><div class="highlight"><pre><span class="c"># engine dependent config</span>
194
-<span class="n">categories</span> <span class="o">=</span> <span class="p">[</span><span class="s">&#39;general&#39;</span><span class="p">]</span>
193
+<div class="code python highlight-python"><div class="highlight"><pre><span class="c1"># engine dependent config</span>
194
+<span class="n">categories</span> <span class="o">=</span> <span class="p">[</span><span class="s1">&#39;general&#39;</span><span class="p">]</span>
195
 <span class="n">paging</span> <span class="o">=</span> <span class="bp">True</span>
195
 <span class="n">paging</span> <span class="o">=</span> <span class="bp">True</span>
196
 <span class="n">language_support</span> <span class="o">=</span> <span class="bp">True</span>
196
 <span class="n">language_support</span> <span class="o">=</span> <span class="bp">True</span>
197
 </pre></div>
197
 </pre></div>
313
 </div>
313
 </div>
314
 <div class="section" id="id1">
314
 <div class="section" id="id1">
315
 <h3><a class="toc-backref" href="#id11">example code</a><a class="headerlink" href="#id1" title="Permalink to this headline">¶</a></h3>
315
 <h3><a class="toc-backref" href="#id11">example code</a><a class="headerlink" href="#id1" title="Permalink to this headline">¶</a></h3>
316
-<div class="code python highlight-python"><div class="highlight"><pre><span class="c"># search-url</span>
317
-<span class="n">base_url</span> <span class="o">=</span> <span class="s">&#39;https://example.com/&#39;</span>
318
-<span class="n">search_string</span> <span class="o">=</span> <span class="s">&#39;search?{query}&amp;page={page}&#39;</span>
316
+<div class="code python highlight-python"><div class="highlight"><pre><span class="c1"># search-url</span>
317
+<span class="n">base_url</span> <span class="o">=</span> <span class="s1">&#39;https://example.com/&#39;</span>
318
+<span class="n">search_string</span> <span class="o">=</span> <span class="s1">&#39;search?{query}&amp;page={page}&#39;</span>
319
 
319
 
320
-<span class="c"># do search-request</span>
320
+<span class="c1"># do search-request</span>
321
 <span class="k">def</span> <span class="nf">request</span><span class="p">(</span><span class="n">query</span><span class="p">,</span> <span class="n">params</span><span class="p">):</span>
321
 <span class="k">def</span> <span class="nf">request</span><span class="p">(</span><span class="n">query</span><span class="p">,</span> <span class="n">params</span><span class="p">):</span>
322
     <span class="n">search_path</span> <span class="o">=</span> <span class="n">search_string</span><span class="o">.</span><span class="n">format</span><span class="p">(</span>
322
     <span class="n">search_path</span> <span class="o">=</span> <span class="n">search_string</span><span class="o">.</span><span class="n">format</span><span class="p">(</span>
323
-        <span class="n">query</span><span class="o">=</span><span class="n">urlencode</span><span class="p">({</span><span class="s">&#39;q&#39;</span><span class="p">:</span> <span class="n">query</span><span class="p">}),</span>
324
-        <span class="n">page</span><span class="o">=</span><span class="n">params</span><span class="p">[</span><span class="s">&#39;pageno&#39;</span><span class="p">])</span>
323
+        <span class="n">query</span><span class="o">=</span><span class="n">urlencode</span><span class="p">({</span><span class="s1">&#39;q&#39;</span><span class="p">:</span> <span class="n">query</span><span class="p">}),</span>
324
+        <span class="n">page</span><span class="o">=</span><span class="n">params</span><span class="p">[</span><span class="s1">&#39;pageno&#39;</span><span class="p">])</span>
325
 
325
 
326
-    <span class="n">params</span><span class="p">[</span><span class="s">&#39;url&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">base_url</span> <span class="o">+</span> <span class="n">search_path</span>
326
+    <span class="n">params</span><span class="p">[</span><span class="s1">&#39;url&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">base_url</span> <span class="o">+</span> <span class="n">search_path</span>
327
 
327
 
328
     <span class="k">return</span> <span class="n">params</span>
328
     <span class="k">return</span> <span class="n">params</span>
329
 </pre></div>
329
 </pre></div>

+ 9
- 9
dev/plugins.html View File

45
 searx.</p>
45
 searx.</p>
46
 <div class="section" id="example-plugin-py">
46
 <div class="section" id="example-plugin-py">
47
 <h2>example_plugin.py<a class="headerlink" href="#example-plugin-py" title="Permalink to this headline">¶</a></h2>
47
 <h2>example_plugin.py<a class="headerlink" href="#example-plugin-py" title="Permalink to this headline">¶</a></h2>
48
-<div class="code python highlight-python"><div class="highlight"><pre><span class="n">name</span> <span class="o">=</span> <span class="s">&#39;Example plugin&#39;</span>
49
-<span class="n">description</span> <span class="o">=</span> <span class="s">&#39;This plugin extends the suggestions with the word &quot;example&quot;&#39;</span>
50
-<span class="n">default_on</span> <span class="o">=</span> <span class="bp">False</span>  <span class="c"># disable by default</span>
48
+<div class="code python highlight-python"><div class="highlight"><pre><span class="n">name</span> <span class="o">=</span> <span class="s1">&#39;Example plugin&#39;</span>
49
+<span class="n">description</span> <span class="o">=</span> <span class="s1">&#39;This plugin extends the suggestions with the word &quot;example&quot;&#39;</span>
50
+<span class="n">default_on</span> <span class="o">=</span> <span class="bp">False</span>  <span class="c1"># disable by default</span>
51
 
51
 
52
-<span class="n">js_dependencies</span> <span class="o">=</span> <span class="nb">tuple</span><span class="p">()</span>  <span class="c"># optional, list of static js files</span>
53
-<span class="n">css_dependencies</span> <span class="o">=</span> <span class="nb">tuple</span><span class="p">()</span>  <span class="c"># optional, list of static css files</span>
52
+<span class="n">js_dependencies</span> <span class="o">=</span> <span class="nb">tuple</span><span class="p">()</span>  <span class="c1"># optional, list of static js files</span>
53
+<span class="n">css_dependencies</span> <span class="o">=</span> <span class="nb">tuple</span><span class="p">()</span>  <span class="c1"># optional, list of static css files</span>
54
 
54
 
55
 
55
 
56
-<span class="c"># attach callback to the post search hook</span>
57
-<span class="c">#  request: flask request object</span>
58
-<span class="c">#  ctx: the whole local context of the post search hook</span>
56
+<span class="c1"># attach callback to the post search hook</span>
57
+<span class="c1">#  request: flask request object</span>
58
+<span class="c1">#  ctx: the whole local context of the post search hook</span>
59
 <span class="k">def</span> <span class="nf">post_search</span><span class="p">(</span><span class="n">request</span><span class="p">,</span> <span class="n">ctx</span><span class="p">):</span>
59
 <span class="k">def</span> <span class="nf">post_search</span><span class="p">(</span><span class="n">request</span><span class="p">,</span> <span class="n">ctx</span><span class="p">):</span>
60
-    <span class="n">ctx</span><span class="p">[</span><span class="s">&#39;search&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">suggestions</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="s">&#39;example&#39;</span><span class="p">)</span>
60
+    <span class="n">ctx</span><span class="p">[</span><span class="s1">&#39;search&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">suggestions</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="s1">&#39;example&#39;</span><span class="p">)</span>
61
     <span class="k">return</span> <span class="bp">True</span>
61
     <span class="k">return</span> <span class="bp">True</span>
62
 </pre></div>
62
 </pre></div>
63
 </div>
63
 </div>

+ 1
- 1
dev/search_api.html View File

25
     <script type="text/javascript" src="../_static/doctools.js"></script>
25
     <script type="text/javascript" src="../_static/doctools.js"></script>
26
     <link rel="top" title="searx 0.8.0 documentation" href="../index.html" />
26
     <link rel="top" title="searx 0.8.0 documentation" href="../index.html" />
27
     <link rel="next" title="Plugins" href="plugins.html" />
27
     <link rel="next" title="Plugins" href="plugins.html" />
28
-    <link rel="prev" title="Installation" href="install/installation.html" />
28
+    <link rel="prev" title="Engine overview" href="engine_overview.html" />
29
    
29
    
30
   
30
   
31
   <link media="only screen and (max-device-width: 480px)" href="../_static/small_flask.css" type= "text/css" rel="stylesheet" />
31
   <link media="only screen and (max-device-width: 480px)" href="../_static/small_flask.css" type= "text/css" rel="stylesheet" />

+ 22
- 15
dev/translation.html View File

43
 <p>run these commands in the root directory of searx</p>
43
 <p>run these commands in the root directory of searx</p>
44
 <div class="section" id="add-new-language">
44
 <div class="section" id="add-new-language">
45
 <h2>Add new language<a class="headerlink" href="#add-new-language" title="Permalink to this headline">¶</a></h2>
45
 <h2>Add new language<a class="headerlink" href="#add-new-language" title="Permalink to this headline">¶</a></h2>
46
-<p><code class="docutils literal"><span class="pre">pybabel</span> <span class="pre">init</span> <span class="pre">-i</span> <span class="pre">messages.pot</span> <span class="pre">-d</span> <span class="pre">searx/translations</span> <span class="pre">-l</span> <span class="pre">it</span></code></p>
46
+<div class="code shell highlight-python"><div class="highlight"><pre>pybabel init -i messages.pot -d searx/translations -l it
47
+</pre></div>
48
+</div>
47
 </div>
49
 </div>
48
 <div class="section" id="update-po-files">
50
 <div class="section" id="update-po-files">
49
 <h2>Update .po files<a class="headerlink" href="#update-po-files" title="Permalink to this headline">¶</a></h2>
51
 <h2>Update .po files<a class="headerlink" href="#update-po-files" title="Permalink to this headline">¶</a></h2>
50
-<p><code class="docutils literal"><span class="pre">./utils/update-translations.sh</span></code></p>
52
+<div class="code shell highlight-python"><div class="highlight"><pre>./utils/update-translations.sh
53
+</pre></div>
54
+</div>
51
 <p>You may have errors here. In that case, edit the
55
 <p>You may have errors here. In that case, edit the
52
 <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
56
 <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
53
-<code class="docutils literal"><span class="pre">pybabel-python2</span></code></p>
57
+<code class="docutils literal"><span class="pre">pybabel-python2</span></code> or <code class="docutils literal"><span class="pre">pybabel2</span></code></p>
54
 <p>After this step, you can modify the .po files.</p>
58
 <p>After this step, you can modify the .po files.</p>
55
 </div>
59
 </div>
56
 <div class="section" id="compile-translations">
60
 <div class="section" id="compile-translations">
57
 <h2>Compile translations<a class="headerlink" href="#compile-translations" title="Permalink to this headline">¶</a></h2>
61
 <h2>Compile translations<a class="headerlink" href="#compile-translations" title="Permalink to this headline">¶</a></h2>
58
-<p><code class="docutils literal"><span class="pre">pybabel</span> <span class="pre">compile</span> <span class="pre">-d</span> <span class="pre">searx/translations</span></code></p>
62
+<div class="code shell highlight-python"><div class="highlight"><pre>pybabel compile -d searx/translations
63
+</pre></div>
64
+</div>
59
 </div>
65
 </div>
60
 <div class="section" id="transifex-stuff">
66
 <div class="section" id="transifex-stuff">
61
 <h2>Transifex stuff<a class="headerlink" href="#transifex-stuff" title="Permalink to this headline">¶</a></h2>
67
 <h2>Transifex stuff<a class="headerlink" href="#transifex-stuff" title="Permalink to this headline">¶</a></h2>
62
 <div class="section" id="init-project">
68
 <div class="section" id="init-project">
63
 <h3>Init Project<a class="headerlink" href="#init-project" title="Permalink to this headline">¶</a></h3>
69
 <h3>Init Project<a class="headerlink" href="#init-project" title="Permalink to this headline">¶</a></h3>
64
-<div class="code shell highlight-python"><div class="highlight"><pre>tx set --auto-local -r searx.messagespo &#39;searx/translations/&lt;lang&gt;/LC_MESSAGES/messages.po&#39; \
70
+<div class="code shell highlight-python"><div class="highlight"><pre>tx init # Transifex instance: https://www.transifex.com/asciimoo/searx/
71
+
72
+tx set --auto-local -r searx.messagespo &#39;searx/translations/&lt;lang&gt;/LC_MESSAGES/messages.po&#39; \
65
 --source-lang en --type PO --source-file messages.pot --execute
73
 --source-lang en --type PO --source-file messages.pot --execute
66
 </pre></div>
74
 </pre></div>
67
 </div>
75
 </div>
68
-<p><a class="reference external" href="http://docs.transifex.com/developer/client/set">http://docs.transifex.com/developer/client/set</a></p>
69
-<p><em>TODO: mapping between transifex and searx</em></p>
76
+<p><a class="reference external" href="http://docs.transifex.com/client/init/">http://docs.transifex.com/client/init/</a></p>
77
+<p><a class="reference external" href="http://docs.transifex.com/client/set/">http://docs.transifex.com/client/set/</a></p>
70
 </div>
78
 </div>
71
 <div class="section" id="get-translations">
79
 <div class="section" id="get-translations">
72
 <h3>Get translations<a class="headerlink" href="#get-translations" title="Permalink to this headline">¶</a></h3>
80
 <h3>Get translations<a class="headerlink" href="#get-translations" title="Permalink to this headline">¶</a></h3>
73
 <div class="code shell highlight-python"><div class="highlight"><pre>tx pull -a
81
 <div class="code shell highlight-python"><div class="highlight"><pre>tx pull -a
74
 </pre></div>
82
 </pre></div>
75
 </div>
83
 </div>
76
-<p><a class="reference external" href="http://docs.transifex.com/developer/client/pull">http://docs.transifex.com/developer/client/pull</a></p>
84
+<p><a class="reference external" href="http://docs.transifex.com/client/pull">http://docs.transifex.com/client/pull</a></p>
77
 </div>
85
 </div>
78
 <div class="section" id="upload-source-file">
86
 <div class="section" id="upload-source-file">
79
 <h3>Upload source File<a class="headerlink" href="#upload-source-file" title="Permalink to this headline">¶</a></h3>
87
 <h3>Upload source File<a class="headerlink" href="#upload-source-file" title="Permalink to this headline">¶</a></h3>
80
-<div class="highlight-python"><div class="highlight"><pre>tx push -s
88
+<div class="code shell highlight-python"><div class="highlight"><pre>tx push -s
81
 </pre></div>
89
 </pre></div>
82
 </div>
90
 </div>
83
 </div>
91
 </div>
84
 <div class="section" id="upload-all-translation">
92
 <div class="section" id="upload-all-translation">
85
 <h3>Upload all Translation<a class="headerlink" href="#upload-all-translation" title="Permalink to this headline">¶</a></h3>
93
 <h3>Upload all Translation<a class="headerlink" href="#upload-all-translation" title="Permalink to this headline">¶</a></h3>
86
-<div class="highlight-python"><div class="highlight"><pre>tx push -s -t
94
+<div class="code shell highlight-python"><div class="highlight"><pre>tx push -s -t
87
 </pre></div>
95
 </pre></div>
88
 </div>
96
 </div>
89
 </div>
97
 </div>
90
 </div>
98
 </div>
91
-<div class="section" id="upload-specifc-translation-only-for-admins">
92
-<h2>upload specifc Translation (only for admins)<a class="headerlink" href="#upload-specifc-translation-only-for-admins" title="Permalink to this headline">¶</a></h2>
93
-<div class="highlight-python"><div class="highlight"><pre>tx push -t -l tr
99
+<div class="section" id="upload-specifc-translation">
100
+<h2>upload specifc Translation<a class="headerlink" href="#upload-specifc-translation" title="Permalink to this headline">¶</a></h2>
101
+<div class="code shell highlight-python"><div class="highlight"><pre>tx push -t -l tr
94
 </pre></div>
102
 </pre></div>
95
 </div>
103
 </div>
96
-<p><a class="reference external" href="http://docs.transifex.com/developer/client/push">http://docs.transifex.com/developer/client/push</a></p>
97
-<p><em>TODO: upload empty files? (new translations)</em></p>
104
+<p><a class="reference external" href="http://docs.transifex.com/client/push">http://docs.transifex.com/client/push</a></p>
98
 </div>
105
 </div>
99
 </div>
106
 </div>
100
 
107
 

+ 21
- 15
docs/dev/translation.rst View File

6
 Add new language
6
 Add new language
7
 ~~~~~~~~~~~~~~~~
7
 ~~~~~~~~~~~~~~~~
8
 
8
 
9
-``pybabel init -i messages.pot -d searx/translations -l it``
9
+.. code:: shell
10
+
11
+    pybabel init -i messages.pot -d searx/translations -l it
10
 
12
 
11
 Update .po files
13
 Update .po files
12
 ~~~~~~~~~~~~~~~~
14
 ~~~~~~~~~~~~~~~~
13
 
15
 
14
-``./utils/update-translations.sh``
16
+.. code:: shell
17
+
18
+    ./utils/update-translations.sh
15
 
19
 
16
 You may have errors here. In that case, edit the
20
 You may have errors here. In that case, edit the
17
 ``update-translations.sh`` script to change ``pybabel`` to
21
 ``update-translations.sh`` script to change ``pybabel`` to
18
-``pybabel-python2``
22
+``pybabel-python2`` or ``pybabel2``
19
 
23
 
20
 After this step, you can modify the .po files.
24
 After this step, you can modify the .po files.
21
 
25
 
22
 Compile translations
26
 Compile translations
23
 ~~~~~~~~~~~~~~~~~~~~
27
 ~~~~~~~~~~~~~~~~~~~~
24
 
28
 
25
-``pybabel compile -d searx/translations``
29
+.. code:: shell
30
+
31
+    pybabel compile -d searx/translations
26
 
32
 
27
 Transifex stuff
33
 Transifex stuff
28
 ~~~~~~~~~~~~~~~
34
 ~~~~~~~~~~~~~~~
32
 
38
 
33
 .. code:: shell
39
 .. code:: shell
34
 
40
 
41
+    tx init # Transifex instance: https://www.transifex.com/asciimoo/searx/
42
+
35
     tx set --auto-local -r searx.messagespo 'searx/translations/<lang>/LC_MESSAGES/messages.po' \
43
     tx set --auto-local -r searx.messagespo 'searx/translations/<lang>/LC_MESSAGES/messages.po' \
36
     --source-lang en --type PO --source-file messages.pot --execute
44
     --source-lang en --type PO --source-file messages.pot --execute
37
 
45
 
38
-http://docs.transifex.com/developer/client/set
46
+http://docs.transifex.com/client/init/
39
 
47
 
40
-*TODO: mapping between transifex and searx*
48
+http://docs.transifex.com/client/set/
41
 
49
 
42
 Get translations
50
 Get translations
43
 ^^^^^^^^^^^^^^^^
51
 ^^^^^^^^^^^^^^^^
46
 
54
 
47
     tx pull -a
55
     tx pull -a
48
 
56
 
49
-http://docs.transifex.com/developer/client/pull
57
+http://docs.transifex.com/client/pull
50
 
58
 
51
 Upload source File
59
 Upload source File
52
 ^^^^^^^^^^^^^^^^^^
60
 ^^^^^^^^^^^^^^^^^^
53
 
61
 
54
-::
62
+.. code:: shell
55
 
63
 
56
     tx push -s
64
     tx push -s
57
 
65
 
58
 Upload all Translation
66
 Upload all Translation
59
 ^^^^^^^^^^^^^^^^^^^^^^
67
 ^^^^^^^^^^^^^^^^^^^^^^
60
 
68
 
61
-::
69
+.. code:: shell
62
 
70
 
63
     tx push -s -t
71
     tx push -s -t
64
 
72
 
65
-upload specifc Translation (only for admins)
66
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
73
+upload specifc Translation
74
+~~~~~~~~~~~~~~~~~~~~~~~~~~
67
 
75
 
68
-::
76
+.. code:: shell
69
 
77
 
70
     tx push -t -l tr
78
     tx push -t -l tr
71
 
79
 
72
-http://docs.transifex.com/developer/client/push
73
-
74
-*TODO: upload empty files? (new translations)*
80
+http://docs.transifex.com/client/push

+ 1
- 1
searchindex.js
File diff suppressed because it is too large
View File