# # Makefile for gettext catalogs update # # $Id: Makefile,v 1.2 2005/01/28 23:07:23 vaclavslavik Exp $ # DOCUMANCER_LINGUAS := `ls *.po 2> /dev/null | sed -n 's/\(documancer\)\?\.po//p'` # ---------------------------------------------------------------------------- # Logic for catalogs updating follows # ---------------------------------------------------------------------------- # the programs we use MSGFMT=msgfmt --verbose MSGMERGE=msgmerge XGETTEXT=pygettext.py XARGS=xargs # common xgettext args: C++ syntax, use the specified macro names as markers XGETTEXT_ARGS=-C -k_ -s -j # implicit rules %.mo: %.po $(MSGFMT) -o $@ $< # a PO file must be updated from documancer.po to include new translations %.po: documancer.pot if [ -f $@ ]; then $(MSGMERGE) $@ documancer.pot > $@.new && mv $@.new $@; else cp documancer.pot $@; fi documancer.pot: touch $@ find ../src -name "*.py" | $(XARGS) $(XGETTEXT) -o documancer.pot allpo: force-update @for t in $(DOCUMANCER_LINGUAS); do $(MAKE) $$t.po; done allmo: @for t in $(DOCUMANCER_LINGUAS); do $(MAKE) $$t.mo; done force-update: $(RM) documancer.pot # print out the percentage of the translated strings stats: @for i in $(DOCUMANCER_LINGUAS); do \ x=`$(MSGFMT) -o /dev/null "$$i.po" 2>&1 | sed -e 's/[,\.]//g' \ -e 's/\([0-9]\+\) translated messages\?/TR=\1/' \ -e 's/\([0-9]\+\) fuzzy translations\?/FZ=\1/' \ -e 's/\([0-9]\+\) untranslated messages\?/UT=\1/'`; \ TR=0 FZ=0 UT=0; \ eval $$x; \ TOTAL=`expr $$TR + $$FZ + $$UT`; \ echo "\"$$i\" => \"`expr 100 "*" $$TR / $$TOTAL`\", /* $$TOTAL strings */"; \ done .PHONY: allpo allmo force-update stats FORCE