mirror of
https://github.com/searxng/searxng.git
synced 2024-11-29 06:01:02 +00:00
[translations] ./manage rename shell functions to integrate weblate
Functions implemented to run *Weblate* workflows should use prefix 'weblate.': - babel.setup.translations.worktree --> 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 <markus.heiser@darmarit.de>
This commit is contained in:
parent
0dc8d244c5
commit
97355672cd
6 changed files with 26 additions and 17 deletions
2
.github/workflows/integration.yml
vendored
2
.github/workflows/integration.yml
vendored
|
@ -127,7 +127,7 @@ jobs:
|
||||||
id: update
|
id: update
|
||||||
run: |
|
run: |
|
||||||
git restore utils/brand.env
|
git restore utils/brand.env
|
||||||
make V=1 babel.master.to.translations
|
make V=1 weblate.push.translations
|
||||||
|
|
||||||
dockers:
|
dockers:
|
||||||
name: Docker
|
name: Docker
|
||||||
|
|
2
.github/workflows/translations-update.yml
vendored
2
.github/workflows/translations-update.yml
vendored
|
@ -36,7 +36,7 @@ jobs:
|
||||||
git config --global user.name "searxng-bot"
|
git config --global user.name "searxng-bot"
|
||||||
- name: Merge and push transation updates
|
- name: Merge and push transation updates
|
||||||
run: |
|
run: |
|
||||||
make V=1 babel.translations.to.master
|
make V=1 weblate.translations.commit
|
||||||
- name: Create Pull Request
|
- name: Create Pull Request
|
||||||
id: cpr
|
id: cpr
|
||||||
uses: peter-evans/create-pull-request@v3
|
uses: peter-evans/create-pull-request@v3
|
||||||
|
|
2
Makefile
2
Makefile
|
@ -77,7 +77,7 @@ test.shell:
|
||||||
# wrap ./manage script
|
# wrap ./manage script
|
||||||
|
|
||||||
MANAGE += buildenv
|
MANAGE += buildenv
|
||||||
MANAGE += babel.translations.to.master babel.master.to.translations
|
MANAGE += weblate.translations.commit weblate.push.translations
|
||||||
MANAGE += data.all data.languages data.useragents data.osm_keys_tags
|
MANAGE += data.all data.languages data.useragents data.osm_keys_tags
|
||||||
MANAGE += docs.html docs.live docs.gh-pages docs.prebuild docs.clean
|
MANAGE += docs.html docs.live docs.gh-pages docs.prebuild docs.clean
|
||||||
MANAGE += docker.build docker.push docker.buildx
|
MANAGE += docker.build docker.push docker.buildx
|
||||||
|
|
|
@ -49,12 +49,12 @@ only the
|
||||||
|
|
||||||
SearXNG's PR workflow to be in sync with Weblate
|
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
|
For each commit on the ``master`` branch of SearXNG *origin* the GitHub job
|
||||||
:origin:`babel / Update translations branch
|
:origin:`babel / Update translations branch
|
||||||
<.github/workflows/integration.yml>` checks for updated translations.
|
<.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
|
Every Friday, the GitHub workflow :origin:`babel / create PR for additons from
|
||||||
weblate <.github/workflows/translations-update.yml>` creates a PR with the
|
weblate <.github/workflows/translations-update.yml>` creates a PR with the
|
||||||
updated translation files:
|
updated translation files:
|
||||||
|
|
File diff suppressed because one or more lines are too long
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
27
manage
27
manage
|
@ -123,7 +123,8 @@ buildenv() {
|
||||||
|
|
||||||
TRANSLATIONS_WORKTREE="$CACHE/translations"
|
TRANSLATIONS_WORKTREE="$CACHE/translations"
|
||||||
|
|
||||||
babel.setup.translations.worktree() {
|
weblate.translations.worktree() {
|
||||||
|
|
||||||
# Create git worktree ${TRANSLATIONS_WORKTREE} and checkout branch
|
# Create git worktree ${TRANSLATIONS_WORKTREE} and checkout branch
|
||||||
# 'translations' from Weblate's counterpart (weblate) of the SearXNG
|
# 'translations' from Weblate's counterpart (weblate) of the SearXNG
|
||||||
# (origin).
|
# (origin).
|
||||||
|
@ -147,7 +148,8 @@ babel.setup.translations.worktree() {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
babel.weblate.to.translations() {
|
weblate.to.translations() {
|
||||||
|
|
||||||
# Update 'translations' branch of SearXNG (origin) with last additions from
|
# Update 'translations' branch of SearXNG (origin) with last additions from
|
||||||
# Weblate.
|
# Weblate.
|
||||||
|
|
||||||
|
@ -168,7 +170,8 @@ babel.weblate.to.translations() {
|
||||||
pyenv.cmd wlc commit
|
pyenv.cmd wlc commit
|
||||||
|
|
||||||
# get the translations in a worktree
|
# get the translations in a worktree
|
||||||
babel.setup.translations.worktree
|
weblate.translations.worktree
|
||||||
|
|
||||||
pushd "${TRANSLATIONS_WORKTREE}"
|
pushd "${TRANSLATIONS_WORKTREE}"
|
||||||
git remote update weblate
|
git remote update weblate
|
||||||
git merge weblate/translations
|
git merge weblate/translations
|
||||||
|
@ -178,7 +181,8 @@ babel.weblate.to.translations() {
|
||||||
dump_return $?
|
dump_return $?
|
||||||
}
|
}
|
||||||
|
|
||||||
babel.translations.to.master() {
|
weblate.translations.commit() {
|
||||||
|
|
||||||
# Update 'translations' branch of SearXNG (origin) with last additions from
|
# Update 'translations' branch of SearXNG (origin) with last additions from
|
||||||
# Weblate. Copy the changes to the master branch, compile translations and
|
# Weblate. Copy the changes to the master branch, compile translations and
|
||||||
# create a commit in the local branch (master)
|
# create a commit in the local branch (master)
|
||||||
|
@ -187,12 +191,17 @@ babel.translations.to.master() {
|
||||||
( set -e
|
( set -e
|
||||||
# lock change on weblate
|
# lock change on weblate
|
||||||
pyenv.cmd wlc lock
|
pyenv.cmd wlc lock
|
||||||
babel.setup.translations.worktree
|
|
||||||
|
# get translations branch in git worktree (TRANSLATIONS_WORKTREE)
|
||||||
|
weblate.translations.worktree
|
||||||
existing_commit_hash=$(cd "${TRANSLATIONS_WORKTREE}"; git log -n1 --pretty=format:'%h')
|
existing_commit_hash=$(cd "${TRANSLATIONS_WORKTREE}"; git log -n1 --pretty=format:'%h')
|
||||||
|
|
||||||
# pull weblate commits
|
# pull weblate commits
|
||||||
babel.weblate.to.translations
|
weblate.to.translations
|
||||||
|
|
||||||
# copy the changes to the master branch
|
# copy the changes to the master branch
|
||||||
cp -rv --preserve=mode,timestamps "${TRANSLATIONS_WORKTREE}/searx/translations" "searx"
|
cp -rv --preserve=mode,timestamps "${TRANSLATIONS_WORKTREE}/searx/translations" "searx"
|
||||||
|
|
||||||
# compile translations
|
# compile translations
|
||||||
build_msg BABEL 'compile translation catalogs into binary MO files'
|
build_msg BABEL 'compile translation catalogs into binary MO files'
|
||||||
pyenv.cmd pybabel compile --statistics \
|
pyenv.cmd pybabel compile --statistics \
|
||||||
|
@ -211,7 +220,7 @@ babel.translations.to.master() {
|
||||||
dump_return $exitcode
|
dump_return $exitcode
|
||||||
}
|
}
|
||||||
|
|
||||||
babel.master.to.translations() {
|
weblate.push.translations() {
|
||||||
|
|
||||||
# Push *translation changes* from SearXNG (origin) to Weblate's counterpart
|
# Push *translation changes* from SearXNG (origin) to Weblate's counterpart
|
||||||
# (weblate).
|
# (weblate).
|
||||||
|
@ -235,7 +244,7 @@ babel.master.to.translations() {
|
||||||
pyenv.cmd wlc lock
|
pyenv.cmd wlc lock
|
||||||
|
|
||||||
# get translations branch in git worktree (TRANSLATIONS_WORKTREE)
|
# get translations branch in git worktree (TRANSLATIONS_WORKTREE)
|
||||||
babel.setup.translations.worktree
|
weblate.translations.worktree
|
||||||
|
|
||||||
# update messages.pot in the master branch
|
# update messages.pot in the master branch
|
||||||
build_msg BABEL 'extract messages from source files and generate POT file'
|
build_msg BABEL 'extract messages from source files and generate POT file'
|
||||||
|
@ -258,7 +267,7 @@ babel.master.to.translations() {
|
||||||
popd
|
popd
|
||||||
|
|
||||||
# merge weblate commits into the translations branch
|
# merge weblate commits into the translations branch
|
||||||
babel.weblate.to.translations
|
weblate.to.translations
|
||||||
|
|
||||||
# restore messages.pot in the translations branch
|
# restore messages.pot in the translations branch
|
||||||
pushd "${TRANSLATIONS_WORKTREE}"
|
pushd "${TRANSLATIONS_WORKTREE}"
|
||||||
|
|
Loading…
Reference in a new issue