summaryrefslogtreecommitdiff
path: root/docs/dev/translation.rst
blob: 86c4c843b93c94f5edb6be46a9c3eaffa07c04f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
.. _translation:

===========
Translation
===========

.. _searx@transifex: https://www.transifex.com/asciimoo/searx/

Translation currently takes place on `searx@transifex`_

Requirements
============

* Transifex account
* Installed CLI tool of Transifex

Init Transifex project
======================

After installing ``transifex`` using pip, run the following command to
initialize the project.

.. code:: sh

   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:: ini

    [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


Update translations
===================

To retrieve the latest translations, pull it from Transifex.

.. code:: sh

   tx pull -a

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

   pybabel compile -d searx/translations


After the compilation is finished commit the ``.po`` and ``.mo`` files and
create a PR.