2018-06-12 11:05:44 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
#
|
|
|
|
|
2018-06-17 19:25:57 +00:00
|
|
|
LNG=$1
|
|
|
|
if [ -z "$LNG" ]; then exit -1; fi
|
2018-06-12 11:05:44 +00:00
|
|
|
|
|
|
|
#convert '\\e' sequencies to 'x1b' and '\\' to '\'
|
2018-06-17 19:25:57 +00:00
|
|
|
cat $LNG.po | sed 's/\\\\e/\\x1b/g;s/\\\\/\\/g' > $LNG'_filtered.po'
|
2018-06-12 11:05:44 +00:00
|
|
|
|
|
|
|
#join lines with multi-line string constants
|
2018-06-17 19:25:57 +00:00
|
|
|
cat $LNG'_filtered.po' | sed ':a;N;$!ba;s/\x22\n\x22//g' > $LNG'_new.po'
|
2018-06-12 11:05:44 +00:00
|
|
|
|
|
|
|
#generate dictionary
|
|
|
|
cat ../lang_en.txt | sed 's/\\/\\\\/g' | while read -r s; do
|
|
|
|
/bin/echo -e "$s"
|
|
|
|
if [ "${s:0:1}" = "\"" ]; then
|
|
|
|
# /bin/echo -e "$s"
|
|
|
|
s=$(/bin/echo -e "$s")
|
2018-06-17 19:25:57 +00:00
|
|
|
s2=$(grep -F -A1 -B0 "$s" "$LNG"_new.po | tail -n1 | sed 's/^msgstr //')
|
2018-06-12 11:05:44 +00:00
|
|
|
if [ -z "$s2" ]; then
|
|
|
|
echo '"\x00"'
|
|
|
|
else
|
|
|
|
echo "$s2"
|
|
|
|
fi
|
|
|
|
# echo
|
|
|
|
fi
|
2018-06-17 19:25:57 +00:00
|
|
|
done > lang_en_$LNG.txt
|