Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(translation): Check other translation restrictions as well
Signed-off-by: Joas Schilling <[email protected]>
  • Loading branch information
nickvergessen committed Feb 25, 2025
commit e8ed337ae9c0947dbd4db6741c823e08c92ab283
30 changes: 29 additions & 1 deletion translations-app/handleAppTranslations.sh
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,35 @@ done
# End of verbose mode
set +x

EXIT_CODE=0
# Confirm German translation does not have the false "don't translate" warning
if [ $(jq '.translations[]' l10n/de.json | grep 'Benötigt keine Übersetzung. Hier wird nur die formelle Übersetzung verwendet (de_DE).' | wc -l) -ne 0 ]; then
echo "German language file contains the 'Benötigt keine Übersetzung. Hier wird nur die formelle Übersetzung verwendet (de_DE).' hint." 1>&2
exit 3
EXIT=3
fi

# Confirm English source does not contain the pipe character which breaks the Symfony Translation library
if [ $(jq '.translations | keys[]' l10n/en_GB.json | grep '|' | wc -l) -ne 0 ]; then
echo "English source contains the pipe character" 1>&2
EXIT=4
fi

for file in $(ls l10n/*.json)
do
# Make sure only RTL languages contain such characters
if [ "$file" != "l10n/ar.json" -a "$file" != "l10n/fa.json" -a "$file" != "l10n/he.json" -a "$file" != "l10n/ps.json" -a "$file" != "l10n/ug.json" -a "$file" != "l10n/ur_PK.json" ]; then
if [ $(jq '.translations[]' $file | grep -E '(\x{061C}|\x{0623}|\x{200E}|\x{200F}|\x{202A}|\x{202B}|\x{202C}|\x{202D}|\x{202E}|\x{2066}|\x{2067}|\x{2068}|\x{2069}|\x{206C}|\x{206D})' | wc -l) -ne 0 ]; then
echo "$file contains a RTL limited characters in the translations" 1>&2
EXIT=5
fi
fi

# Confirm translations do not contain the pipe character which breaks the Symfony Translation library
if [ $(jq '.translations[]' $file | grep '|' | wc -l) -ne 0 ]; then
echo "$file contains the pipe character" 1>&2
EXIT=6
fi
done


exit $EXIT_CODE