build: add a test to check the Windows installer languages.

This way, we will avoid in the future any discrepancies between
languages set in the Windows installer and available translations (po
files in po-windows-installer/) because `make check`/`ninja test` will
fail.
This commit is contained in:
Jehan
2021-05-18 20:18:14 +02:00
parent 9d065b8718
commit 8a42c6ccc2
3 changed files with 34 additions and 0 deletions

View File

@ -71,3 +71,9 @@ clean-local:
echo " RM $$isl"; \
rm -f "$$isl"; \
done
TESTS_ENVIRONMENT = \
chmod +x test-installer-langs.sh; \
GIMP_TESTING_ABS_TOP_SRCDIR=@abs_top_srcdir@
TESTS = test-installer-langs.sh

View File

@ -59,3 +59,10 @@ foreach language : languages
build_by_default: true,
)
endforeach
test('windows-installer-langs',
find_program('test-installer-langs.sh'),
env: [
'GIMP_TESTING_ABS_TOP_SRCDIR=' + meson.source_root(),
],
suite: 'build')

View File

@ -0,0 +1,21 @@
#!/bin/sh
# Make sure that the languages specified in the installer match the
# translations present. This check step is necessary to not forget new
# installer translations because we have a manual step.
INSTALLER_LANGS=`grep -rI '^Name:.*MessagesFile' ${GIMP_TESTING_ABS_TOP_SRCDIR}/build/windows/installer/gimp3264.iss | \
sed 's/^Name: *"\([a-zA-Z_]*\)".*$/\1/' | sort`
# 'en' doesn't have a gettext file because it is the default.
INSTALLER_LANGS=`echo "$INSTALLER_LANGS" | tr '\n\r' ' ' | sed 's/\<en\> //'`
PO_LANGS=`ls ${GIMP_TESTING_ABS_TOP_SRCDIR}/po-windows-installer/*.po |sed 's%.*/po-windows-installer/\([a-zA-Z_]*\).po%\1%'`
PO_LANGS=`echo "$PO_LANGS" | tr '\n\r' ' '`
if [ "$PO_LANGS" = "$INSTALLER_LANGS" ]; then
exit 0
else
echo "Error: languages listed in the Windows installer script do not match the .po files in po-windows-installer/."
echo "Please verify: build/windows/installer/gimp3264.iss"
exit 1
fi