1
0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2024-12-11 13:04:35 +00:00
MarlinFirmware/buildroot/share/scripts/findMissingTranslations.sh

48 lines
1.1 KiB
Bash
Raw Normal View History

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