File tree Expand file tree Collapse file tree 3 files changed +45
-0
lines changed
Expand file tree Collapse file tree 3 files changed +45
-0
lines changed Original file line number Diff line number Diff line change 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
You can’t perform that action at this time.
0 commit comments