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
|
|
|
|
2018-02-28 01:19:40 -06:00
|
|
|
LANGHOME="Marlin/src/lcd/language"
|
|
|
|
|
|
|
|
[ -d $LANGHOME ] && cd $LANGHOME
|
2016-12-03 06:46:39 -06:00
|
|
|
|
2021-09-19 18:40:56 -05:00
|
|
|
FILES=$(ls language_*.h | grep -v -E "(_en|_test)\.h" | sed -E 's/language_([^\.]+)\.h/\1/' | tr '\n' ' ')
|
2016-12-03 06:46:39 -06:00
|
|
|
|
2016-12-06 22:48:26 -06:00
|
|
|
# Get files matching the given arguments
|
2021-09-19 18:40:56 -05:00
|
|
|
TEST_LANGS=""
|
2016-12-06 22:48:26 -06:00
|
|
|
if [[ -n $@ ]]; then
|
|
|
|
for K in "$@"; do
|
|
|
|
for F in $FILES; do
|
2021-09-19 18:40:56 -05:00
|
|
|
[[ "$F" != "${F%$K*}" ]] && TEST_LANGS+="$F "
|
2016-12-06 22:48:26 -06:00
|
|
|
done
|
|
|
|
done
|
2021-09-19 18:40:56 -05:00
|
|
|
[[ -z $TEST_LANGS ]] && { echo "No languages matching $@." ; exit 0 ; }
|
|
|
|
else
|
|
|
|
TEST_LANGS=$FILES
|
2016-12-06 22:48:26 -06:00
|
|
|
fi
|
|
|
|
|
2021-09-19 18:40:56 -05:00
|
|
|
echo "Missing strings for $TEST_LANGS..."
|
2016-12-03 06:46:39 -06:00
|
|
|
|
2021-09-19 18:40:56 -05:00
|
|
|
for WORD in $(awk '/LSTR/{print $2}' language_en.h); do
|
2021-09-19 19:25:01 -05:00
|
|
|
[[ $WORD == "MSG_MARLIN" ]] && break
|
2016-12-03 06:46:39 -06:00
|
|
|
LANG_LIST=""
|
2021-09-19 18:40:56 -05:00
|
|
|
for LANG in $TEST_LANGS; do
|
|
|
|
if [[ $(grep -c -E "^ *LSTR +$WORD\b" language_${LANG}.h) -eq 0 ]]; then
|
|
|
|
INHERIT=$(awk '/using namespace/{print $3}' language_${LANG}.h | sed -E 's/Language_([a-zA-Z_]+)\s*;/\1/')
|
|
|
|
if [[ -z $INHERIT || $INHERIT == "en" ]]; then
|
|
|
|
LANG_LIST+=" $LANG"
|
|
|
|
elif [[ $(grep -c -E "^ *LSTR +$WORD\b" language_${INHERIT}.h) -eq 0 ]]; then
|
|
|
|
LANG_LIST+=" $LANG"
|
|
|
|
fi
|
|
|
|
fi
|
2016-04-03 22:35:22 -05:00
|
|
|
done
|
2021-09-19 18:40:56 -05:00
|
|
|
[[ -n $LANG_LIST ]] && printf "%-38s :%s\n" "$WORD" "$LANG_LIST"
|
2016-04-03 22:35:22 -05:00
|
|
|
done
|