forked from hestiacp/hestiacp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhst_scan_i18n.sh
More file actions
executable file
·27 lines (24 loc) · 1.17 KB
/
Copy pathhst_scan_i18n.sh
File metadata and controls
executable file
·27 lines (24 loc) · 1.17 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
#!/bin/bash
if [ ! -e /usr/bin/xgettext ]; then
echo " **********************************************************"
echo " * Unable to find xgettext please install gettext package *"
echo " **********************************************************"
exit 3;
fi
delete=0
echo "[ * ] Remove old hestiacp.pot and generate new one"
rm hestiacp.pot
echo "" > hestiacp.pot
find ../.. \( -name '*.php' -o -name '*.html' -o -name '*.sh' \) | xgettext --output=hestiacp.pot --language=PHP --join-existing -f -
echo "[ * ] Scan language folders"
languages=$(ls -d $HESTIA/web/locale/*/ |awk -F'/' '{print $(NF-1)}');
echo "[ * ] Update hestiacp.pot with new files"
for lang in $languages; do
if [ -e "$HESTIA/web/locale/$lang/LC_MESSAGES/hestiacp.po" ]; then
echo "[ * ] Update $lang "
mv $HESTIA/web/locale/$lang/LC_MESSAGES/hestiacp.po $HESTIA/web/locale/$lang/LC_MESSAGES/hestiacp.po.bak
msgmerge --verbose "$HESTIA/web/locale/$lang/LC_MESSAGES/hestiacp.po.bak" "$HESTIA/web/locale/hestiacp.pot" > $HESTIA/web/locale/$lang/LC_MESSAGES/hestiacp.po
rm $HESTIA/web/locale/$lang/LC_MESSAGES/hestiacp.po.bak
fi
done
echo "[ ! ] Update complete"