on master help sign in
rewrite Translation page
6d2e372Noémi Ványi
docs/dev/translation.rst+25−44
@@ -1,80 +1,61 @@
1Translation
1Translation
2===========
2===========
3
3
4−run these commands in the root directory of searx
4+Requirements
5+------------
5
6
6−Add new language
7+ * Transifex account
7−~~~~~~~~~~~~~~~~
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+After installing ``transifex`` using pip, run the following command to initialize the project.
14−~~~~~~~~~~~~~~~~
15
15
16.. code:: shell
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
23+Create a configuration file for ``tx`` named ``$HOME/.tx/config``.
27−~~~~~~~~~~~~~~~~~~~~
28
24
29.. code:: shell
25.. code:: shell
30
26
27+ [main]
28+ host = https://www.transifex.com
29+ [searx.messagespo]
31− pybabel compile -d searx/translations
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
36+Then run ``tx set``:
37−^^^^^^^^^^^^
38
37
39.. code:: shell
38.. code:: shell
40
39
41− tx init # Transifex instance: https://www.transifex.com/asciimoo/searx/
42−
43 tx set --auto-local -r searx.messagespo 'searx/translations/<lang>/LC_MESSAGES/messages.po' \
40 tx set --auto-local -r searx.messagespo 'searx/translations/<lang>/LC_MESSAGES/messages.po' \
44 --source-lang en --type PO --source-file messages.pot --execute
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
47+To retrieve the latest translations, pull it from Transifex.
51−^^^^^^^^^^^^^^^^
52
48
53.. code:: shell
49.. code:: shell
54
50
55 tx pull -a
51 tx pull -a
56
52
57−http://docs.transifex.com/client/pull
53+Then check the new languages. If strings translated are not enough, delete those folders, because
58−
54+those should not be compiled. Call the command below to compile the ``.po`` files.
59−Upload source File
60−^^^^^^^^^^^^^^^^^^
61−
62−.. code:: shell
63−
64− tx push -s
65−
66−Upload all Translation
67−^^^^^^^^^^^^^^^^^^^^^^
68
55
69.. code:: shell
56.. code:: shell
70
57
71− tx push -s -t
58+ pybabel compile -d searx/translations
72−
73−upload specifc Translation
74−~~~~~~~~~~~~~~~~~~~~~~~~~~
75−
76−.. code:: shell
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.