blob: 10ffc0c888f558310187a12504739f80ad8ff034 (
plain)
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
|
#!/bin/bash
pushd $(realpath $(dirname $0)/..) > /dev/null
mkdir -p cache/gettext
OUTPUT=$(realpath cache/gettext)
find app/frontend -name \*.page -o -name \*.tpl | while read FILE; do
tpl2c.py $FILE $OUTPUT
done
POTFILE=app/frontend/i18n/messages/messages.pot
touch $POTFILE
sed -i '/^#\. /d' $POTFILE
find cache/gettext -type f -exec xgettext {} -L C --sort-by-file --add-comments --from-code=utf-8 --foreign-user -j -o $POTFILE \;
sed -i 's/charset=CHARSET/charset=UTF-8/' $POTFILE
find app/frontend \( -name \*.php -o -name \*.tpl -o -name \*.page \) -exec xgettext {} --keyword=localize:1 -L PHP --sort-by-file --add-comments --from-code=utf-8 --foreign-user -j -o $POTFILE \;
sed -i 's/charset=CHARSET/charset=UTF-8/' $POTFILE
find app/frontend/i18n/messages -mindepth 1 -type d | while read LANGDIR; do
LANG_CODE=$(basename $LANGDIR)
POFILE=$LANGDIR/messages.po
MOFILE=${POFILE%.*}.mo
if [ ! -f $MOFILE ]; then
msginit -i $POTFILE -l $LANG_CODE -o $POFILE
fi
msgmerge -N $POFILE $POTFILE -o $POFILE
msgfmt $POFILE -o $MOFILE --statistics --verbose
chown www-data:www-data $POFILE $MOFILE
chmod 777 $POFILE $MOFILE
done
find cache/prado -path \*/i18n/\* -delete
popd > /dev/null
|