From: Ben Hutchings Date: Tue, 17 Jan 2017 23:57:33 +0000 (+0000) Subject: _translate-docs X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ian/git?a=commitdiff_plain;h=91f5f12142a0b99ff1d53bb26afd2be8e466fe55;p=sgt-puzzles.git _translate-docs Gbp-Pq: Name 206_translate-docs.diff --- diff --git a/Makefile.doc b/Makefile.doc index c7d6946..53e9557 100644 --- a/Makefile.doc +++ b/Makefile.doc @@ -13,5 +13,37 @@ chm: puzzles.hhp puzzles.hhp: puzzles.but chm.but halibut --html puzzles.but chm.but +TRANSLATIONS := $(patsubst po/%.po,%,$(wildcard po/*.po)) + +update-po: +# Please tell me there is an easier way to preserve the POT file header. + test -f po/puzzles-doc.pot + po4a-gettextize -f halibut -m puzzles.but --package-name puzzles \ + -p po/puzzles-doc.tmp1.pot + sed -i '1,/^#$$/d' po/puzzles-doc.tmp1.pot + cat po/puzzles-doc.pot.head po/puzzles-doc.tmp1.pot \ + > po/puzzles-doc.tmp2.pot + diff -q -I Project-Id-Version: -I POT-Creation-Date: \ + po/puzzles-doc.pot po/puzzles-doc.tmp2.pot || \ + mv po/puzzles-doc.tmp2.pot po/puzzles-doc.pot + rm -f po/puzzles-doc.tmp*.pot + for lang in $(TRANSLATIONS); do \ + msgmerge --previous -U po/$$lang.po po/puzzles-doc.pot || exit; \ + done +.PHONY: update-po + +doc/puzzles.but.%: puzzles.but po/%.po + mkdir -p doc + po4a-translate -k 0 -f halibut -m puzzles.but -p po/$*.po -l $@ +.PRECIOUS: $(addprefix doc/puzzles.but.,$(TRANSLATIONS)) + +doc/preprocessed.but.%: doc/puzzles.but.% + sed 's/PREFIX-/$(BINPREFIX)/g' $< > $@ + +doc/puzzles.txt.%: doc/preprocessed.but.% + halibut --text=$@ --input-charset=UTF-8 $< +all: $(addprefix doc/puzzles.txt.,$(TRANSLATIONS)) + clean: rm -f puzzles.hlp puzzles.txt preprocessed.but HACKING *.html *.hh[pck] + rm -rf doc