Commit | Line | Data |
---|---|---|
5b824516 TS |
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 | |
b121008a TS |
7 | # PO templates |
8 | ||
5b824516 TS |
9 | # see Makefile for generation of translation files (po, pot) and |
10 | # extraction of translated strings from existing translation | |
11 | ||
b121008a TS |
12 | # usage: make -f Makefile.gen |
13 | ||
14 | # flags for the po4a-getextize | |
5b824516 TS |
15 | PO4A_FLAGS=-M utf-8 -f xhtml --keep 30 -o porefs=none \ |
16 | -o 'untranslated=<script>' \ | |
17 | -o 'attributes=<meta>content' | |
b121008a TS |
18 | # list of source files for the translation |
19 | SRC=confirmation.html\ | |
20 | index.html\ | |
21 | infographic.html\ | |
22 | mac.html\ | |
23 | next_steps.html\ | |
24 | windows.html\ | |
25 | workshops.html | |
26 | ||
27 | # list of languages that use the PO files (add yours if you migrate to PO) | |
caf2dc6e TS |
28 | # czech - cs, persian - fa |
29 | # in the LANG add the code(s) of the language(s) you intend to translate | |
30 | LANG=fa | |
31 | ||
32 | # NOTE: | |
33 | # The following replacement is essential in right to left languages | |
34 | # sed -i 's|<html>|<html dir="rtl">|' $@ | |
35 | # See Persian recipe as an example | |
b121008a TS |
36 | |
37 | # default target | |
38 | all: $(foreach l,$(LANG),$(foreach f,$(SRC),$l/$f)) | |
39 | ||
5b824516 TS |
40 | |
41 | # IMPORTANT: make sure your esd-lang.po is encoded in unix format (end | |
42 | # of line \n, not DOS \n\r), otherwise the po4a-translate complains | |
43 | # about strange lines. | |
44 | ||
45 | ||
b121008a TS |
46 | # recipes for the individual pages in each language |
47 | # Czech | |
06d24cc9 TS |
48 | # sed -i 's|<li><a href="/en">English - v4.0</a></li>|<li><a class="current" href="/cs">Čeština - v4.0</a></li>\ |
49 | # <li><a href="/en">English - v4.0</a></li>|' $@ | |
b121008a TS |
50 | cs/%.html: esd-cs.po $(foreach f,$(SRC),en/$f) |
51 | -po4a-translate $(PO4A_FLAGS) -m en/$*.html -p $< -l $@ | |
06d24cc9 | 52 | sed -i 's|<li><a class="current" href="/en">English - v4.0</a></li>|<li><a href="/en">English - v4.0</a></li>|' $@ |
a5918155 | 53 | sed -i 's|img/en/|img/cs/|g' $@ |
b121008a | 54 | |
caf2dc6e TS |
55 | # Persian |
56 | fa/%.html: esd-fa.po $(foreach f,$(SRC),en/$f) | |
b121008a | 57 | -po4a-translate $(PO4A_FLAGS) -m en/$*.html -p $< -l $@ |
caf2dc6e TS |
58 | sed -i 's|<html>|<html dir="rtl">|' $@ |
59 | sed -i 's|<li><a class="current" href="/en">English - v4.0</a></li>|<li><a href="/en">English - v4.0</a></li>|' $@ | |
b121008a TS |
60 | |
61 | # (copy the recipe for your language if you migrate to PO) | |
62 |