#!/bin/sh

# Obtain messages from the Python files.

  find imiptools imipweb -type f -name '*.py' \
| xargs xgettext -d imip-agent --sort-by-file \
                 --copyright-holder="Paul Boddie <paul@boddie.org.uk>" \
                 --package-name="imip-agent" --package-version=`hg id | cut -d ' ' -f 1`

# Set the default charset.

  sed "s/CHARSET/iso-8859-1/" imip-agent.po \
> imip-agent.pot

# Remove the original file.

rm imip-agent.po

# Merge messages with the existing translations.

for FILENAME in messages/*.po ; do
    msgmerge --update "$FILENAME" imip-agent.pot
done
