|
@@ -1,80 +1,61 @@
|
|
Translation
|
|
Translation
|
|
===========
|
|
===========
|
|
|
|
|
|
-run these commands in the root directory of searx
|
|
|
|
|
|
+Requirements
|
|
|
|
+------------
|
|
|
|
|
|
-Add new language
|
|
|
|
-~~~~~~~~~~~~~~~~
|
|
|
|
|
|
+ * Transifex account
|
|
|
|
|
|
-.. code:: shell
|
|
|
|
|
|
+ * Installed CLI tool of Transifex
|
|
|
|
|
|
- pybabel init -i messages.pot -d searx/translations -l it
|
|
|
|
|
|
+Init Transifex project
|
|
|
|
+----------------------
|
|
|
|
|
|
-Update .po files
|
|
|
|
-~~~~~~~~~~~~~~~~
|
|
|
|
|
|
+After installing ``transifex`` using pip, run the following command to initialize the project.
|
|
|
|
|
|
.. code:: shell
|
|
.. code:: shell
|
|
|
|
|
|
- ./utils/update-translations.sh
|
|
|
|
|
|
+ tx init # Transifex instance: https://www.transifex.com/asciimoo/searx/
|
|
|
|
|
|
-You may have errors here. In that case, edit the
|
|
|
|
-``update-translations.sh`` script to change ``pybabel`` to
|
|
|
|
-``pybabel-python2`` or ``pybabel2``
|
|
|
|
|
|
|
|
-After this step, you can modify the .po files.
|
|
|
|
|
|
+After ``$HOME/.transifexrc`` is created, get a Transifex API key and insert it into the configuration file.
|
|
|
|
|
|
-Compile translations
|
|
|
|
-~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
+Create a configuration file for ``tx`` named ``$HOME/.tx/config``.
|
|
|
|
|
|
.. code:: shell
|
|
.. code:: shell
|
|
|
|
|
|
- pybabel compile -d searx/translations
|
|
|
|
|
|
+ [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
|
|
|
|
|
|
-Transifex stuff
|
|
|
|
-~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
-Init Project
|
|
|
|
-^^^^^^^^^^^^
|
|
|
|
|
|
+Then run ``tx set``:
|
|
|
|
|
|
.. code:: shell
|
|
.. code:: shell
|
|
|
|
|
|
- tx init # Transifex instance: https://www.transifex.com/asciimoo/searx/
|
|
|
|
-
|
|
|
|
tx set --auto-local -r searx.messagespo 'searx/translations/<lang>/LC_MESSAGES/messages.po' \
|
|
tx set --auto-local -r searx.messagespo 'searx/translations/<lang>/LC_MESSAGES/messages.po' \
|
|
--source-lang en --type PO --source-file messages.pot --execute
|
|
--source-lang en --type PO --source-file messages.pot --execute
|
|
|
|
|
|
-http://docs.transifex.com/client/init/
|
|
|
|
|
|
|
|
-http://docs.transifex.com/client/set/
|
|
|
|
|
|
+Update translations
|
|
|
|
+-------------------
|
|
|
|
|
|
-Get translations
|
|
|
|
-^^^^^^^^^^^^^^^^
|
|
|
|
|
|
+To retrieve the latest translations, pull it from Transifex.
|
|
|
|
|
|
.. code:: shell
|
|
.. code:: shell
|
|
|
|
|
|
tx pull -a
|
|
tx pull -a
|
|
|
|
|
|
-http://docs.transifex.com/client/pull
|
|
|
|
-
|
|
|
|
-Upload source File
|
|
|
|
-^^^^^^^^^^^^^^^^^^
|
|
|
|
-
|
|
|
|
-.. code:: shell
|
|
|
|
-
|
|
|
|
- tx push -s
|
|
|
|
-
|
|
|
|
-Upload all Translation
|
|
|
|
-^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
+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
|
|
.. code:: shell
|
|
|
|
|
|
- tx push -s -t
|
|
|
|
-
|
|
|
|
-upload specifc Translation
|
|
|
|
-~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
-
|
|
|
|
-.. code:: shell
|
|
|
|
|
|
+ pybabel compile -d searx/translations
|
|
|
|
|
|
- tx push -t -l tr
|
|
|
|
|
|
|
|
-http://docs.transifex.com/client/push
|
|
|
|
|
|
+After the compilation is finished commit the ``.po`` and ``.mo`` files and create a PR.
|