-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathlanguage_extract.sh
executable file
·73 lines (62 loc) · 1.36 KB
/
language_extract.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/usr/bin/bash
MYIFS=$IFS
IFS="
"
STEP=0
if [ "$1" != "" ]
then
STEP=$1
fi
if [ $STEP == "0" ]
then
rm tmpout.txt 2>/dev/null
ALLPHP=$(find . -name '*.php' | grep -v vendor | grep -v smartyfolders)
for PHPFILE in $ALLPHP
do
echo $PHPFILE
xgettext --from-code=UTF-8 "$PHPFILE" -L PHP -o tmpX.txt --no-wrap
cat tmpX.txt >> tmpout.txt
done
rm tmpX.txt
STEP=1
fi
if [ $STEP == "1" ]
then
START=7
LINES=$(grep "msgid" tmpout.txt | sort -u)
for LINE in $LINES
do
# echo "$LINE"
LINELENGTH=${#LINE}
let LENGTH=$LINELENGTH-$START-1
EXTLINES=${LINE:$START:$LENGTH}
if [ "$EXTLINES" != "" ]
then
EXTLINE=$(echo "$EXTLINES" | sed 's/\\"/"/g')
OUTLINE='{t}'"$EXTLINE"'{/t}'
echo $OUTLINE
ISBUGGY=$(echo "$OUTLINE" | grep -F '\"' | wc -l)
if [ "$ISBUGGY" == "0" ]
then
ISIN=$(grep -F "$OUTLINE" templates/php_language_extract.tpl | wc -l)
if [ "$ISIN" == "0" ]
then
echo "NEW: $OUTLINE"
echo "$OUTLINE" >> templates/php_language_extract.tpl
fi
fi
fi
done
STEP=2
fi
if [ "$STEP" == "2" ]
then
vendor/smarty-gettext/smarty-gettext/tsmarty2c.php -o languages/sqstorage.pot templates/
STEP=3
fi
if [ "$STEP" == "3" ]
then
rm tmpout.txt 2>/dev/null
STEP=4
fi
IFS=$MYIFS