update-po:
	find -regex "./\(plugins\).*\.\(py\|glade\|ui\|in\)" \
		| sed '/gtk\.ui/ s,^,[type: gettext/glade],' > po/POTFILES.in
	python setup.py build_i18n --merge-po --po-dir po

clean:
	rm -rf build/*
	find . -type f -name "*.pyo" -delete

translations: po/*.po
	# TODO evand 2009-07-28: Ideally we should build the mo files once,
	# instead of once here and once in setup.py.
	# Taken from Wubi.
	rm -rf build/translations
	mkdir -p build/translations/
	@for po in $^; do \
		language=`basename $$po`; \
		language=$${language%%.po}; \
		target="build/translations/$$language/LC_MESSAGES"; \
		mkdir -p $$target; \
		msgfmt --output=$$target/mythbuntu-common.mo $$po; \
	done
