#!/bin/sh export PATH PATH=/bin:/usr/pkg/bin:/usr/bin:/usr/local/bin TEMPLATE=wordpress.pot cwd=`pwd` cd "$1" || exit 1 cp /dev/null "$cwd/$TEMPLATE" find . -name '*.php' -print \ | sed -e 's,^\./,,' \ | sort \ | xargs xgettext \ --keyword=__ \ --keyword=_e \ --default-domain=wordpress \ --language=php \ --output="$cwd/$TEMPLATE" \ --join-existing cd "$cwd" if [ -n "$2" ]; then if [ x$2 = 'x-p' ]; then msgfmt --statistics "$TEMPLATE" else if [ -f $2.po ]; then msgmerge -o ".tmp$2.po" "$2.po" "$TEMPLATE" \ && mv ".tmp$2.po" "$2.po" \ && msgfmt --statistics -o "$2.mo" "$2.po" else echo "Usage: $0 directoy [-p|locale]" fi fi fi