Skip to content

Commit

Permalink
compile and package project translation
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed Feb 2, 2024
1 parent 8e0f8f5 commit 6ee8630
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 9 deletions.
19 changes: 16 additions & 3 deletions .github/workflows/project-translation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
push:
branches:
- main
- project-tx
paths:
- project/**
- '.github/workflows/project-translation.yml'
Expand Down Expand Up @@ -38,10 +39,22 @@ jobs:
docker compose up --build -d
docker compose exec db init_db.sh wait
- name: Translate
run: |
docker compose run qgis sh -c 'xvfb-run /usr/src/project/scripts/project-translation-create-source.py /usr/src/project/teksi_wastewater.qgs'
- name: Translate (create sources)
run: docker compose run qgis sh -c 'xvfb-run /usr/src/project/scripts/project-translation-create-source.py /usr/src/project/teksi_wastewater.qgs'

- name: Push to TX
working-directory: project
run: ./tx push --source

- name: Compile Translations (fetch translated content)
working-directory: project
run: |
./tx pull -a
docker compose run qgis sh -c '/usr/src/project/scripts/project-translation-compile.sh /usr/src/project/teksi_wastewater.qgs'
rm project/teksi_wastewater_*.ts # do not package ts files
- uses: actions/upload-artifact@v4
with:
name: project-translated
path: project/teksi_wastewater*
if-no-files-found: error
12 changes: 6 additions & 6 deletions project/scripts/project-translation-compile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,22 @@ if [[ -z ${PROJECT} ]]; then
exit 1
fi

PATH=$(dirname ${PROJECT})
DIR=$(dirname ${PROJECT})

echo $PATH
echo $DIR

if [[ ! -d ${PATH} ]]; then
echo "'${PATH}' directory does not exist"
if [[ ! -d ${DIR} ]]; then
echo "'${DIR}' directory does not exist"
exit 1
fi

FOUND=0
for f in ${PATH}/*\_*.ts
for f in ${DIR}/*\_*.ts
do
FOUND=1
lrelease $f ${f%.ts}.qm
done

if [[ ${FOUND} -eq 0 ]]; then
echo "No TS file found in '${PATH}'"
echo "No TS file found in '${DIR}'"
fi

0 comments on commit 6ee8630

Please sign in to comment.