RomRaider/3rdparty/IzPack/bin/langpacks/checklangpack

41 lines
856 B
Bash

#!/bin/sh
#
tmpfile="stringids.tmp"
# rather use English as the authoritative source for string IDs?
reference_file="*.xml"
idfilter='/^.*id="\([^"]*\)".*$/{
s//\1/
p
}'
checkfiles="*.xml"
if [ $# -ge 1 -a -n "$1" ] ; then
checkfiles="$1"
fi
# basic sanity check
if [ ! -f eng.xml ] ; then
echo "Could not find eng.xml - please go to the directory containing the"
echo "translation files before executing this script."
exit 1
fi
sed -n -e "$idfilter" $reference_file | sort | uniq > $tmpfile
echo "lines starting with \"-\" mark missing strings, lines with \"+\" are superfluous"
for i in $checkfiles ; do
if [ ! -f "$i" ] ; then
echo "$i not found. Skipping"
continue
fi
echo "report of $i (- = missing, + = probably superfluous)"
sed -n -e "$idfilter" $i | sort | diff -U 0 $tmpfile - | sed -n -e '/^[-+][^-+]/p'
done