-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathlanguage_extract.sh
More file actions
executable file
·62 lines (53 loc) · 1.35 KB
/
Copy pathlanguage_extract.sh
File metadata and controls
executable file
·62 lines (53 loc) · 1.35 KB
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
#!/usr/bin/bash
MYIFS=$IFS
IFS="
"
STEP=0
if [[ "$1" != "" ]]; then
STEP=$1
fi
if [[ $STEP == "0" ]]; then
touch templates/php_language_extract.tpl
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}
((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 -c '\"')
if [[ "$ISBUGGY" == "0" ]]; then
ISIN=$(grep -c "$OUTLINE" templates/php_language_extract.tpl)
if [[ "$ISIN" == "0" ]]; then
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
rm templates/php_language_extract.tpl
STEP=4
fi
IFS=$MYIFS