diff options
author | emkael <emkael@tlen.pl> | 2016-06-10 11:59:21 +0200 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2016-06-10 11:59:21 +0200 |
commit | b4e7f5e1785b8a4892d76d1ed5d2e5490fe3fd71 (patch) | |
tree | 2d13fc0372f7c4841fe81865223e3f40d9150652 /bin/prado-locales-build | |
parent | 0833cdcf0ede77df42dd743c9775bd54a4f15193 (diff) |
* extracting all localizable strings and compiling gettext messages files
Diffstat (limited to 'bin/prado-locales-build')
-rwxr-xr-x | bin/prado-locales-build | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/bin/prado-locales-build b/bin/prado-locales-build new file mode 100755 index 0000000..10f8178 --- /dev/null +++ b/bin/prado-locales-build @@ -0,0 +1,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.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 -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 $POFILE $POTFILE -o $POFILE + msgfmt $POFILE -o $MOFILE + chown www-data:www-data $POFILE $MOFILE + chmod 777 $POFILE $MOFILE +done +find cache/prado -path \*/i18n/\* -delete +popd > /dev/null |