wesnoth/utils/po2po

45 lines
991 B
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 [ $# = 0 ]
then
set -- `cat po/LINGUAS`
fi
tmp=`tempfile`
for LANG in "$@"
do
# merge the 2 files
msgcat -F po/$LANG/$DSTDOMAIN.po po/$LANG/$SRCDOMAIN.po >$tmp
mv po/$LANG/$DSTDOMAIN.po po/$LANG/$DSTDOMAIN.po.bak
mv $tmp po/$LANG/$DSTDOMAIN.po
# sync with DST pot
touch -d '1970-01-02' po/$LANG/$DSTDOMAIN.po
make -C po $LANG/$DSTDOMAIN.po
# clear those obsolete strings added by SRC, but keep ours if any
msgattrib --no-obsolete po/$LANG/$DSTDOMAIN.po >$tmp
msgcat --use-first -F $tmp po/$LANG/$DSTDOMAIN.po.bak > po/$LANG/$DSTDOMAIN.po
touch -d '1970-01-02' po/$LANG/$DSTDOMAIN.po
make -C po $LANG/$DSTDOMAIN.po
# make sure the timestamp is fixed or cvs gets confused
touch po/$LANG/$DSTDOMAIN.po
done
rm $tmp