From 901ab87717f642f2ab5ce68ef0d01be38ca6726d Mon Sep 17 00:00:00 2001 From: Alexandre Flament Date: Thu, 5 Aug 2021 13:57:48 +0200 Subject: [translations] web integration * make babel.translations.to.master: pull weblate updates * make babel.master.to.translations: push .pot and .po files to weblate --- docs/dev/translation.rst | 73 +++++++++++++++++------------------------------- docs/dev/translation.svg | 45 +++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+), 48 deletions(-) create mode 100644 docs/dev/translation.svg (limited to 'docs') diff --git a/docs/dev/translation.rst b/docs/dev/translation.rst index 523dcf78c..be0cf5bef 100644 --- a/docs/dev/translation.rst +++ b/docs/dev/translation.rst @@ -4,69 +4,46 @@ Translation =========== -.. _searx@transifex: https://www.transifex.com/asciimoo/searx/ +.. _weblate.bubu1.eu: https://weblate.bubu1.eu/projects/searxng/ -Translation currently takes place on `searx@transifex`_ +Translation takes place on `weblate.bubu1.eu`_ ( `documentation `_ ). -Requirements -============ +New messages on the master branch are extracted and pushed to Weblate automatically. -* Transifex account +Every Friday, a GitHub workflow creates a pull request with the updated translations (messages.mo, messages.po, messages.mo files). -Init Transifex project -====================== - -After installing ``transifex`` using pip, run the following command to -initialize the project. - -.. code:: sh - - ./manage pyenv.cmd tx init # Transifex instance: https://www.transifex.com/asciimoo/searx/ - - -After ``$HOME/.transifexrc`` is created, get a Transifex API key and insert it -into the configuration file. - -Create a configuration file for ``tx`` named ``$HOME/.tx/config``. - -.. code:: ini - - [main] - host = https://www.transifex.com - [searx.messagespo] - file_filter = searx/translations//LC_MESSAGES/messages.po - source_file = messages.pot - source_lang = en - type = PO +.. image:: https://weblate.bubu1.eu/widgets/searxng/-/searxng/svg-badge.svg + :target: https://weblate.bubu1.eu/projects/searxng/ +Weblate integration +=================== -Then run ``tx set``: +Weblate monitors the `translations branch `_, not the master branch. -.. code:: shell +This branch contains only the .pot and pot files, nothing else. - ./manage pyenv.cmd tx set --auto-local \ - -r searx.messagespo 'searx/translations//LC_MESSAGES/messages.po' \ - --source-lang en --type PO --source-file messages.pot --execute +Documentation +------------- +* `wlc `_ +* `pybabel `_ +* `weblate workflow `_ -Update translations -=================== +Worfklow +-------- -To retrieve the latest translations, pull it from Transifex. +.. image:: translation.svg -.. code:: sh - ./manage pyenv.cmd tx pull -a - [?] Enter your api token: .... +wlc +--- -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. +All weblate integration is done by GitHub workflows, but if you want to use wlc, copy this content into `~/.config/weblate `_ : -.. code:: shell +.. code-block:: ini - ./manage pyenv.cmd pybabel compile -d searx/translations + [keys] + https://weblate.bubu1.eu/api/ = APIKEY -After the compilation is finished commit the ``.po`` and ``.mo`` files and -create a PR. +Replace `APIKEY` by `your API key `_. diff --git a/docs/dev/translation.svg b/docs/dev/translation.svg new file mode 100644 index 000000000..060e58420 --- /dev/null +++ b/docs/dev/translation.svg @@ -0,0 +1,45 @@ +master branchmaster branchtranslations_update branchtranslations_update branchtranslations branchtranslations branchweblate clone oftranslations branchweblate clone oftranslations branchweblatepending changesweblatepending changesfor each commit on master.github/workflows/integration.ymlmake babel.master.to.translationswlc lockwlc pullwlc commitgit merge weblate/translationspybabel extractextract messages, store messages.pot on translations branchpybabel update (messages.po)git add searx/translationsgit commitgit pushwlc unlockevery Friday.github/workflows/translations-update.ymlmake babel.translations.to.masterwlc lockwlc pullwlc commitgit merge weblate/translationspybabel compilecp searx/translationsgit addgit commitwlc unlockcreate or update pull request"Update translations"developper's reviewmerge pull request -- cgit v1.2.3 From 58344b0827f21d4d154702079e1c6f58cb243a89 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Mon, 9 Aug 2021 17:58:27 +0200 Subject: [translations] additional documentation of the Weblate workflows Signed-off-by: Markus Heiser --- docs/dev/translation.rst | 73 ++++++++++++++++++++++++++++++++++-------------- 1 file changed, 52 insertions(+), 21 deletions(-) (limited to 'docs') diff --git a/docs/dev/translation.rst b/docs/dev/translation.rst index be0cf5bef..bb4ac0317 100644 --- a/docs/dev/translation.rst +++ b/docs/dev/translation.rst @@ -5,45 +5,76 @@ Translation =========== .. _weblate.bubu1.eu: https://weblate.bubu1.eu/projects/searxng/ +.. _Weblate: https://docs.weblate.org +.. _translations branch: https://github.com/searxng/searxng/tree/translations +.. _orphan branch: https://git-scm.com/docs/git-checkout#Documentation/git-checkout.txt---orphanltnewbranchgt +.. _Weblate repository: https://weblate.bubu1.eu/projects/searxng/searxng/#repository +.. _wlc: https://docs.weblate.org/en/latest/wlc.html -Translation takes place on `weblate.bubu1.eu`_ ( `documentation `_ ). +.. |translated| image:: https://weblate.bubu1.eu/widgets/searxng/-/searxng/svg-badge.svg + :target: https://weblate.bubu1.eu/projects/searxng/ -New messages on the master branch are extracted and pushed to Weblate automatically. +.. sidebar:: |translated| -Every Friday, a GitHub workflow creates a pull request with the updated translations (messages.mo, messages.po, messages.mo files). + - Weblate_ + - SearXNG `translations branch`_ + - SearXNG `Weblate repository`_ + - Weblate Client: wlc_ + - Babel Command-Line: `pybabel `_ + - `weblate workflow `_ -.. image:: https://weblate.bubu1.eu/widgets/searxng/-/searxng/svg-badge.svg - :target: https://weblate.bubu1.eu/projects/searxng/ +Translation takes place on weblate.bubu1.eu_. + +Translations which has been added by translators on the weblate.bubu1.eu_ UI are +committed to Weblate's counterpart of the SearXNG *origin* repository which is +located at ``https://weblate.bubu1.eu/git/searxng/searxng``. + +There is no need to clone this repository, :ref:`SearXNG Weblate workflow` take +care of the synchronization with the *origin*. To avoid merging commits from +the counterpart directly on the ``master`` branch of *SearXNG origin*, a *pull +request* (PR) is created by this workflow. -Weblate integration -=================== +Weblate monitors the `translations branch`_, not the ``master`` branch. This +branch is an `orphan branch`_, decoupled from the master branch (we already know +orphan branches from the ``gh-pages``). The `translations branch`_ contains +only the -Weblate monitors the `translations branch `_, not the master branch. +- ``translation/messages.pot`` and the +- ``translation/*/messages.po`` files, nothing else. -This branch contains only the .pot and pot files, nothing else. -Documentation -------------- +.. _SearXNG Weblate workflow: -* `wlc `_ -* `pybabel `_ -* `weblate workflow `_ +.. figure:: translation.svg -Worfklow --------- + SearXNG's PR workflow to be in sync with Weblate -.. image:: translation.svg +Sync from *origin* to *weblate*: ``make babel.master.to.translations`` + For each commit on the ``master`` branch of SearXNG *origin* the GitHub job + :origin:`babel / Update translations branch + <.github/workflows/integration.yml>` checks for updated translations. +Sync from *weblate* to *origin*: ``make babel.translations.to.master`` + Every Friday, the GitHub workflow :origin:`babel / translations: update master + branch <.github/workflows/translations-update.yml>` creates a PR with the + updated translation files: + + - ``translation/messages.pot``, + - ``translation/*/messages.po`` and + - ``translation/*/messages.mo`` wlc ---- +=== + +.. _wlc configuration: https://docs.weblate.org/en/latest/wlc.html#wlc-config +.. _API key: https://weblate.bubu1.eu/accounts/profile/#api -All weblate integration is done by GitHub workflows, but if you want to use wlc, copy this content into `~/.config/weblate `_ : +All weblate integration is done by GitHub workflows, but if you want to use wlc_, +copy this content into `wlc configuration`_ in your HOME ``~/.config/weblate`` .. code-block:: ini [keys] https://weblate.bubu1.eu/api/ = APIKEY - -Replace `APIKEY` by `your API key `_. +Replace ``APIKEY`` by your `API key`_. -- cgit v1.2.3 From 640ffa3aaae94faa7eeebac8f2aba32031cf85dd Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Mon, 9 Aug 2021 17:59:27 +0200 Subject: [translations] WF figure rename label to "weblate clone of SearXNG origin" Signed-off-by: Markus Heiser --- docs/dev/translation.svg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/dev/translation.svg b/docs/dev/translation.svg index 060e58420..a4f26b86b 100644 --- a/docs/dev/translation.svg +++ b/docs/dev/translation.svg @@ -1,4 +1,4 @@ -master branchmaster branchtranslations_update branchtranslations_update branchtranslations branchtranslations branchweblate clone oftranslations branchweblate clone oftranslations branchweblatepending changesweblatepending changesfor each commit on master.github/workflows/integration.ymlmake babel.master.to.translationswlc lockwlc pullwlc commitgit merge weblate/translationspybabel extractextract messages, store messages.pot on translations branchpybabel update (messages.po)git add searx/translationsgit commitgit pushwlc unlockevery Friday.github/workflows/translations-update.ymlmake babel.translations.to.masterwlc lockwlc pullwlc commitgit merge weblate/translationspybabel compilecp searx/translationsgit addgit commitwlc unlockcreate or update pull request"Update translations"developper's reviewmerge pull request weblate.translations.worktree Create git worktree ${TRANSLATIONS_WORKTREE} and checkout branch 'translations' from Weblate's counterpart (weblate) of the SearXNG (origin):: remote weblate https://weblate.bubu1.eu/git/searxng/searxng/ - babel.weblate.to.translations --> weblate.to.translations Update 'translations' branch of SearXNG (origin) with last additions from Weblate. - babel.translations.to.master --> weblate.translations.commit Update 'translations' branch of SearXNG (origin) with last additions from Weblate. Copy the changes to the master branch, compile translations and create a commit in the local branch (master) - babel.master.to.translations --> weblate.push.translations Push *translation changes* from SearXNG (origin) to Weblate's counterpart (weblate). Signed-off-by: Markus Heiser --- docs/dev/translation.rst | 4 ++-- docs/dev/translation.svg | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'docs') diff --git a/docs/dev/translation.rst b/docs/dev/translation.rst index c0e3c3851..922c29c54 100644 --- a/docs/dev/translation.rst +++ b/docs/dev/translation.rst @@ -49,12 +49,12 @@ only the SearXNG's PR workflow to be in sync with Weblate -Sync from *origin* to *weblate*: ``make babel.master.to.translations`` +Sync from *origin* to *weblate*: using ``make weblate.push.translations`` For each commit on the ``master`` branch of SearXNG *origin* the GitHub job :origin:`babel / Update translations branch <.github/workflows/integration.yml>` checks for updated translations. -Sync from *weblate* to *origin*: ``make babel.translations.to.master`` +Sync from *weblate* to *origin*: using ``make weblate.translations.commit`` Every Friday, the GitHub workflow :origin:`babel / create PR for additons from weblate <.github/workflows/translations-update.yml>` creates a PR with the updated translation files: diff --git a/docs/dev/translation.svg b/docs/dev/translation.svg index a4f26b86b..70400cca7 100644 --- a/docs/dev/translation.svg +++ b/docs/dev/translation.svg @@ -1,4 +1,4 @@ -master branchmaster branchtranslations_update branchtranslations_update branchtranslations branchtranslations branchweblate clone ofSearXNG repositoryweblate clone ofSearXNG repositoryweblatepending changesweblatepending changesfor each commit on master.github/workflows/integration.ymlmake babel.master.to.translationswlc lockwlc pullwlc commitgit merge weblate/translationspybabel extractextract messages, store messages.pot on translations branchpybabel update (messages.po)git add searx/translationsgit commitgit pushwlc unlockevery Friday.github/workflows/translations-update.ymlmake babel.translations.to.masterwlc lockwlc pullwlc commitgit merge weblate/translationspybabel compilecp searx/translationsgit addgit commitwlc unlockcreate or update pull request"Update translations"developper's reviewmerge pull request