1 # This source code is released in public domain.
3 # Author Tomas Stary (2016) <tomichec@gmail.com>
4 # Thanks for helpfull discussion to Thérèse Godefroy
6 # this Makefile.gen is used to generate the translated html files from the
9 # see Makefile for generation of translation files (po, pot) and
10 # extraction of translated strings from existing translation
12 # usage: make -f Makefile.gen
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.
23 # In LANG add the code(s) of the language(s) you intend to translate
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'
31 # list of source files for the translation
32 SRC=confirmation.html\
39 all: $(foreach l,$(LANG),$(foreach f,$(SRC),$l/$f))
42 ## Function to select gsed if sed is not GNU sed but BSD sed
44 sed --version >/dev/null 2>&1 && sed -i || gsed -i
48 ## RECIPES for the individual pages in each language
50 # Add yours if you migrate to PO, keeping the alphabetical order.
53 # 1. You can use another recipe as a model, but be careful with global image
54 # localization; make sure that _all_ images are in the static/LANG/img
56 # 2. The following modifications are essential for right to left languages:
57 # sed -i 's|<html|<html dir="rtl"|' $@
58 # sed -i '/\/css\/main.css/a\
59 # <link rel="stylesheet" href="//static.fsf.org/nosvn/enc-dev0/css/main.rtl.css" />' $@
60 # See Persian recipe as an example.
63 # sed -i 's|<li><a href="/en">English - v4.0</a></li>|<li><a class="current" href="/cs">Čeština - v4.0</a></li>\
64 # <li><a href="/en">English - v4.0</a></li>|' $@
65 cs/%.html: esd-cs.po $(foreach f,$(SRC),en/$f)
66 -po4a-translate $(PO4A_FLAGS) -m en/$*.html -p $< -l $@
67 sed -i 's|img/en/|img/cs/|g' $@
70 es/%.html: esd-es.po $(foreach f,$(SRC),en/$f)
71 -po4a-translate $(PO4A_FLAGS) -m en/$*.html -p $< -l $@
72 sed -i '/\/css\/main.css/a\
73 <link rel="stylesheet" href="//static.fsf.org/nosvn/enc-dev0/css/main.es.css" />' $@
74 sed -i 's,static.fsf.org/nosvn/enc-dev0/img/en,static.fsf.org/nosvn/enc-dev0/img/es,g' $@
75 sed -i 's,emailselfdefense.fsf.org/en/infographic.html,emailselfdefense.fsf.org/es/infographic.html,' $@
78 de/%.html: esd-de.po $(foreach f,$(SRC),en/$f)
79 -po4a-translate $(PO4A_FLAGS) -m en/$*.html -p $< -l $@
80 $(sedi) '{s|img/en/|img/de/|g;}' $@
81 $(sedi) '/\/css\/main.css/a\
82 <link rel="stylesheet" href="//static.fsf.org/nosvn/enc-dev0/css/main.de.css" />' $@
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" />' $@
92 ja/%.html: esd-ja.po $(foreach f,$(SRC),en/$f)
93 -po4a-translate $(PO4A_FLAGS) -m en/$*.html -p $< -l $@
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>' $@
102 sq/%.html: esd-sq.po $(foreach f,$(SRC),en/$f)
103 -po4a-translate $(PO4A_FLAGS) -m en/$*.html -p $< -l $@
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" />' $@
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"' $@