Skip to content

Commit

Permalink
Prepare to use one config file for all languages
Browse files Browse the repository at this point in the history
  • Loading branch information
3d-gussner committed Jan 3, 2022
1 parent ecc8898 commit d59c081
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions lang/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit d59c081

Please sign in to comment.