You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.1 KiB
Bash
50 lines
1.1 KiB
Bash
8 years ago
|
#!/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
|
||
|
#
|
||
9 years ago
|
|
||
7 years ago
|
LANGHOME="Marlin/src/lcd/language"
|
||
|
|
||
|
[ -d $LANGHOME ] && cd $LANGHOME
|
||
8 years ago
|
|
||
8 years ago
|
FILES=$(ls language_*.h | grep -v -E "(_en|_test)\.h" | sed -E 's/language_([^\.]+)\.h/\1/')
|
||
8 years ago
|
declare -A STRING_MAP
|
||
|
|
||
8 years ago
|
# 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
|
||
|
|
||
8 years ago
|
echo -n "Building list of missing strings..."
|
||
|
|
||
5 years ago
|
for i in $(awk '/Language_Str/{print $3}' language_en.h); do
|
||
|
[[ $i == "MSG_CUBED" ]] && continue
|
||
8 years ago
|
LANG_LIST=""
|
||
8 years ago
|
for j in $TEST_LANGS; do
|
||
|
[[ $(grep -c " ${i} " language_${j}.h) -eq 0 ]] && LANG_LIST="$LANG_LIST $j"
|
||
9 years ago
|
done
|
||
8 years ago
|
[[ -z $LANG_LIST ]] && continue
|
||
8 years ago
|
STRING_MAP[$i]=$LANG_LIST
|
||
8 years ago
|
done
|
||
|
|
||
|
echo
|
||
|
|
||
|
for K in $( printf "%s\n" "${!STRING_MAP[@]}" | sort ); do
|
||
7 years ago
|
case "$#" in
|
||
|
1 ) echo $K ;;
|
||
|
* ) printf "%-35s :%s\n" "$K" "${STRING_MAP[$K]}" ;;
|
||
|
esac
|
||
9 years ago
|
done
|