Skip to content

Sync Translations

Sync Translations #964

name: Sync Translations
on:
workflow_dispatch:
push:
pull_request:
schedule:
# * is a special character in YAML so you have to quote this string
# run every day at 00:42
- cron: '42 0 * * *'
jobs:
sync-translations:
runs-on: ubuntu-latest
steps:
- name: Install Dependencies
run: |
sudo apt-get -qq update
sudo apt-get -qq install gettext qttools5-dev-tools
- name: Checkout current repo
uses: actions/checkout@v2
- name: Checkout avogadroapp
uses: actions/checkout@v2
with:
repository: openchemistry/avogadroapp
path: openchemistry/avogadroapp
- name: Checkout avogadrolibs
uses: actions/checkout@v2
with:
repository: openchemistry/avogadrolibs
path: openchemistry/avogadrolibs
- name: Debug file layout
run: |
echo `pwd`
echo `ls -d *`
- name: Update avogadrolibs QM files
run: |
PROJECT=avogadrolibs
cd openchemistry/${PROJECT}/i18n
# generate the TS files from the PO files
echo "Generating TS"
for file in *.po; do
lconvert $file -o ${file%%.po}.ts;
done;
echo "updating TS"
for file in *.ts; do
lupdate .. -ts $file
done;
# generate the QM files from TS files
echo "Generating QM"
lrelease -compress -removeidentical *.ts
# don't keep the TS anymore
rm *.ts
echo "Renaming QM"
for file in *.qm; do
mv ${file} ${PROJECT}-${file};
done
echo `ls *.qm`
mv *.qm ${GITHUB_WORKSPACE}/${PROJECT}
- name: Update avogadroapp QM files
run: |
PROJECT=avogadroapp
cd openchemistry/${PROJECT}/i18n
# generate the TS files from the PO files
for file in *.po; do
lconvert $file -o ${file%%.po}.ts;
done;
echo "updating TS"
for file in *.ts; do
lupdate .. -ts $file
done;
# generate the QM files from TS files
lrelease -compress -removeidentical *.ts
# don't keep the TS anymore
rm *.ts
for file in *.qm; do
mv ${file} ${PROJECT}-${file};
done
mv *.qm ${GITHUB_WORKSPACE}/${PROJECT}
- name: Update git repo
uses: EndBug/add-and-commit@v7
with:
default_author: github_actions
message: Apply automatic translations
add: '*/*.qm'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
path: ${{ runner.workspace }}/*/*.qm
name: AvoI18n