2018-04-10 17:29:06 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2018-06-08 16:42:53 +02:00
|
|
|
# strings to ignore
|
|
|
|
ignore=("languageCode" "languageName")
|
|
|
|
|
2018-04-10 17:29:06 +02:00
|
|
|
while read line; do
|
|
|
|
|
|
|
|
# start of a new section?
|
|
|
|
if echo "${line}" | grep -Eq "^[\s]*\[.+?\]"; then
|
|
|
|
section=`echo "${line}" | grep -Eo "\[.+?\]" | sed -E "s|\[\|\]||g"`
|
2018-06-08 16:42:53 +02:00
|
|
|
section=`echo $section | sed -E -e "s|Languages\...\.||" -e "s|\.|_|g"`
|
2018-04-10 17:29:06 +02:00
|
|
|
if [[ "$newline" -eq "y" ]]; then
|
|
|
|
newline=n
|
|
|
|
else
|
|
|
|
echo
|
|
|
|
fi
|
|
|
|
elif echo "${line}" | grep -Eiq "^[\s]*[[:alnum:]]+?\s*="; then
|
|
|
|
key=`echo "${line}" | grep -Eio "^[\s]*[[:alnum:]]+?\s*=" | sed -E -e "s|\s||g" -e "s|=||"`
|
2018-06-08 16:42:53 +02:00
|
|
|
key=`echo "${section}_${key}" | sed -E "s|^Languages_.._||"`
|
2018-04-10 17:29:06 +02:00
|
|
|
value=`echo "${line}" | sed -E "s|.*=\s*?(\".*\")|\1|"`
|
|
|
|
|
2018-06-08 16:42:53 +02:00
|
|
|
if [[ ! " ${ignore[@]} " =~ " ${key} " ]]; then # if key contains string
|
|
|
|
echo "[$key]"
|
|
|
|
echo "other= $value"
|
|
|
|
fi
|
|
|
|
|
2018-04-10 17:29:06 +02:00
|
|
|
elif echo "${line}" | grep -Eq "^\s*#"; then
|
|
|
|
echo
|
|
|
|
echo "$line"
|
|
|
|
newline=y
|
|
|
|
fi
|
|
|
|
|
|
|
|
done < strings.en.toml
|