2016-12-03 13:46:39 +01: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-04 05:35:22 +02:00
|
|
|
|
2018-02-28 08:19:40 +01:00
|
|
|
LANGHOME="Marlin/src/lcd/language"
|
|
|
|
|
|
|
|
[ -d $LANGHOME ] && cd $LANGHOME
|
2016-12-03 13:46:39 +01:00
|
|
|
|
2016-12-07 05:48:26 +01:00
|
|
|
FILES=$(ls language_*.h | grep -v -E "(_en|_test)\.h" | sed -E 's/language_([^\.]+)\.h/\1/')
|
2016-12-03 13:46:39 +01:00
|
|
|
declare -A STRING_MAP
|
|
|
|
|
2016-12-07 05:48:26 +01: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 13:46:39 +01:00
|
|
|
echo -n "Building list of missing strings..."
|
|
|
|
|
2016-12-07 05:48:26 +01:00
|
|
|
for i in $(awk '/#ifndef/{print $2}' language_en.h); do
|
2018-02-15 20:23:02 +01:00
|
|
|
[[ $i == "LANGUAGE_EN_H" || $i == "CHARSIZE" ]] && continue
|
2016-12-03 13:46:39 +01:00
|
|
|
LANG_LIST=""
|
2016-12-07 05:48:26 +01:00
|
|
|
for j in $TEST_LANGS; do
|
|
|
|
[[ $(grep -c " ${i} " language_${j}.h) -eq 0 ]] && LANG_LIST="$LANG_LIST $j"
|
2016-04-04 05:35:22 +02:00
|
|
|
done
|
2016-12-03 13:46:39 +01:00
|
|
|
[[ -z $LANG_LIST ]] && continue
|
2016-12-07 05:48:26 +01:00
|
|
|
STRING_MAP[$i]=$LANG_LIST
|
2016-12-03 13:46:39 +01:00
|
|
|
done
|
|
|
|
|
|
|
|
echo
|
|
|
|
|
|
|
|
for K in $( printf "%s\n" "${!STRING_MAP[@]}" | sort ); do
|
2018-02-28 08:19:40 +01:00
|
|
|
case "$#" in
|
|
|
|
1 ) echo $K ;;
|
|
|
|
* ) printf "%-35s :%s\n" "$K" "${STRING_MAP[$K]}" ;;
|
|
|
|
esac
|
2016-04-04 05:35:22 +02:00
|
|
|
done
|