# Create locversion.plist in the bundle to trigger translations for 
# the application menu and system buttons.  See description at
# http://doc.qt.nokia.com/4.6/mac-differences.html#translating-the-application-menu-and-native-dialogs

QTDIR="/Developer/Applications/Qt/Qt Creator.app/Contents/Resources/translations"
LANGDIR=objects/GPSBabelFE.app/Contents/MacOS/translations


mkplist() {
  D=objects/GPSBabelFE.app/Contents/Resources/$1.lproj 
  [ ! -d $D ] && mkdir $D
  sed "s/LANGUAGE/$1/" ../tools/skeleton-locversion-plist > $D/locversion.plist
  # optional as en, it, and hu aren't translated in Qt yet.
  [ ! -f "$QTDIR/qt_$1.qm" ]  && echo "Bad QTDIR"
  cp "$QTDIR/qt_$1.qm" $LANGDIR
  [ -f gpsbabelfe_${1}.qm ] && cp gpsbabelfe_${1}.qm  $LANGDIR
}

cd gui 
[ ! -d $LANGDIR ] && mkdir $LANGDIR
for i in $(echo  gpsbabelfe_??.ts | sed 's/gpsbabelfe_\(..\).ts/\1/g')
do
	mkplist $i
done

mkplist en

exit 0
