2014-09-06 12:10:02 -07:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
ROOT=$PWD
|
|
|
|
OUTPUT=$ROOT/build
|
|
|
|
|
2015-03-31 04:09:46 -07:00
|
|
|
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
|
|
|
|
|
2016-11-22 16:44:08 -07:00
|
|
|
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"
|
2015-03-31 04:09:46 -07:00
|
|
|
$LCONVERT_BIN -locations relative $po_file -o $lang.ts
|
2014-09-06 12:10:02 -07:00
|
|
|
echo " Create $lang.qm"
|
2015-03-31 04:09:46 -07:00
|
|
|
$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!"
|