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