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