#!/bin/sh
# vim: expandtab sw=4 ts=4 sts=4:
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 gammu common -name '*.c' -o -name '*.h' | sort`

ver=`sed -n 's/set (VERSION "\([^"]*\)".*)/\1/p' CMakeLists.txt`
sed -i '
    s/SOME DESCRIPTIVE TITLE/Gammu translation/;
    s/PACKAGE/Gammu/;
    s/(C) YEAR/(C) 2003 - '`date +%Y`'/;
    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'/;
        s/Project-Id-Version: Gammu [0-9.]*/Project-Id-Version: Gammu '$ver'/;
        ' locale/$loc/gammu.po
    msgmerge --previous  -U locale/$loc/gammu.po locale/gammu.pot
done
