Re: CVS: about.wml.po
Quoting Mohammed Adnène Trojette (adn@diwi.org):
> On Tue, Apr 05, 2005, Ossama Khayat wrote:
> > Adnene, please always make sure the .po files committed are correct by doing:
> > msgfmt -c --statistics file.po
>
> I was looking for such a tool. Thanks you for pointing it out.
> Sorry for that, I'll correct this.
My wacky po_test script (not only checks a file but also resyncs it
agains an existing POT file). Parts where stolen from another
contribution by Denis Barbier.
#!/bin/sh
temp=`tempfile`
trap "rm -f $temp $temp.new" 1 2 3 15
clean_and_die() {
rm -f $temp $temp.new
if [ "$1" = "2" ] ; then
echo Invalid encoding. Please check the file.
fi
exit $1
}
if [ -z $1 ]
then
echo Usage $0 fichier
clean_and_die 1
fi
if [ ! -f $1 ]
then
echo $1 not found.
clean_and_die 1
fi
if [ `ls -1 *pot 2>/dev/null | wc -l` != "1" ] ; then
echo No POT file \(or more than one\) in current directory
potfile=`ls -1 *pot`
msgmerge -U $1 $potfile
fi
enc=$(grep -E "^\"Content-Type" $1 | cut -f2 -d= | sed 's/\\n\"//g')
echo -n "Charset is $enc. Stats: "
if test -n "$enc" ; then
iconv -f $enc -t UTF-8 $1 >$temp >/dev/null 2>&1 || clean_and_die 2
LC_ALL=C msgfmt -c -v -o /dev/null --statistics $1
fi
clean_and_die 0
Reply to: