searxng/docs/dev/translation.rst

72 lines
1.5 KiB
ReStructuredText
Raw Permalink Normal View History

.. _translation:
===========
2015-11-17 22:13:30 +00:00
Translation
===========
.. _searx@transifex: https://www.transifex.com/asciimoo/searx/
Translation currently takes place on `searx@transifex`_
2015-11-17 22:13:30 +00:00
Requirements
============
2015-11-17 22:13:30 +00:00
* Transifex account
* Installed CLI tool of Transifex
2017-03-18 22:57:19 +00:00
Init Transifex project
======================
2015-11-17 22:13:30 +00:00
After installing ``transifex`` using pip, run the following command to
initialize the project.
2015-11-17 22:13:30 +00:00
.. code:: sh
tx init # Transifex instance: https://www.transifex.com/asciimoo/searx/
2015-11-17 22:13:30 +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
.. code:: ini
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
===================
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
.. code:: sh
2015-11-17 22:13:30 +00:00
tx pull -a
2015-11-17 22:13:30 +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
.. code:: shell
2015-11-17 22:13:30 +00:00
pybabel compile -d searx/translations
2015-11-17 22:13:30 +00:00
After the compilation is finished commit the ``.po`` and ``.mo`` files and
create a PR.