|
Revision 50, 1.4 kB
(checked in by yann, 5 years ago)
|
Prepare for release 0.1
|
| Line | |
|---|
| 1 |
#!/bin/sh |
|---|
| 2 |
# Created by Ryan Boren |
|---|
| 3 |
# Later code and patches from |
|---|
| 4 |
# Kimmo Suominen (more) and Nikolay Bachiyski (less) |
|---|
| 5 |
# Adaptation for iMinR for WordPress plugin by Yann Lugrin |
|---|
| 6 |
|
|---|
| 7 |
TEMPLATE=wp_iminr.pot |
|---|
| 8 |
cwd=`pwd` |
|---|
| 9 |
cd "$1" || exit 1 |
|---|
| 10 |
|
|---|
| 11 |
cp /dev/null "$cwd/$TEMPLATE" |
|---|
| 12 |
|
|---|
| 13 |
find . -name '*.php' -print \ |
|---|
| 14 |
| sed -e 's,^\./,,' \ |
|---|
| 15 |
| sort \ |
|---|
| 16 |
| xargs xgettext \ |
|---|
| 17 |
--keyword=__ \ |
|---|
| 18 |
--keyword=_e \ |
|---|
| 19 |
--default-domain=wp_iminr \ |
|---|
| 20 |
--language=php \ |
|---|
| 21 |
--output="$cwd/$TEMPLATE" \ |
|---|
| 22 |
--join-existing \ |
|---|
| 23 |
--from-code utf-8 \ |
|---|
| 24 |
--copyright-holder="Yann Lugrin" \ |
|---|
| 25 |
--msgid-bugs-address=yann.lugrin@sans-savoir.net |
|---|
| 26 |
|
|---|
| 27 |
cd "$cwd" |
|---|
| 28 |
|
|---|
| 29 |
if [ -n "$2" ]; then |
|---|
| 30 |
if [ x$2 = 'x-p' ]; then |
|---|
| 31 |
msgfmt --statistics "$TEMPLATE" |
|---|
| 32 |
else |
|---|
| 33 |
if [ -f $2.po ]; then |
|---|
| 34 |
msgmerge -o ".tmp$2.po" "$2.po" "$TEMPLATE" \ |
|---|
| 35 |
&& mv ".tmp$2.po" "$2.po" \ |
|---|
| 36 |
&& msgfmt --statistics -o "$2.mo" "$2.po" |
|---|
| 37 |
else |
|---|
| 38 |
echo "Usage: $0 directoy [-p|locale]" |
|---|
| 39 |
fi |
|---|
| 40 |
fi |
|---|
| 41 |
fi |
|---|
| 42 |
|
|---|
| 43 |
sed -i -e '1s/^# SOME DESCRIPTIVE TITLE/# iMinR for WordPress POT file/' "$TEMPLATE" |
|---|
| 44 |
# sub only the YEAR in the copyright message (the 2nd line) |
|---|
| 45 |
sed -i -e '2s/YEAR/'`date +%Y`'/' "$TEMPLATE" |
|---|
| 46 |
sed -i -e 's/\(^#.*\)PACKAGE\(.*\)/\1iMinR\2/g' "$TEMPLATE" |
|---|
| 47 |
|
|---|
| 48 |
# and the cherry of the pie - extract version using magic - versoextracanus!~ |
|---|
| 49 |
VERSION=`fgrep 'Version' $1/wp_iminr.php | cut -d : -f 2` |
|---|
| 50 |
sed -i -e "s/\(Project-Id-Version: \)PACKAGE VERSION/\1iMinR for WordPress $VERSION/" "$TEMPLATE" |
|---|