Skip to content
This repository has been archived by the owner on Aug 22, 2024. It is now read-only.

Commit

Permalink
[WIP] CI: i18n
Browse files Browse the repository at this point in the history
  • Loading branch information
olivierdalang committed Mar 21, 2023
1 parent f77406e commit f1fc4af
Show file tree
Hide file tree
Showing 5 changed files with 116 additions and 38 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/translations-pull.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
on:
schedule:
- cron: "5 1 * * *"
workflow_dispatch:

jobs:
sync_translations:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.FAIRY_TOKEN }}

- name: Install Requirements
run: |
sudo apt-get install -y qttools5-dev-tools
# v1.6.5: 2023-02-16
curl -OL https://github.com/transifex/cli/releases/download/v1.6.5/tx-linux-amd64.tar.gz
tar -xvzf tx-linux-amd64.tar.gz
- name: 🌍 Pull Translations
shell: bash
env:
TX_TOKEN: ${{ secrets.TX_TOKEN }}
# Taken from https://github.com/opengisch/QField/blob/master/scripts/ci/pull_translations.sh
# TODO: probably not all that is useful ?!
run: |
set -e
echo "::group::tx-pull"
./tx pull --minimum-perc=50 --force
echo "::endgroup::"
echo "::group::android specific translations"
for x in platform/android/res/values-*_*; do
# $x is evaluated to the glob string literal when no dir is found
if [[ -d $x ]]
then
rm -rf $(echo $x | sed -e 's/_/-r/')
mv $x $(echo $x | sed -e 's/_/-r/')
fi
done
find platform/android/res/values-* -name strings.xml -type f -print0 | while read -d $'\0' file; do
# .bak is a workaround GNU & BSD/macOS compatibility
sed -i.bak 's/<!\[CDATA \[/<!\[CDATA\[/g' $file
rm $file.bak
done
echo "::endgroup::"
echo "::group::remove line numbers"
lupdate -locations none -recursive src -ts i18n/qfield_en.ts
echo "::endgroup::"
- uses: EndBug/add-and-commit@v9
with:
message: Synchronize translations
author_name: Translation update 💬
author_email: info@opengis.ch
add: '["platform", "i18n"]'
23 changes: 23 additions & 0 deletions .github/workflows/translations-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
on:
push:
branches:
- main

jobs:
translations:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install Requirements
run: |
sudo apt-get install -y qttools5-dev-tools
# v1.6.5: 2023-02-16
curl -OL https://github.com/transifex/cli/releases/download/v1.6.5/tx-linux-amd64.tar.gz
tar -xvzf tx-linux-amd64.tar.gz
- name: "🌍 Push Translations"
env:
tx_token: ${{ secrets.TX_TOKEN }}
run: TX_TOKEN=$tx_token ./scripts/ci/update-translations.sh
34 changes: 34 additions & 0 deletions doc/.tx/config → .tx/config
Original file line number Diff line number Diff line change
@@ -1,6 +1,40 @@
[main]
host = https://www.transifex.com

[QGEP.qgep-project]
source_file = i18n/qgep-project.ts
file_filter = i18n/qgep-project_<lang>.ts
source_lang = en
trans.de = i18n/qgep-project_de.ts
trans.fr = i18n/qgep-project_fr.ts
trans.it = i18n/qgep-project_it.ts
type = QT

[QGEP.qgep-plugin]
source_file = i18n/qgepplugin_en.ts
file_filter = i18n/qgepplugin_<lang>.ts
source_lang = en
trans.de = i18n/qgepplugin_de.ts
trans.fr = i18n/qgepplugin_fr.ts
trans.it = i18n/qgepplugin_it.ts
type = QT

[QGEP.qgepplugin-js]
source_file = i18n/qgepplugin-js_en.ts
file_filter = i18n/qgepplugin-js_<lang>.ts
source_lang = en
trans.de = i18n/qgepplugin-js_de.ts
trans.fr = i18n/qgepplugin-js_fr.ts
trans.it = i18n/qgepplugin-js_it.ts
type = QT

[o:qgep:p:qgep-project:r:qgep_ents]
file_filter = project/qgep_<lang>.ts
source_file = project/qgep.ts
source_lang = en
type = QT


[o:qgep:p:qgep-documentation:r:index]
source_file = i18n/pot/index.pot
source_lang = en
Expand Down
29 changes: 0 additions & 29 deletions plugin/.tx/config

This file was deleted.

9 changes: 0 additions & 9 deletions project/.tx/config

This file was deleted.

0 comments on commit f1fc4af

Please sign in to comment.