#!/bin/sh -e

FILE=i18n-bugs.html
OFILE=i18n-bugs-sorted

if [ ! -e "$FILE" ] ; then
# Do not retrieve this everyt time as the BTS takes a few minutes to answer
	wget -m -k -O $FILE "http://bugs.debian.org/cgi-bin/pkgreport.cgi?which=tag&data=l10n&archive=no&version=&dist=unstable&pend-inc=pending&pend-exc=pending-fixed&pend-exc=fixed&pend-exc=done&include=l10n"
fi

cat $FILE | 
grep "pkgreport.cgi?pkg=" | \
perl -ne 'print $1."\n" if /pkg=(.*?)\;/' | sort | uniq -c |sort -nr > ${OFILE}.txt

cat ${OFILE}.txt | head -10 >${OFILE}-top10.txt

exit 0
