#!/bin/bash

# Guess the target application if we aren't supplied one
if [ $# == 1 ]; then
	targetapp=$1
else
	targetapp=$(basename $(pwd))
	echo "Guessing application name is \"${targetapp}\""
fi

share=share/$targetapp
desktop=share/applications/$targetapp.desktop
mimetype=share/mime/packages/$targetapp-mimetype.xml

cache="--cache po/.intltool-merge-cache"

if [ -d po ]; then
	if [ -f  ${mimetype}.in ]; then
		intltool-merge --xml-style $cache po ${mimetype}.in $mimetype
	fi
	if [ -f  ${desktop}.in ]; then
		intltool-merge --desktop-style $cache po ${desktop}.in $desktop
	fi
else
	echo "$0: No translation directory"
fi
