diff options
author | Georgiy Bondarenko <69736697+nehilo@users.noreply.github.com> | 2021-03-04 20:54:23 +0300 |
---|---|---|
committer | Georgiy Bondarenko <69736697+nehilo@users.noreply.github.com> | 2021-03-04 20:54:23 +0300 |
commit | e8701195e66f2d27ffe17fb514eae8173795aaf7 (patch) | |
tree | 9f519c4abf6556b9ae7190a6210d87ead1dfadde /buildroot/share/scripts/findMissingTranslations.sh | |
download | kp3s-lgvl-e8701195e66f2d27ffe17fb514eae8173795aaf7.tar.xz kp3s-lgvl-e8701195e66f2d27ffe17fb514eae8173795aaf7.zip |
Initial commit
Diffstat (limited to 'buildroot/share/scripts/findMissingTranslations.sh')
-rw-r--r-- | buildroot/share/scripts/findMissingTranslations.sh | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/buildroot/share/scripts/findMissingTranslations.sh b/buildroot/share/scripts/findMissingTranslations.sh new file mode 100644 index 0000000..0cf7736 --- /dev/null +++ b/buildroot/share/scripts/findMissingTranslations.sh @@ -0,0 +1,49 @@ +#!/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 +# + +LANGHOME="Marlin/src/lcd/language" + +[ -d $LANGHOME ] && cd $LANGHOME + +FILES=$(ls language_*.h | grep -v -E "(_en|_test)\.h" | sed -E 's/language_([^\.]+)\.h/\1/') +declare -A STRING_MAP + +# 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 + +echo -n "Building list of missing strings..." + +for i in $(awk '/Language_Str/{print $3}' language_en.h); do + [[ $i == "MSG_CUBED" ]] && continue + LANG_LIST="" + for j in $TEST_LANGS; do + [[ $(grep -c " ${i} " language_${j}.h) -eq 0 ]] && LANG_LIST="$LANG_LIST $j" + done + [[ -z $LANG_LIST ]] && continue + STRING_MAP[$i]=$LANG_LIST +done + +echo + +for K in $( printf "%s\n" "${!STRING_MAP[@]}" | sort ); do + case "$#" in + 1 ) echo $K ;; + * ) printf "%-35s :%s\n" "$K" "${STRING_MAP[$K]}" ;; + esac +done |