Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compile and package project translation #143

Merged
merged 1 commit into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions .github/workflows/project-translation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,21 @@ 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'

- uses: actions/upload-artifact@v4
with:
name: project-translations
path: project/teksi_wastewater*
if-no-files-found: error
13 changes: 7 additions & 6 deletions project/scripts/project-translation-compile.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,23 @@ 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
rm $f # do not package ts files
done

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