2016-12-03 06:46:39 -06:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
#
|
|
|
|
# findMissingTranslations.sh
|
|
|
|
#
|
|
|
|
# Locate all language strings needing an update based on English
|
|
|
|
#
|
|
|
|
# Usage: findMissingTranslations.sh [language codes]
|
|
|
|
#
|
|
|
|
# If no language codes are specified then all languages will be checked
|
|
|
|
#
|
2016-04-03 22:35:22 -05:00
|
|
|
|
2016-12-03 06:46:39 -06:00
|
|
|
[ -d "Marlin" ] && cd "Marlin"
|
|
|
|
|
2016-12-06 22:48:26 -06:00
|
|
|
FILES=$(ls language_*.h | grep -v -E "(_en|_test)\.h" | sed -E 's/language_([^\.]+)\.h/\1/')
|
2016-12-03 06:46:39 -06:00
|
|
|
declare -A STRING_MAP
|
|
|
|
|
2016-12-06 22:48:26 -06:00
|
|
|
# Get files matching the given arguments
|
|
|
|
TEST_LANGS=$FILES
|
|
|
|
if [[ -n $@ ]]; then
|
|
|
|
TEST_LANGS=""
|
|
|
|
for K in "$@"; do
|
|
|
|
for F in $FILES; do
|
|
|
|
[[ "$F" != "${F%$K*}" ]] && TEST_LANGS="$TEST_LANGS $F"
|
|
|
|
done
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
2016-12-03 06:46:39 -06:00
|
|
|
echo -n "Building list of missing strings..."
|
|
|
|
|
2016-12-06 22:48:26 -06:00
|
|
|
for i in $(awk '/#ifndef/{print $2}' language_en.h); do
|
2018-02-15 13:23:02 -06:00
|
|
|
[[ $i == "LANGUAGE_EN_H" || $i == "CHARSIZE" ]] && continue
|
2016-12-03 06:46:39 -06:00
|
|
|
LANG_LIST=""
|
2016-12-06 22:48:26 -06:00
|
|
|
for j in $TEST_LANGS; do
|
|
|
|
[[ $(grep -c " ${i} " language_${j}.h) -eq 0 ]] && LANG_LIST="$LANG_LIST $j"
|
2016-04-03 22:35:22 -05:00
|
|
|
done
|
2016-12-03 06:46:39 -06:00
|
|
|
[[ -z $LANG_LIST ]] && continue
|
2016-12-06 22:48:26 -06:00
|
|
|
STRING_MAP[$i]=$LANG_LIST
|
2016-12-03 06:46:39 -06:00
|
|
|
done
|
|
|
|
|
|
|
|
echo
|
|
|
|
|
|
|
|
for K in $( printf "%s\n" "${!STRING_MAP[@]}" | sort ); do
|
|
|
|
printf "%-35s :%s\n" "$K" "${STRING_MAP[$K]}"
|
2016-04-03 22:35:22 -05:00
|
|
|
done
|