DATADIR = $(shell gnome-config --datadir) LOCALEDIR = $(DATADIR)/share/locale MAINDIR = BOXTYPE = boxtypes BOXFORMATS = boxformats PTK = ptk PO_DIR = po DOMAIN = pyne all:pot update-po mo POTFILES: grep -l "_(['|\"]" ../$(MAINDIR)/*.py > POTFILES.in grep -l "_(['|\"]" ../$(BOXTYPE)/*.py >> POTFILES.in grep -l "_(['|\"]" ../$(BOXTYPE)/*/*.py >> POTFILES.in grep -l "_(['|\"]" ../$(BOXFORMATS)/*.py >> POTFILES.in grep -l "_(['|\"]" ../$(PTK)/*.py >> POTFILES.in # add more directories here, which need to be added in POTFILES.in **** #create pot file pot: POTFILES ./pygettext.py -o $(DOMAIN).pot `cat POTFILES.in` #update all po fles update-po: for po in *.po; do \ lingua=`basename $$po .po`; \ mv $$lingua.po $$lingua.old.po; \ if msgmerge -o $$lingua.po $$lingua.old.po $(DOMAIN).pot; then\ rm $$lingua.old.po; \ else \ rm -f $$lingua.po; \ mv $$lingua.old.po $$lingua.po; \ fi \ done #create all mo files mo: for po in *.po; do\ lingua=`basename $$po .po`; \ msgfmt -o $$lingua.mo $$po ; \ done #install mo files install: for mo in *.mo; do\ lingua=`basename $$mo .mo`; \ mkdir -p $(PREFIX)$(LOCALEDIR)/$$lingua/LC_MESSAGES ; \ install -m 644 $$lingua.mo $(PREFIX)$(LOCALEDIR)/$$lingua/LC_MESSAGES/$(DOMAIN).mo ; \ done clean: rm -f POTFILES.in rm -f *.pot rm -f *.mo