1 # The availaible translation languages.
2 # When starting a new translation, add a language code here.
3 TRANSLATIONS
= de es fr ru
4 LANGS
= en
$(TRANSLATIONS
)
7 .PHONY
: all clean sync public
$(LANGS
)
11 $(LANGS
): %: book-
% book-
%/default.css book-
%.html book-
%.pdf
13 # The book consists of these text files in the following order:
15 TXTFILES
:= preface.txt intro.txt basic.txt clone.txt branch.txt history.txt \
16 multiplayer.txt grandmaster.txt secrets.txt drawbacks.txt translate.txt
18 $(foreach l
,$(LANGS
),book-
$(l
).xml
): book-
%.xml
: $(addprefix %/,$(TXTFILES
))
19 # Concatenate the text files and feed to AsciiDoc.
20 # If a file has not yet been translated for the target language,
21 # then substitute the English version.
22 # Kludge to support any translation of "Preface".
23 echo
'[specialsections]' > conf
; \
24 if
[ $* != ru
]; then \
25 sed
-n
'/^== .* ==$$/p' $*/preface.txt | sed
's/^== \(.*\) ==$$/^\1$$=preface/' >> conf
; \
27 cp lang-ru.conf conf
; fi
; \
28 ( for FILE in
$^
; do if
[ -f
$$FILE ]; then cat
$$FILE; else \
29 cat en
/$$(basename $$FILE); fi
; echo
; done
) | \
30 asciidoc
-a lang
=$* -d book
-b docbook
-f conf
- > $@
32 # This rule allows unfinished translations to build.
33 # Report an error if the English version of the text file is missing.
34 $(addprefix en
/,$(TXTFILES
)):
35 @if
[ ! -f
$@
]; then echo English file missing
: $@
; exit
123; fi
36 $(foreach l
,$(TRANSLATIONS
),$(addprefix $(l
)/,$(TXTFILES
))):
37 @if
[ ! -f
$@
]; then echo
$@ missing
: using English version
; fi
39 # Ignore tidy's exit code because Asciidoc generates section IDs beginning with
40 # "_", which xmlto converts to "id" attributes of <a> tags. The standard
41 # insists that "id" attributes begin with a letter, which causes tidy to
42 # print a warning and return a nonzero code.
44 # When Asciidoc 8.3.0+ is widespread, I'll use its idprefix attribute instead
45 # of ignoring return codes.
47 $(foreach l
,$(LANGS
),book-
$(l
)): book-
%: book-
%.xml
48 xmlto
-m custom-html.xsl
-o book-
$* html book-
$*.xml
49 sed
-i
's/xmlns:fo[^ ]*//g' book-
$*/*.html
50 -ls book-
$*/*.html | xargs
-n
1 tidy
-utf8
-m
-i
-q
53 $(foreach l
,$(LANGS
),book-
$(l
)/default.css
): book-
%/default.css
: book.css
55 rsync book.css book-
$*/default.css
57 $(foreach l
,$(LANGS
),book-
$(l
).html
): book-
%.html
: book-
%.xml
58 xmlto
-m custom-nochunks.xsl html-nochunks
$^
61 # Set SP_ENCODING to avoid "non SGML character" errors.
62 # Can also do SP_ENCODING="UTF-8".
63 $(foreach l
,$(LANGS
),book-
$(l
).pdf
): book-
%.pdf
: book-
%.xml
64 SP_ENCODING
="XML" docbook2pdf book-
$*.xml
67 -rm -rf
$(foreach l
,$(LANGS
),book-
$(l
).pdf book-
$(l
).xml book-
$(l
).html book-
$(l
))
70 rsync
-r book.html book.pdf book
/* blynn@xenon.stanford.edu
:www
/gitmagic
/intl
/$(LANG
)/
73 git push blynn@git.or.cz
:srv
/git
/gitmagic.git
74 git push git@github.com
:blynn
/gitmagic.git
75 git push git@gitorious.org
:gitmagic
/mainline.git