anki/qt/po/scripts/build-mo-files
evandrocoan 06056236c0 Fixed build-mo-files not failing the build when msgmerge
is not found:
https://github.com/ankitects/anki/runs/617116053?check_suite_focus=true#step:27:1244

The build was not falling because when you do `(commands)` in a
shell script, the `set -e` directive is not inherited. Then, either
do not start a new shell or just use an if to test the error condition.
2020-04-25 05:17:24 -03:00

23 lines
507 B
Bash
Executable File

#!/bin/bash
#
# build mo files
#
set -eu -o pipefail ${SHELLFLAGS}
targetDir="../aqt_data/locale/gettext"
mkdir -p $targetDir
echo "Compiling *.po..."
for file in repo/desktop/*/anki.po
do
outdir=$(echo "$file" | \
perl -pe "s%repo/desktop/(.*)/anki.po%$targetDir/\1/LC_MESSAGES%")
outfile="$outdir/anki.mo"
mkdir -p $outdir
if ! msgmerge -q "$file" repo/desktop/anki.pot | msgfmt - --output-file="$outfile"; then
echo "error building $file";
exit 1;
fi;
done