first attempt to automatically convert language strings to i18n pendants

lektura
max.mehl 2018-04-10 17:29:06 +02:00
parent fa1e90e4d9
commit 547b08bfef
No known key found for this signature in database
GPG Key ID: 2704E4AB371E2E92
1 changed files with 27 additions and 0 deletions

View File

@ -0,0 +1,27 @@
#!/bin/bash
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"`
section=`echo $section | sed -E "s|Languages\...\.||"`
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|=||"`
key="$section.$key"
value=`echo "${line}" | sed -E "s|.*=\s*?(\".*\")|\1|"`
echo "[$key]"
echo "other= $value"
elif echo "${line}" | grep -Eq "^\s*#"; then
echo
echo "$line"
newline=y
fi
done < strings.en.toml