2020-11-05 14:04:17 +00:00
|
|
|
#!/bin/bash
|
2021-05-13 10:13:26 +00:00
|
|
|
#
|
|
|
|
# Script to create langindex from available language packs.
|
|
|
|
# ./create_langindex.sh [findbetter]
|
|
|
|
# If findbetter is set it will try to find a better solution for every key.
|
|
|
|
#
|
|
|
|
|
2020-11-05 14:04:17 +00:00
|
|
|
|
2023-05-18 11:59:02 +00:00
|
|
|
DIR="${BASH_SOURCE%/*}"
|
|
|
|
if [[ ! -d "$DIR" ]]; then DIR="$PWD"; fi
|
2020-11-05 14:04:17 +00:00
|
|
|
|
2023-05-18 11:59:02 +00:00
|
|
|
cd $DIR
|
2020-11-05 14:04:17 +00:00
|
|
|
|
2023-05-18 11:59:02 +00:00
|
|
|
source "functions.sh"
|
|
|
|
source "lang_functions.sh"
|
|
|
|
source "create_langindex_functions.sh"
|
2021-05-13 10:13:26 +00:00
|
|
|
|
2020-11-05 14:04:17 +00:00
|
|
|
print_title 'Generating language from code...'
|
2021-05-13 10:55:30 +00:00
|
|
|
npx gulp lang
|
2020-11-05 14:04:17 +00:00
|
|
|
|
2023-05-18 11:59:02 +00:00
|
|
|
get_english
|
2020-11-05 14:04:17 +00:00
|
|
|
|
|
|
|
print_title 'Processing file'
|
|
|
|
#Create langindex.json if not exists.
|
|
|
|
if [ ! -f 'langindex.json' ]; then
|
|
|
|
echo "{}" > langindex.json
|
|
|
|
fi
|
|
|
|
|
|
|
|
findbetter=$1
|
2023-05-18 11:59:02 +00:00
|
|
|
parse_file $findbetter
|
2020-11-05 14:04:17 +00:00
|
|
|
|
|
|
|
echo
|
|
|
|
|
|
|
|
jq -S --indent 2 -s '.[0]' langindex.json > langindex_new.json
|
|
|
|
mv langindex_new.json langindex.json
|
|
|
|
rm langindex_old.json
|
|
|
|
|
2020-12-14 14:35:18 +00:00
|
|
|
print_ok 'All done!'
|