translation.rst 1.6 KB

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