39 lines
903 B
Makefile
39 lines
903 B
Makefile
POFILES=$(wildcard *.po)
|
|
MOFILES=$(POFILES:.po=.mo)
|
|
PYFILES=$(shell find ../wcs -name '*.py' | grep -v vendor)
|
|
|
|
all: $(MOFILES)
|
|
|
|
install: all
|
|
for file in $(MOFILES); do \
|
|
lang=`echo $$file | sed 's/\.mo//'`; \
|
|
install -d $(prefix)/usr/share/locale/$$lang/LC_MESSAGES/; \
|
|
install -m 0644 $$file $(prefix)/usr/share/locale/$$lang/LC_MESSAGES/wcs.mo; \
|
|
done
|
|
|
|
wcs.pot: $(PYFILES)
|
|
@echo "Rebuilding the pot file"
|
|
rm -f wcs.pot tmp.*.pot
|
|
cnt=0;
|
|
for file in $(PYFILES); do \
|
|
cnt=$$(expr $$cnt + 1); \
|
|
bn=$$cnt.`basename $$file`; \
|
|
xgettext --keyword=N_ -c -L Python -o tmp.$$bn.pot $$file; \
|
|
done
|
|
msgcat tmp.*.pot > wcs.pot
|
|
rm tmp.*.pot
|
|
|
|
%.mo: %.po
|
|
msgfmt -o $@ $<
|
|
|
|
%.po: wcs.pot
|
|
@echo -n "Merging wcs.pot and $@"
|
|
@msgmerge $@ wcs.pot -o $@.new
|
|
@if [ "`diff $@ $@.new | grep '[<>]' | wc -l`" -ne 2 ]; then \
|
|
mv -f $@.new $@; \
|
|
else \
|
|
rm -f $@.new; \
|
|
fi
|
|
@msgfmt --statistics $@
|
|
|