#!/bin/sh
#passed param: ex: de.po
#but also handles name with actual name of application, ex: quicksetup.po

[ ! $1 ] && exit
xLANG="`echo -n $1 | cut -f 1 -d '.'`"
if [ `echo -n $xLANG | wc --chars` -ne 2 ];then
 xAPP=$xLANG
 echo "passed filename: $1"
 echo -n "Enter 2-letter language (ex: de): "
 read xLANG
 [ `echo -n $xLANG | wc --chars` -ne 2 ] && exit
else
 echo "passed filename: $1"
 echo "Enter name of application being translated: "
 read xAPP
fi

mkdir -p /usr/share/locale/${xLANG}/LC_MESSAGES
msgfmt --check --output-file=/usr/share/locale/${xLANG}/LC_MESSAGES/${xAPP}.mo ${1}

echo "Created /usr/share/locale/${xLANG}/LC_MESSAGES/${xAPP}.mo"
