summaryrefslogtreecommitdiff
path: root/tools/update-po
blob: 1e3643662aa6342960213420c08aca5e2181f8a1 (plain)
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
#!/bin/sh -e

if [ "$1" = "--check-only" ]; then
	for LANG in cs de es fi fr hu it nl ru; do
		echo "$LANG: untranslated=$(msgattrib --untranslated po/$LANG.po | grep ^msgid | wc -l) fuzzy=$(msgattrib --fuzzy po/$LANG.po | grep ^msgid | wc -l)"
	done
	exit 0
fi

export MY_EMAIL="Andreas Mair <amair.sob@googlemail.com>"
export VERSION="$(grep "^my \$VERSION = " vdradmind.pl | sed -e 's#.*\"\(.*\)\".*#\1#')"
export PACKAGE="VDRAdmin-AM"

pushd po/
../tools/tmplgettext "^.*\.html$" ../template >tmp-html-x.pot
msguniq --no-wrap tmp-html-x.pot >tmp-pl-x.pot

xgettext --from-code=ISO-8859-1 --no-location --no-wrap -L Perl ../vdradmind.pl --copyright-holder "$MY_EMAIL" --package-name="$PACKAGE" --package-version="$VERSION" --msgid-bugs-address="$MY_EMAIL" -j -o tmp-pl-x.pot

# Create vdradmin.pot
# (don't know how to include our own introduction comment smarter)
sed -n '0,/^#, fuzzy$/p' <tmp-html-x.pot >vdradmin.pot
sed -e '0,/^#, fuzzy$/d' <tmp-pl-x.pot >>vdradmin.pot

rm tmp-*.pot
popd


for LANG in cs de es fi fr hu it nl ru; do
		echo -n "$LANG: "
    if msgmerge --no-fuzzy-matching --no-wrap po/$LANG.po po/vdradmin.pot >temp.po ; then
        mv -f temp.po po/$LANG.po
				echo "    untranslated=$(msgattrib --untranslated po/$LANG.po | grep ^msgid | wc -l) fuzzy=$(msgattrib --fuzzy po/$LANG.po | grep ^msgid | wc -l)"
    else
        echo "error merging po/$LANG.po and po/vdradmin.pot"
    fi
done