wesnoth/utils/po2po
2005-02-22 20:17:39 +00:00

51 lines
1.1 KiB
Bash
Executable File

#!/bin/sh
set -e
# copy relevant messages from SRCDOMAIN to DSTDOMAIN, for LANG
if [ $# -lt 2 ]
then
echo "Usage: $0 src-domain dst-domain [lang ...]"
exit 1
fi
SRCDOMAIN=$1
DSTDOMAIN=$2
shift
shift
if ! [ -r po/$DSTDOMAIN/Makefile ]
then
echo "Source not configured in po/$DSTDOMAIN"
exit 1
fi
if [ $# = 0 ]
then
set -- `cat po/$SRCDOMAIN/LINGUAS`
fi
tmp=`tempfile`
for LANG in "$@"
do
# merge the 2 files
msgcat --use-first -F po/$DSTDOMAIN/$LANG.po po/$SRCDOMAIN/$LANG.po >$tmp
mv po/$DSTDOMAIN/$LANG.po po/$DSTDOMAIN/$LANG.po.bak
mv $tmp po/$DSTDOMAIN/$LANG.po
# sync with DST pot
touch -d '1970-01-02' po/$DSTDOMAIN/$LANG.po
make -C po/$DSTDOMAIN $LANG.po
# clear those obsolete strings added by SRC, but keep ours if any
msgattrib --no-obsolete po/$DSTDOMAIN/$LANG.po >$tmp
msgcat --use-first -F $tmp po/$DSTDOMAIN/$LANG.po.bak > po/$DSTDOMAIN/$LANG.po
touch -d '1970-01-02' po/$DSTDOMAIN/$LANG.po
make -C po/$DSTDOMAIN $LANG.po
# make sure the timestamp is fixed or cvs gets confused
touch po/$DSTDOMAIN/$LANG.po
done
rm $tmp