translation.rst 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. Translation
  2. ===========
  3. Requirements
  4. ------------
  5. * Transifex account
  6. * Installed CLI tool of Transifex
  7. Init Transifex project
  8. ----------------------
  9. After installing ``transifex`` using pip, run the following command to initialize the project.
  10. .. code:: shell
  11. tx init # Transifex instance: https://www.transifex.com/asciimoo/searx/
  12. After ``$HOME/.transifexrc`` is created, get a Transifex API key and insert it into the configuration file.
  13. Create a configuration file for ``tx`` named ``$HOME/.tx/config``.
  14. .. code:: shell
  15. [main]
  16. host = https://www.transifex.com
  17. [searx.messagespo]
  18. file_filter = searx/translations/<lang>/LC_MESSAGES/messages.po
  19. source_file = messages.pot
  20. source_lang = en
  21. type = PO
  22. Then run ``tx set``:
  23. .. code:: shell
  24. tx set --auto-local -r searx.messagespo 'searx/translations/<lang>/LC_MESSAGES/messages.po' \
  25. --source-lang en --type PO --source-file messages.pot --execute
  26. Update translations
  27. -------------------
  28. To retrieve the latest translations, pull it from Transifex.
  29. .. code:: shell
  30. tx pull -a
  31. Then check the new languages. If strings translated are not enough, delete those folders, because
  32. those should not be compiled. Call the command below to compile the ``.po`` files.
  33. .. code:: shell
  34. pybabel compile -d searx/translations
  35. After the compilation is finished commit the ``.po`` and ``.mo`` files and create a PR.