forked from wesnoth/wesnoth
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpo2po
executable file
·41 lines (33 loc) · 909 Bytes
/
po2po
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/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 --use-first -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
done
rm $tmp