#! /usr/bin/make -f

LINGUAS = de fr sv
package = beneath-a-steel-sky
podir = $(CURDIR)/debian/po
localedir = /usr/share/locale

$(podir)/templates.pot:
	xgettext \
	  --language=Shell \
	  --copyright-holder="" \
	  --output=$(podir)/templates.pot \
	  $(CURDIR)/debian/sky

%:
	dh $@

override_dh_auto_build:
	for lang in $(LINGUAS); do \
	  msgfmt -c -v --statistics -o $(podir)/$$lang.mo $(podir)/$$lang.po; \
	done

override_dh_clean:
	dh_clean
	dh_clean $(podir)/*.mo

override_dh_install:
	for lang in $(LINGUAS); do \
		dir=$(localedir)/$$lang/LC_MESSAGES/; \
		dh_installdirs $$dir; \
		cp $(podir)/$$lang.mo \
		$(CURDIR)/debian/$(package)$$dir/sky.mo; \
	done
	dh_install


