Makefile.gen: update
[enc.git] / Makefile.gen
1 # This source code is released in public domain.
2
3 # Author Tomas Stary (2016) <tomichec@gmail.com>
4 # Thanks for helpfull discussion to Thérèse Godefroy
5
6 # this Makefile.gen is used to generate the translated html files from the
7 # PO templates
8
9 # see Makefile for generation of translation files (po, pot) and
10 # extraction of translated strings from existing translation
11
12 # usage: make -f Makefile.gen
13
14 # flags for the po4a-getextize
15 PO4A_FLAGS=-M utf-8 -f xhtml --keep 30 -o porefs=none \
16 -o 'untranslated=<script>' \
17 -o 'attributes=<meta>content'
18
19 # list of source files for the translation
20 SRC=confirmation.html\
21 index.html\
22 infographic.html\
23 mac.html\
24 next_steps.html\
25 windows.html\
26 workshops.html
27
28 # list of languages that use the PO files (add yours if you migrate to PO)
29 # Czech - cs, Persian - fa, Japanese - ja, Spanish - es,
30 # Chinese (Han script)- zh-hans, Albanian - sq
31
32 # In LANG add the code(s) of the language(s) you intend to translate
33 LANG=es
34
35 # NOTE:
36 # The following replacement is essential in right to left languages
37 # sed -i 's|<html|<html dir="rtl"|' $@
38 # See Persian recipe as an example
39
40 # IMPORTANT
41 # 1. Make sure your esd-lang.po is encoded in unix format (end
42 # of line \n, not DOS \n\r), otherwise po4a-translate complains
43 # about strange lines.
44 # 2. Before generating a page for publication, make sure the PO has no
45 # untranslated or fuzzy strings, otherwise the translation will be
46 # interspersed with English strings.
47
48
49 # default target
50 all: $(foreach l,$(LANG),$(foreach f,$(SRC),$l/$f))
51
52
53 ## RECIPES for the individual pages in each language
54
55 # Czech
56 # sed -i 's|<li><a href="/en">English - v4.0</a></li>|<li><a class="current" href="/cs">Čeština - v4.0</a></li>\
57 # <li><a href="/en">English - v4.0</a></li>|' $@
58 cs/%.html: esd-cs.po $(foreach f,$(SRC),en/$f)
59 -po4a-translate $(PO4A_FLAGS) -m en/$*.html -p $< -l $@
60 sed -i 's|img/en/|img/cs/|g' $@
61
62 # Persian
63 fa/%.html: esd-fa.po $(foreach f,$(SRC),en/$f)
64 -po4a-translate $(PO4A_FLAGS) -m en/$*.html -p $< -l $@
65 sed -i 's|<html|<html dir="rtl"|' $@
66 sed -i '/\/css\/main.css/a\
67 <link rel="stylesheet" href="//static.fsf.org/nosvn/enc-dev0/css/main.rtl.css" />' $@
68
69 # Japanese
70 ja/%.html: esd-ja.po $(foreach f,$(SRC),en/$f)
71 -po4a-translate $(PO4A_FLAGS) -m en/$*.html -p $< -l $@
72
73 # Spanish
74 es/%.html: esd-es.po $(foreach f,$(SRC),en/$f)
75 -po4a-translate $(PO4A_FLAGS) -m en/$*.html -p $< -l $@
76 sed -i '/\/css\/main.css/a\
77 <link rel="stylesheet" href="//static.fsf.org/nosvn/enc-dev0/css/main.es.css" />' $@
78
79 # Chinese (Han)
80 zh-hans/%.html: esd-zh-hans.po $(foreach f,$(SRC),en/$f)
81 -po4a-translate $(PO4A_FLAGS) --keep 0 -m en/$*.html -p $< -l $@
82 sed -i 's|<li><a class="current" href="/en">English - v4.0</a></li>|<li><a href="/en">English - v4.0</a></li>|' $@
83 sed -i 's|<li><a href="/zh-hans">简体中文 - v4.0</a></li>|<li><a class="current" href="/zh-hans">简体中文 - v4.0</a></li>|' $@
84
85 # (copy the recipe for your language if you migrate to PO)
86
87 # Albanian
88 sq/%.html: esd-sq.po $(foreach f,$(SRC),en/$f)
89 -po4a-translate $(PO4A_FLAGS) -m en/$*.html -p $< -l $@