2019-12-12 18:20:56 +00:00
|
|
|
.. _translation:
|
|
|
|
|
|
|
|
===========
|
2015-11-17 22:13:30 +00:00
|
|
|
Translation
|
|
|
|
===========
|
|
|
|
|
2019-12-12 18:20:56 +00:00
|
|
|
.. _searx@transifex: https://www.transifex.com/asciimoo/searx/
|
|
|
|
|
|
|
|
Translation currently takes place on `searx@transifex`_
|
2015-11-17 22:13:30 +00:00
|
|
|
|
2019-12-12 18:20:56 +00:00
|
|
|
Requirements
|
|
|
|
============
|
2015-11-17 22:13:30 +00:00
|
|
|
|
2019-12-12 18:20:56 +00:00
|
|
|
* Transifex account
|
|
|
|
* Installed CLI tool of Transifex
|
2016-01-21 15:25:40 +00:00
|
|
|
|
2017-03-18 22:57:19 +00:00
|
|
|
Init Transifex project
|
2019-12-12 18:20:56 +00:00
|
|
|
======================
|
2015-11-17 22:13:30 +00:00
|
|
|
|
2019-12-12 18:20:56 +00:00
|
|
|
After installing ``transifex`` using pip, run the following command to
|
|
|
|
initialize the project.
|
2015-11-17 22:13:30 +00:00
|
|
|
|
2019-12-12 18:20:56 +00:00
|
|
|
.. code:: sh
|
2016-01-21 15:25:40 +00:00
|
|
|
|
2019-12-12 18:20:56 +00:00
|
|
|
tx init # Transifex instance: https://www.transifex.com/asciimoo/searx/
|
2015-11-17 22:13:30 +00:00
|
|
|
|
|
|
|
|
2019-12-12 18:20:56 +00:00
|
|
|
After ``$HOME/.transifexrc`` is created, get a Transifex API key and insert it
|
|
|
|
into the configuration file.
|
2015-11-17 22:13:30 +00:00
|
|
|
|
2017-03-18 22:57:19 +00:00
|
|
|
Create a configuration file for ``tx`` named ``$HOME/.tx/config``.
|
2015-11-17 22:13:30 +00:00
|
|
|
|
2019-12-12 18:20:56 +00:00
|
|
|
.. code:: ini
|
2016-01-21 15:25:40 +00:00
|
|
|
|
2017-03-18 22:57:19 +00:00
|
|
|
[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
|
2015-11-17 22:13:30 +00:00
|
|
|
|
|
|
|
|
2017-03-18 22:57:19 +00:00
|
|
|
Then run ``tx set``:
|
2015-11-17 22:13:30 +00:00
|
|
|
|
|
|
|
.. 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
|
|
|
|
|
|
|
|
|
2017-03-18 22:57:19 +00:00
|
|
|
Update translations
|
2019-12-12 18:20:56 +00:00
|
|
|
===================
|
2015-11-17 22:13:30 +00:00
|
|
|
|
2017-03-18 22:57:19 +00:00
|
|
|
To retrieve the latest translations, pull it from Transifex.
|
2015-11-17 22:13:30 +00:00
|
|
|
|
2019-12-12 18:20:56 +00:00
|
|
|
.. code:: sh
|
2015-11-17 22:13:30 +00:00
|
|
|
|
2019-12-12 18:20:56 +00:00
|
|
|
tx pull -a
|
2015-11-17 22:13:30 +00:00
|
|
|
|
2019-12-12 18:20:56 +00:00
|
|
|
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.
|
2015-11-17 22:13:30 +00:00
|
|
|
|
2016-01-21 15:25:40 +00:00
|
|
|
.. code:: shell
|
2015-11-17 22:13:30 +00:00
|
|
|
|
2019-12-12 18:20:56 +00:00
|
|
|
pybabel compile -d searx/translations
|
2015-11-17 22:13:30 +00:00
|
|
|
|
|
|
|
|
2019-12-12 18:20:56 +00:00
|
|
|
After the compilation is finished commit the ``.po`` and ``.mo`` files and
|
|
|
|
create a PR.
|