Translations/release.sh

44 lines
944 B
Bash
Raw Normal View History

2014-09-06 12:10:02 -07:00
#!/bin/sh
set -e
ROOT=$PWD
OUTPUT=$ROOT/build
LCONVERT_BIN=${LCONVERT_BIN:-lconvert-qt5}
LRELEASE_BIN=${LRELEASE_BIN:-lrelease-qt5}
LUPDATE_BIN=${LUPDATE_BIN:-lupdate-qt5}
2014-09-06 12:10:02 -07:00
if [ ! -d $OUTPUT ]
then
mkdir $OUTPUT
fi
echo "Cleaning old .qm files..."
rm -f $OUTPUT/*
2014-09-06 12:10:02 -07:00
echo "Creating .qm files..."
for po_file in $(ls *.po)
do
2018-12-08 19:52:24 -07:00
echo "Considering ${po_file}"
if cat "${po_file}" | grep '\"X-Qt-Contexts: true\\n\"' > /dev/null ; then
echo "Translation ${po_file} is OK"
else
echo "Translation ${po_file} is bad (missing X-Qt-Contexts)"
exit 1
fi
2014-09-06 12:10:02 -07:00
# gets everything up to the first dot
lang=$(echo $po_file | grep -oP "^[^\.]*")
echo " Converting $po_file to $lang.ts"
$LCONVERT_BIN -locations relative $po_file -o $lang.ts
2014-09-06 12:10:02 -07:00
echo " Create $lang.qm"
$LRELEASE_BIN $lang.ts -qm $OUTPUT/$lang.qm
2014-09-06 12:10:02 -07:00
done
2014-09-06 15:39:32 -07:00
ls $OUTPUT/ | grep -v index > $OUTPUT/index
2014-09-06 12:10:02 -07:00
echo "Removing intermediate files..."
rm *.ts
2014-09-06 15:39:32 -07:00
echo "All done!"