CI: fix-up txpull

- canonicalize the files fetched from TX after import
This commit is contained in:
Adriaan de Groot 2020-01-25 23:26:02 +01:00
parent 6eb52c2989
commit 48dec91606

View File

@ -25,6 +25,19 @@ test -f "CMakeLists.txt" || { echo "! Not at Calamares top-level" ; exit 1 ; }
test -f ".tx/config" || { echo "! Not at Calamares top-level" ; exit 1 ; }
test -f "calamares.desktop" || { echo "! Not at Calamares top-level" ; exit 1 ; }
### FIND EXECUTABLES
#
#
XMLLINT=""
for _xmllint in xmllint
do
$_xmllint --version > /dev/null 2>&1 && XMLLINT=$_xmllint
test -n "$XMLLINT" && break
done
# XMLLINT is optional
### FETCH TRANSLATIONS
#
# Use Transifex client to get translations; this depends on the
@ -33,6 +46,7 @@ test -f "calamares.desktop" || { echo "! Not at Calamares top-level" ; exit 1 ;
export QT_SELECT=5
tx pull --force --source --all
### CLEANUP TRANSLATIONS
#
# Some languages have been deprecated. They may still exist in Transifex,
@ -52,6 +66,15 @@ drop_language pl_PL
{ cat calamares.desktop.in ; grep "\\[[a-zA-Z_@]*]=" calamares.desktop ; } > calamares.desktop.new
mv calamares.desktop.new calamares.desktop
# And fixup the XML files like in txpush.sh
if test -n "$XMLLINT" ; then
for TS_FILE in lang/calamares_*.ts
do
$XMLLINT --c14n11 "$TS_FILE" | { echo "<!DOCTYPE TS>" ; cat - ; } | $XMLLINT --format --encode utf-8 -o "$TS_FILE".new - && mv "$TS_FILE".new "$TS_FILE"
done
fi
### COMMIT TRANSLATIONS
#
# Produce multiple commits (for the various parts of the i18n