Fix a link in Workshops (global change).
[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 # IMPORTANT
15 # 1. Make sure your esd-LANG.po is encoded in unix format (end
16 # of line \n, not DOS \n\r), otherwise po4a-translate complains
17 # about strange lines.
18 # 2. Before generating a page for publication, make sure the PO has no
19 # untranslated or fuzzy strings, otherwise the translation will be
20 # interspersed with English strings.
21
22
23 # In LANG add the code(s) of the language(s) you intend to translate
24 LANG=de
25
26 # flags for the po4a-getextize
27 PO4A_FLAGS=-M utf-8 -f xhtml --keep 30 -o porefs=none \
28 -o 'untranslated=<script>' \
29 -o 'attributes=<meta>content'
30
31 # list of source files for the translation
32 SRC=confirmation.html\
33 index.html\
34 infographic.html\
35 mac.html\
36 next_steps.html\
37 windows.html\
38 workshops.html
39
40 # default target
41 all: $(foreach l,$(LANG),$(foreach f,$(SRC),$l/$f))
42
43
44 ## Function to make this work with Gnu and BSD sed
45 define sedi
46 sed --version >/dev/null 2>&1 && sed -i || sed -i ""
47 endef
48
49
50 ## RECIPES for the individual pages in each language
51
52 # Add yours if you migrate to PO, keeping the alphabetical order.
53
54 # NOTES
55 # 1. You can use another recipe as a model, but be careful with global image
56 # localization; make sure that _all_ images are in the static/LANG/img
57 # subdirectory.
58 # 2. The following modifications are essential for right to left languages:
59 # sed -i 's|<html|<html dir="rtl"|' $@
60 # sed -i '/\/css\/main.css/a\
61 # <link rel="stylesheet" href="//static.fsf.org/nosvn/enc-dev0/css/main.rtl.css" />' $@
62 # See Persian recipe as an example.
63
64 # cs - Czech
65 # sed -i 's|<li><a href="/en">English - v4.0</a></li>|<li><a class="current" href="/cs">Čeština - v4.0</a></li>\
66 # <li><a href="/en">English - v4.0</a></li>|' $@
67 cs/%.html: esd-cs.po $(foreach f,$(SRC),en/$f)
68 -po4a-translate $(PO4A_FLAGS) -m en/$*.html -p $< -l $@
69 sed -i 's|img/en/|img/cs/|g' $@
70
71 # es - Spanish
72 es/%.html: esd-es.po $(foreach f,$(SRC),en/$f)
73 -po4a-translate $(PO4A_FLAGS) -m en/$*.html -p $< -l $@
74 sed -i '/\/css\/main.css/a\
75 <link rel="stylesheet" href="//static.fsf.org/nosvn/enc-dev0/css/main.es.css" />' $@
76 sed -i 's,static.fsf.org/nosvn/enc-dev0/img/en,static.fsf.org/nosvn/enc-dev0/img/es,g' $@
77 sed -i 's,emailselfdefense.fsf.org/en/infographic.html,emailselfdefense.fsf.org/es/infographic.html,' $@
78
79 # de - German
80 de/%.html: esd-de.po $(foreach f,$(SRC),en/$f)
81 -po4a-translate $(PO4A_FLAGS) -m en/$*.html -p $< -l $@
82 $(sedi) '{s|img/en/|img/de/|g;}' $@
83
84 # fa - Persian
85 fa/%.html: esd-fa.po $(foreach f,$(SRC),en/$f)
86 -po4a-translate $(PO4A_FLAGS) -m en/$*.html -p $< -l $@
87 sed -i 's|<html|<html dir="rtl"|' $@
88 sed -i '/\/css\/main.css/a\
89 <link rel="stylesheet" href="//static.fsf.org/nosvn/enc-dev0/css/main.rtl.css" />' $@
90
91 # ja - Japanese
92 ja/%.html: esd-ja.po $(foreach f,$(SRC),en/$f)
93 -po4a-translate $(PO4A_FLAGS) -m en/$*.html -p $< -l $@
94
95 # pt-br - Brazilian Portuguese
96 pt-br/%.html: esd-pt-br.po $(foreach f,$(SRC),en/$f)
97 -po4a-translate $(PO4A_FLAGS) -m en/$*.html -p $< -l $@
98 sed -i '/\/donate.png" \/><\/a><\/p>/a\
99 \n<div class="fsf-emphasis"><p>Conheça também a <a\nhref="http://www.fsfla.org/ikiwiki/index.pt.html">FSFLA</a>, organização\nirmã da FSF na América Latina.</p></div>' $@
100
101 # sq - Albanian
102 sq/%.html: esd-sq.po $(foreach f,$(SRC),en/$f)
103 -po4a-translate $(PO4A_FLAGS) -m en/$*.html -p $< -l $@
104
105 # zh-han - Chinese (Han)
106 zh-hans/%.html: esd-zh-hans.po $(foreach f,$(SRC),en/$f)
107 -po4a-translate $(PO4A_FLAGS) --keep 0 -m en/$*.html -p $< -l $@
108 sed -i 's|img/en/|img/zh-hans/|g' $@
109 sed -i '/\/css\/main.css/a\
110 <link rel="stylesheet" href="//static.fsf.org/nosvn/enc-dev0/css/main.zh-hans.css" />' $@
111
112 # tr - Turkish
113 tr/%.html: esd-tr.po $(foreach f,$(SRC),en/$f)
114 -po4a-translate $(PO4A_FLAGS) --keep 0 -m en/$*.html -p $< -l $@
115 sed -i 's|img/en/|img/tr/|g' $@
116 sed -i 's|img/tr/screenshots/workshop-section1|img/en/screenshots/workshop-section1|' $@
117 sed -i '/alt="Bağış"/ i\
118 style="width:160px"' $@
119