2019-12-12 19:20:56 +01:00
|
|
|
.. _translation:
|
|
|
|
|
|
|
|
===========
|
2015-11-17 23:13:30 +01:00
|
|
|
Translation
|
|
|
|
===========
|
|
|
|
|
2019-12-12 19:20:56 +01:00
|
|
|
.. _searx@transifex: https://www.transifex.com/asciimoo/searx/
|
|
|
|
|
|
|
|
Translation currently takes place on `searx@transifex`_
|
2015-11-17 23:13:30 +01:00
|
|
|
|
2019-12-12 19:20:56 +01:00
|
|
|
Requirements
|
|
|
|
============
|
2015-11-17 23:13:30 +01:00
|
|
|
|
2019-12-12 19:20:56 +01:00
|
|
|
* Transifex account
|
2016-01-21 16:25:40 +01:00
|
|
|
|
2017-03-18 23:57:19 +01:00
|
|
|
Init Transifex project
|
2019-12-12 19:20:56 +01:00
|
|
|
======================
|
2015-11-17 23:13:30 +01:00
|
|
|
|
2019-12-12 19:20:56 +01:00
|
|
|
After installing ``transifex`` using pip, run the following command to
|
|
|
|
initialize the project.
|
2015-11-17 23:13:30 +01:00
|
|
|
|
2019-12-12 19:20:56 +01:00
|
|
|
.. code:: sh
|
2016-01-21 16:25:40 +01:00
|
|
|
|
2021-07-03 19:31:31 +02:00
|
|
|
./manage pyenv.cmd tx init # Transifex instance: https://www.transifex.com/asciimoo/searx/
|
2015-11-17 23:13:30 +01:00
|
|
|
|
|
|
|
|
2019-12-12 19:20:56 +01:00
|
|
|
After ``$HOME/.transifexrc`` is created, get a Transifex API key and insert it
|
|
|
|
into the configuration file.
|
2015-11-17 23:13:30 +01:00
|
|
|
|
2017-03-18 23:57:19 +01:00
|
|
|
Create a configuration file for ``tx`` named ``$HOME/.tx/config``.
|
2015-11-17 23:13:30 +01:00
|
|
|
|
2019-12-12 19:20:56 +01:00
|
|
|
.. code:: ini
|
2016-01-21 16:25:40 +01:00
|
|
|
|
2017-03-18 23:57:19 +01: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 23:13:30 +01:00
|
|
|
|
|
|
|
|
2017-03-18 23:57:19 +01:00
|
|
|
Then run ``tx set``:
|
2015-11-17 23:13:30 +01:00
|
|
|
|
|
|
|
.. code:: shell
|
|
|
|
|
2021-07-03 19:31:31 +02:00
|
|
|
./manage pyenv.cmd tx set --auto-local \
|
|
|
|
-r searx.messagespo 'searx/translations/<lang>/LC_MESSAGES/messages.po' \
|
|
|
|
--source-lang en --type PO --source-file messages.pot --execute
|
2015-11-17 23:13:30 +01:00
|
|
|
|
|
|
|
|
2017-03-18 23:57:19 +01:00
|
|
|
Update translations
|
2019-12-12 19:20:56 +01:00
|
|
|
===================
|
2015-11-17 23:13:30 +01:00
|
|
|
|
2017-03-18 23:57:19 +01:00
|
|
|
To retrieve the latest translations, pull it from Transifex.
|
2015-11-17 23:13:30 +01:00
|
|
|
|
2019-12-12 19:20:56 +01:00
|
|
|
.. code:: sh
|
2015-11-17 23:13:30 +01:00
|
|
|
|
2021-07-03 19:31:31 +02:00
|
|
|
./manage pyenv.cmd tx pull -a
|
|
|
|
[?] Enter your api token: ....
|
2015-11-17 23:13:30 +01:00
|
|
|
|
2019-12-12 19:20:56 +01: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 23:13:30 +01:00
|
|
|
|
2016-01-21 16:25:40 +01:00
|
|
|
.. code:: shell
|
2015-11-17 23:13:30 +01:00
|
|
|
|
2021-07-03 19:31:31 +02:00
|
|
|
./manage pyenv.cmd pybabel compile -d searx/translations
|
2015-11-17 23:13:30 +01:00
|
|
|
|
|
|
|
|
2019-12-12 19:20:56 +01:00
|
|
|
After the compilation is finished commit the ``.po`` and ``.mo`` files and
|
|
|
|
create a PR.
|