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
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'
19 # list of source files for the translation
20 SRC=confirmation.html\
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
32 # In LANG add the code(s) of the language(s) you intend to translate
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
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.
50 all: $(foreach l,$(LANG),$(foreach f,$(SRC),$l/$f))
53 ## RECIPES for the individual pages in each language
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' $@
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" />' $@
70 ja/%.html: esd-ja.po $(foreach f,$(SRC),en/$f)
71 -po4a-translate $(PO4A_FLAGS) -m en/$*.html -p $< -l $@
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" />' $@
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>|' $@
85 # (copy the recipe for your language if you migrate to PO)
88 sq/%.html: esd-sq.po $(foreach f,$(SRC),en/$f)
89 -po4a-translate $(PO4A_FLAGS) -m en/$*.html -p $< -l $@