Prepare to use one config file for all languages

This commit is contained in:
3d-gussner 2021-12-17 15:24:52 +01:00
parent ecc8898b58
commit d59c08192b

View File

@ -29,7 +29,30 @@ export INOELF="$OUTDIR/Firmware.ino.elf"
#
# Generated hex file:
export INOHEX="$OUTDIR/Firmware.ino.hex"
#
# Set default languages
if [ -z "$LANGUAGES" ]; then
export LANGUAGES="cz de es fr it pl"
fi
#
# Check for community languages
MAX_COMMINITY_LANG=10 # Total 16 - 6 default
COMMUNITY_LANGUAGES=""
#Search Firmware/config.h for active community group
COMMUNITY_LANG_GROUP=$(grep --max-count=1 "^#define COMMUNITY_LANG_GROUP" ../Firmware/config.h| cut -d ' ' -f3)
# Search Firmware/config.h for active community languanges
if [ "$COMMUNITY_LANG_GROUP" = "1" ]; then
COMMUNITY_LANGUAGES=$(grep --max-count=$MAX_COMMINITY_LANG "^#define COMMUNITY_LANG_GROUP1_" ../Firmware/config.h| cut -d '_' -f4 |cut -d ' ' -f1 |tr '[:upper:]' '[:lower:]'| tr '\n' ' ')
elif [ "$COMMUNITY_LANG_GROUP" = "2" ]; then
COMMUNITY_LANGUAGES=$(grep --max-count=$MAX_COMMINITY_LANG "^#define COMMUNITY_LANG_GROUP2_" ../Firmware/config.h| cut -d '_' -f4 |cut -d ' ' -f1 |tr '[:upper:]' '[:lower:]'| tr '\n' ' ')
elif [ "$COMMUNITY_LANG_GROUP" = "3" ]; then
COMMUNITY_LANGUAGES=$(grep --max-count=$MAX_COMMINITY_LANG "^#define COMMUNITY_LANG_GROUP3_" ../Firmware/config.h| cut -d '_' -f4 |cut -d ' ' -f1 |tr '[:upper:]' '[:lower:]'| tr '\n' ' ')
fi
echo "Community language $COMMUNITY_LANGUAGES"
if [ -z "$COMMUNITY_LANGUAGES" ]; then
export COMMUNITY_LANGUAGES="$COMMUNITY_LANGUAGES"
fi
echo "config.sh started" >&2
@ -59,6 +82,12 @@ if [ -e $INOELF ]; then echo 'OK' >&2; else echo 'NG!' >&2; _err=7; fi
echo -n " Generated hex file: " >&2
if [ -e $INOHEX ]; then echo 'OK' >&2; else echo 'NG!' >&2; _err=8; fi
echo -n " Languages: " >&2
echo "$LANGUAGES" >&2
echo -n " Community languages: " >&2
echo "$COMMUNITY_LANGUAGES" >&2
if [ $_err -eq 0 ]; then
echo "config.sh finished with success" >&2
export CONFIG_OK=1