#!/bin/sh
LOCS=`ls locale/*/gammu.po | sed 's@.*/\(.*\)/[^/]*@\1@'`
xgettext \
    -d gammu \
    --msgid-bugs-address=michal@cihar.com \
    -o locale/gammu.pot \
    --language=C \
    --keyword=_ \
    --keyword=N_ \
    --add-comments=l10n \
    --add-location \
    --copyright-holder="Michal Čihař" \
    `find . -name '*.c'`

ver=`cat VERSION | tr , .`
sed -i '
    s/SOME DESCRIPTIVE TITLE/Gammu translation/;
    s/PACKAGE/Gammu/;
    s/(C) YEAR/(C) 2003 - 2007/;
    s/VERSION/'$ver'/;
    ' locale/gammu.pot

for loc in $LOCS ; do
	sed -i '
		s/SOME DESCRIPTIVE TITLE/Gammu translation/;
		s/PACKAGE/Gammu/;
		s/VERSION/'$ver'/;
		' locale/$loc/gammu.po
    msgmerge -U locale/$loc/gammu.po locale/gammu.pot
done
