From d59c08192bb47961a9d249a09f716f447921073e Mon Sep 17 00:00:00 2001 From: 3d-gussner <3d.gussner@gmail.com> Date: Fri, 17 Dec 2021 15:24:52 +0100 Subject: [PATCH] Prepare to use one config file for all languages --- lang/config.sh | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/lang/config.sh b/lang/config.sh index 2f433c3a..e021e142 100755 --- a/lang/config.sh +++ b/lang/config.sh @@ -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