ci: Prohibit template strings in translatable files
Sadly, xgettext's dealing with template strings is abysimal, so we had to stop using them in files with translatable strings. Make sure we don't accidentally sneak in template strings again(*) and enforce that rule in a CI job. (*) easy "mistake", considering how much nicer they are than String.prototype.format() https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/1016
This commit is contained in:
parent
7a0c866d97
commit
a7d974e670
@ -53,6 +53,13 @@ potfile_check:
|
||||
- ./.gitlab-ci/check-potfiles.sh
|
||||
<<: *only_default
|
||||
|
||||
no_template_check:
|
||||
image: registry.gitlab.gnome.org/gnome/gnome-shell/extension-ci:v1
|
||||
stage: review
|
||||
script:
|
||||
- ./.gitlab-ci/check-template-strings.sh
|
||||
<<: *only_default
|
||||
|
||||
build:
|
||||
image: registry.gitlab.gnome.org/gnome/mutter/master:v3
|
||||
stage: build
|
||||
|
23
.gitlab-ci/check-template-strings.sh
Executable file
23
.gitlab-ci/check-template-strings.sh
Executable file
@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# find files from POTFILES.in that use js template strings
|
||||
baddies=$(grep -l '${' $(grep ^js po/POTFILES.in))
|
||||
|
||||
if [ ${#baddies} -eq 0 ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
cat >&2 <<EOT
|
||||
|
||||
xgettext cannot handle template strings properly, so we ban their use
|
||||
in files with translatable strings.
|
||||
|
||||
The following files are listed in po/POTFILES.in and use template strings:
|
||||
|
||||
EOT
|
||||
for f in $baddies; do
|
||||
echo " $f" >&2
|
||||
done
|
||||
echo >&2
|
||||
|
||||
exit 1
|
Loading…
Reference in New Issue
Block a user