1POFILES = $(wildcard *.po) 2UPDATEPOFILES = $(POFILES:.po=.po-update) 3NOPFILES = $(POFILES:.po=.nop) 4DOMAIN = JabberBot 5 6.SUFFIXES: .po .po-update .nop 7 8-include POTFILES 9 10POTFILES.in POTFILES: 11 @python ../tools/mk_POTFILES.py ../../../jabberbot 12 13.nop.po-update: 14 @lang=`echo $@ | sed -e 's/\.MoinMoin\.po-update$$//'`; \ 15 echo "$$lang:"; \ 16 ../tools/wiki2po.py $${lang}; \ 17 echo "msgmerge $$lang.$(DOMAIN).po $(DOMAIN).pot -o $$lang.$(DOMAIN).new.po"; \ 18 if msgmerge $$lang.$(DOMAIN).po $(DOMAIN).pot -o $$lang.$(DOMAIN).new.po; then \ 19 if cmp $$lang.$(DOMAIN).po $$lang.$(DOMAIN).new.po >/dev/null 2>&1; then \ 20 rm -f $$lang.$(DOMAIN).new.po; \ 21 else \ 22 ../tools/po2wiki.py $$lang <$$lang.$(DOMAIN).new.po; \ 23 rm -f $$lang.$(DOMAIN).new.po; \ 24 fi; \ 25 else \ 26 echo "msgmerge for $$lang.$(DOMAIN).po failed!" 1>&2; \ 27 rm -f $$lang.$(DOMAIN).new.po; \ 28 fi 29 30# remove "--no-location" if you want to have file names and line numbers 31# that's bad for merging branches - this is why we don't use it 32$(DOMAIN).pot-update: $(POTFILES) POTFILES.in 33 xgettext --default-domain=$(DOMAIN) --directory=../../../jabberbot \ 34 --files-from=POTFILES.in \ 35 --no-location \ 36 --add-comments=TRANSLATORS: 37 @test ! -f $(DOMAIN).po || { \ 38 if test -f $(DOMAIN).pot; then \ 39 sed -e 's/^"POT-Creation-Date: .*\"$$//' < $(DOMAIN).pot > $(DOMAIN).1po && \ 40 sed -e 's/^"POT-Creation-Date: .*"$$//' < $(DOMAIN).po > $(DOMAIN).2po && \ 41 if cmp $(DOMAIN).1po $(DOMAIN).2po >/dev/null 2>&1; then \ 42 rm -f $(DOMAIN).1po $(DOMAIN).2po $(DOMAIN).po; \ 43 else \ 44 rm -f $(DOMAIN).1po $(DOMAIN).2po $(DOMAIN).pot && \ 45 mv $(DOMAIN).po $(DOMAIN).pot; \ 46 fi; \ 47 else \ 48 mv $(DOMAIN).po $(DOMAIN).pot; \ 49 fi; \ 50 } 51 52$(DOMAIN).pot: $(POTFILES) POTFILES.in 53 $(MAKE) $(DOMAIN).pot-update 54 55$(POFILES): 56 @lang=`echo $@ | sed -e 's,.*/,,' -e 's/\.MoinMoin\.po$$//'`; \ 57 ../tools/wiki2po.py $${lang}; \ 58 echo msgmerge $${lang}.$(DOMAIN).po $(DOMAIN).pot -o $${lang}.$(DOMAIN).new.po; \ 59 msgmerge $${lang}.$(DOMAIN).po $(DOMAIN).pot -o $${lang}.$(DOMAIN).new.po; \ 60 ../tools/po2wiki.py $${lang} <$$lang.$(DOMAIN).new.po; \ 61 rm -f $$lang.$(DOMAIN).new.po 62 63$(NOPFILES): 64 65update-po: clean 66 $(MAKE) $(DOMAIN).pot-update 67 $(MAKE) $(UPDATEPOFILES) 68 69stats: 70 @files="$(POFILES)"; \ 71 for i in $$files; do \ 72 lang=`echo $$i | sed -e 's,.*/,,' -e 's/\.MoinMoin\.po$$//'`; \ 73 echo -n "$$lang: "; \ 74 ../msgfmt -o /dev/null --statistics $$i; \ 75 done 76 77clean: 78 rm -f POTFILES POTFILES.in 79 80