#
# to use this for the localisation of other plugins,
# just change the DOMAIN to the name of the Plugin.
# It is assumed, that the domain ist the same as
# the directory name of the plugin.
#

DOMAIN=FritzCall
installdir = /usr/lib/enigma2/python/Plugins/Extensions/$(DOMAIN)
GETTEXT=xgettext
MSGFMT = msgfmt

LANGS := de it
LANGPO := $(foreach LANG, $(LANGS),$(LANG).po)
LANGMO := $(foreach LANG, $(LANGS),$(LANG).mo)

$(foreach LANG, $(LANGS),$(LANG)/LC_MESSAGES/$(DOMAIN).mo): $(LANGMO)
	for lang in $(LANGS); do \
		mkdir -p $$lang/LC_MESSAGES; \
		cp $$lang.mo $$lang/LC_MESSAGES/$(DOMAIN).mo; \
	done


# the TRANSLATORS: allows putting translation comments before the to-be-translated line.
$(DOMAIN).pot: ../plugin.py
	$(GETTEXT) --no-location -L python --add-comments="TRANSLATORS:" -d $(DOMAIN) -s -o $(DOMAIN).pot ../plugin.py
	msguniq -o $(DOMAIN)uniq.pot $(DOMAIN).pot
	$(RM) $(DOMAIN).pot
	mv $(DOMAIN)uniq.pot $(DOMAIN).pot


%.mo: %.po
	$(MSGFMT) -o $@ $<

%.po: $(DOMAIN).pot
	msgmerge -s -U $@ $(DOMAIN).pot; \

clean:
	rm -f *~

distclean: clean
	rm -f *.mo
