gnome-shell/.gitlab-ci/check-potfiles.sh
Florian Müllner 7a0c866d97 ci: Check that files with translatable strings are listed in POTFILES
Also known as "Piotr Drąg Bot".

We will soon make sure that files processed by xgettext don't use template
strings. To make that check as adequate as possible, ensure that no source
code files are missing from POTFILES.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/1016
2020-02-26 22:53:00 +00:00

27 lines
519 B
Bash
Executable File

#!/usr/bin/env bash
srcdirs="js src subprojects/extensions-tool"
globs=('*.js' '*.c')
# find source files that contain gettext keywords
files=$(grep -lR ${globs[@]/#/--include=} '\(gettext\|[^I_)]_\)(' $srcdirs)
# find those that aren't listed in POTFILES.in
missing=$(for f in $files; do ! grep -q ^$f po/POTFILES.in && echo $f; done)
if [ ${#missing} -eq 0 ]; then
exit 0
fi
cat >&2 <<EOT
The following files are missing from po/POTFILES.po:
EOT
for f in $missing; do
echo " $f" >&2
done
echo >&2
exit 1