My Marlin configs for Fabrikator Mini and CTC i3 Pro B
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

findMissingTranslations.sh 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #!/usr/bin/env bash
  2. #
  3. # findMissingTranslations.sh
  4. #
  5. # Locate all language strings needing an update based on English
  6. #
  7. # Usage: findMissingTranslations.sh [language codes]
  8. #
  9. # If no language codes are specified then all languages will be checked
  10. #
  11. LANGHOME="Marlin/src/lcd/language"
  12. [ -d $LANGHOME ] && cd $LANGHOME
  13. FILES=$(ls language_*.h | grep -v -E "(_en|_test)\.h" | sed -E 's/language_([^\.]+)\.h/\1/' | tr '\n' ' ')
  14. # Get files matching the given arguments
  15. TEST_LANGS=""
  16. if [[ -n $@ ]]; then
  17. for K in "$@"; do
  18. for F in $FILES; do
  19. [[ "$F" != "${F%$K*}" ]] && TEST_LANGS+="$F "
  20. done
  21. done
  22. [[ -z $TEST_LANGS ]] && { echo "No languages matching $@." ; exit 0 ; }
  23. else
  24. TEST_LANGS=$FILES
  25. fi
  26. echo "Missing strings for $TEST_LANGS..."
  27. for WORD in $(awk '/LSTR/{print $2}' language_en.h); do
  28. [[ $WORD == "MSG_MARLIN" ]] && break
  29. LANG_LIST=""
  30. for LANG in $TEST_LANGS; do
  31. if [[ $(grep -c -E "^ *LSTR +$WORD\b" language_${LANG}.h) -eq 0 ]]; then
  32. INHERIT=$(awk '/using namespace/{print $3}' language_${LANG}.h | sed -E 's/Language_([a-zA-Z_]+)\s*;/\1/')
  33. if [[ -z $INHERIT || $INHERIT == "en" ]]; then
  34. LANG_LIST+=" $LANG"
  35. elif [[ $(grep -c -E "^ *LSTR +$WORD\b" language_${INHERIT}.h) -eq 0 ]]; then
  36. LANG_LIST+=" $LANG"
  37. fi
  38. fi
  39. done
  40. [[ -n $LANG_LIST ]] && printf "%-38s :%s\n" "$WORD" "$LANG_LIST"
  41. done