#!/bin/bash

KDELANGS=`svn cat https://svn.kde.org/home/kde/trunk/l10n/subdirs`
# KDELANGS="nl"
MODULE=`kdialog --inputbox "Enter the SVN module as known in l10n:"`
APPNAME=`kdialog --inputbox "Enter the application name:"`

# TODO: Sanity checks

mkdir po

for KDELANG in $KDELANGS; do
  echo "Checking $KDELANG/$MODULE/$APPNAME.po"
  svn cat https://svn.kde.org/home/kde/trunk/l10n/$KDELANG/messages/$MODULE/$APPNAME.po 2> /dev/null | tee po/$KDELANG.po
  
  if [ ! -s po/$KDELANG.po ] ; then
    rm po/$KDELANG.po
  fi
done

echo "POFILES = AUTO" > po/Makefile.am
