#!/bin/bash
#
# Copyright 2005 Zuza Software Foundation
#
# This file is part of The Translate Toolkit.
#
# The Translate Toolkit is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# translate is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with translate; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA


# poen - initialises a directory English PO files by taking POT files and
# copying the msgid to the msgstr.

ext="pot"

case $1 in
	--no-wrap)	nowrap="--no-wrap"
			shift
			;;
	--po)		ext="po"
			shift
			;;
esac

if [ $# -ne 2 ]; then
	echo "Usage: poen [--no-wrap] [--po] pot-dir en-dir"
	exit 1
fi

potdir=$1
endir=$2

for pot in `cd $potdir; find . -name "*.$ext"`
do
	mkdir -p $endir/$(dirname $pot)
	msgen $nowrap $potdir/$pot -o $endir/$(dirname $pot)/$(basename $pot .$ext).po
done
