Skip to content

Commit 96d6500

Browse files
committed
Created 1 time use php converter
+ RIght change Usage: ./hst_convert_php2po.sh de
1 parent 96ca0fc commit 96d6500

File tree

3 files changed

+45
-0
lines changed

3 files changed

+45
-0
lines changed

web/locale/hst_convert_php2po.sh

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/bin/bash
2+
if [ ! -e /usr/bin/xgettext ]; then
3+
echo " **********************************************************"
4+
echo " * Unable to find xgettext please install gettext package *"
5+
echo " **********************************************************"
6+
exit 3;
7+
fi
8+
9+
lang=${1}
10+
11+
if [ -z $lang ]; then
12+
echo "No Language defined"
13+
exit 3;
14+
fi
15+
16+
# Tempory delete the old file just for testing
17+
rm -f -r ./$lang
18+
19+
if [ ! -d ./$lang/LC_MESSAGES/ ]; then
20+
mkdir ./$lang/
21+
mkdir ./$lang/LC_MESSAGES/
22+
23+
msginit -i ./hestiacp.pot --locale=$lang --no-translator
24+
mv ./$lang.po ./$lang/LC_MESSAGES/hestiacp.po;
25+
fi
26+
27+
if [ -e ../inc/i18n/$lang.php ]; then
28+
while read f
29+
do
30+
b=$(echo "$f" |cut -f 2 -d \');
31+
c=$(echo "$f" |cut -f 4 -d \');
32+
if [ ! -z "$c" ]; then
33+
c=$(echo $c | sed -e 's/\"/\\\"/g');
34+
#c=$(echo $c | sed -e 's/\\/\\\\/g');
35+
echo "$b -> $c"
36+
# locate b in msgid and replace the next line
37+
#echo "msgid \"$b\"";
38+
sed -i "/msgid \"$b\"/{n;s/msgstr \".*\"/msgstr \"$c\"/}" ./$lang/LC_MESSAGES/hestiacp.po
39+
40+
41+
# rm ./$lang/LC_MESSAGES/hestiacp.po
42+
# mv ./$lang/LC_MESSAGES/hestiacp.po.bak ./$lang/LC_MESSAGES/hestiacp.po
43+
fi
44+
done < ../inc/i18n/$lang.php
45+
fi

web/locale/hst_convert_po2mo.sh

100644100755
File mode changed.

web/locale/hst_scan_i18n.sh

100644100755
File mode changed.

0 commit comments

Comments
 (0)