@@ -6,37 +6,32 @@ if [ ! -e /usr/bin/xgettext ]; then
66 exit 3
77fi
88
9- delete=0
10-
11- echo " [ * ] Remove old hestiacp.pot and generate new one"
12- rm hestiacp.pot
9+ echo " [ * ] Move hestiacp.pot to Move hestiacp.pot.old"
10+ mv hestiacp.pot hestiacp.pot.old
1311echo " " > hestiacp.pot
12+
13+ echo " [ * ] Search *.php *.html and *.sh for php based gettext functions"
1414find ../.. \( -name ' *.php' -o -name ' *.html' -o -name ' *.sh' \) | xgettext --output=hestiacp.pot --language=PHP --join-existing -f -
1515OLDIFS=$IFS
1616IFS=$' \n '
1717# Scan the description string for list updates page
18- for string in $( awk -F' DESCR=' ' /data=".+ DESCR=[^"]/ {print $2}' $HESTIA /bin/v-list-sys-hestia-updates | cut -d\' -f2) ; do
18+ for string in $( awk -F' DESCR=' ' /data=".+ DESCR=[^"]/ {print $2}' ../.. /bin/v-list-sys-hestia-updates | cut -d\' -f2) ; do
1919 if [ -z " $( grep " \" $string \" " hestiacp.pot) " ]; then
20- echo -e " \n#: ../../bin/v-list-sys-hestia-updates:" $( grep -n " $string " $HESTIA /bin/v-list-sys-hestia-updates | cut -d: -f1) " \nmsgid \" $string \" \nmsgstr \"\" " >> hestiacp.pot
20+ echo -e " \n#: ../../bin/v-list-sys-hestia-updates:" $( grep -n " $string " ../.. /bin/v-list-sys-hestia-updates | cut -d: -f1) " \nmsgid \" $string \" \nmsgstr \"\" " >> hestiacp.pot
2121 fi
2222done
2323# Scan the description string for list server page
24- for string in $( awk -F' SYSTEM=' ' /data=".+ SYSTEM=[^"]/ {print $2}' $HESTIA /bin/v-list-sys-services | cut -d\' -f2) ; do
24+ for string in $( awk -F' SYSTEM=' ' /data=".+ SYSTEM=[^"]/ {print $2}' ../.. /bin/v-list-sys-services | cut -d\' -f2) ; do
2525 if [ -z " $( grep " \" $string \" " hestiacp.pot) " ]; then
26- echo -e " \n#: ../../bin/v-list-sys-services:" $( grep -n " $string " $HESTIA /bin/v-list-sys-services | cut -d: -f1) " \nmsgid \" $string \" \nmsgstr \"\" " >> hestiacp.pot
26+ echo -e " \n#: ../../bin/v-list-sys-services:" $( grep -n " $string " ../.. /bin/v-list-sys-services | cut -d: -f1) " \nmsgid \" $string \" \nmsgstr \"\" " >> hestiacp.pot
2727 fi
2828done
2929IFS=$OLDIFS
3030
31- echo " [ * ] Scan language folders"
32- languages=$( ls -d $HESTIA /web/locale/* / | awk -F' /' ' {print $(NF-1)}' )
33- echo " [ * ] Update hestiacp.pot with new files"
34- for lang in $languages ; do
35- if [ -e " $HESTIA /web/locale/$lang /LC_MESSAGES/hestiacp.po" ]; then
36- echo " [ * ] Update $lang "
37- mv $HESTIA /web/locale/$lang /LC_MESSAGES/hestiacp.po $HESTIA /web/locale/$lang /LC_MESSAGES/hestiacp.po.bak
38- msgmerge --verbose " $HESTIA /web/locale/$lang /LC_MESSAGES/hestiacp.po.bak" " $HESTIA /web/locale/hestiacp.pot" > $HESTIA /web/locale/$lang /LC_MESSAGES/hestiacp.po
39- rm $HESTIA /web/locale/$lang /LC_MESSAGES/hestiacp.po.bak
40- fi
41- done
42- echo " [ ! ] Update complete"
31+ # Prevent only date change become a commit
32+ if [ $( diff hestiacp.pot hestiacp.pot.old | wc -l) != 2 ]; then
33+ rm hestiacp.pot
34+ mv hestiacp.pot.old hestiacp.pot
35+ else
36+ rm hestiacp.pot.old
37+ fi
0 commit comments