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' | |
be00f604 | 18 | |
b121008a TS |
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) | |
be00f604 TG |
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 | |
caf2dc6e TS |
34 | |
35 | # NOTE: | |
36 | # The following replacement is essential in right to left languages | |
be00f604 | 37 | # sed -i 's|<html|<html dir="rtl"|' $@ |
caf2dc6e | 38 | # See Persian recipe as an example |
b121008a | 39 | |
be00f604 TG |
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 | ||
b121008a TS |
49 | # default target |
50 | all: $(foreach l,$(LANG),$(foreach f,$(SRC),$l/$f)) | |
51 | ||
5b824516 | 52 | |
be00f604 | 53 | ## RECIPES for the individual pages in each language |
5b824516 | 54 | |
b121008a | 55 | # Czech |
06d24cc9 TS |
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>|' $@ | |
b121008a TS |
58 | cs/%.html: esd-cs.po $(foreach f,$(SRC),en/$f) |
59 | -po4a-translate $(PO4A_FLAGS) -m en/$*.html -p $< -l $@ | |
06d24cc9 | 60 | sed -i 's|<li><a class="current" href="/en">English - v4.0</a></li>|<li><a href="/en">English - v4.0</a></li>|' $@ |
a5918155 | 61 | sed -i 's|img/en/|img/cs/|g' $@ |
b121008a | 62 | |
caf2dc6e TS |
63 | # Persian |
64 | fa/%.html: esd-fa.po $(foreach f,$(SRC),en/$f) | |
b121008a | 65 | -po4a-translate $(PO4A_FLAGS) -m en/$*.html -p $< -l $@ |
be00f604 | 66 | sed -i 's|<html|<html dir="rtl"|' $@ |
caf2dc6e | 67 | sed -i 's|<li><a class="current" href="/en">English - v4.0</a></li>|<li><a href="/en">English - v4.0</a></li>|' $@ |
8978c227 TG |
68 | sed -i 's|<li><a href="/fa">فارسی - v4.0</a></li>|<li><a class="current" href="/fa">فارسی - v4.0</a></li>|' $@ |
69 | sed -i '/\/css\/main.css/a\ | |
70 | <link rel="stylesheet" href="//static.fsf.org/nosvn/enc-dev0/css/main.rtl.css" />' $@ | |
b121008a | 71 | |
be00f604 TG |
72 | # Japanese |
73 | ja/%.html: esd-ja.po $(foreach f,$(SRC),en/$f) | |
74 | -po4a-translate $(PO4A_FLAGS) -m en/$*.html -p $< -l $@ | |
75 | # This replacement is already in the PO. | |
76 | # sed -i 's|<li><a class="current" href="/en">English - v4.0</a></li>|<li><a href="/en">English - v4.0</a></li>|' $@ | |
77 | # sed -i 's|<li><a href="/fa">فارسی - v4.0</a></li>|<li><a class="current" href="/fa">فارسی - v4.0</a></li>|' $@ | |
78 | sed -i 's|img/en/|img/ja/|g' $@ | |
79 | ||
80 | # Spanish | |
81 | es/%.html: esd-es.po $(foreach f,$(SRC),en/$f) | |
82 | -po4a-translate $(PO4A_FLAGS) -m en/$*.html -p $< -l $@ | |
83 | # This replacement is already in the PO. | |
84 | # sed -i 's|<li><a class="current" href="/en">English - v4.0</a></li>|<li><a href="/en">English - v4.0</a></li>|' $@ | |
85 | # sed -i 's|<li><a href="/fa">فارسی - v4.0</a></li>|<li><a class="current" href="/fa">فارسی - v4.0</a></li>|' $@ | |
86 | sed -i 's|img/en/|img/es/|g' $@ | |
87 | ||
88 | # Chinese (Han) | |
89 | zh-hans/%.html: esd-zh-hans.po $(foreach f,$(SRC),en/$f) | |
90 | -po4a-translate $(PO4A_FLAGS) --keep 0 -m en/$*.html -p $< -l $@ | |
91 | sed -i 's|<li><a class="current" href="/en">English - v4.0</a></li>|<li><a href="/en">English - v4.0</a></li>|' $@ | |
92 | sed -i 's|<li><a href="/zh-hans">简体中文 - v4.0</a></li>|<li><a class="current" href="/zh-hans">简体中文 - v4.0</a></li>|' $@ | |
93 | # sed -i 's|img/en/|img/zh-hans/|g' $@ | |
94 | ||
b121008a TS |
95 | # (copy the recipe for your language if you migrate to PO) |
96 | ||
be00f604 TG |
97 | # Albanian |
98 | sq/%.html: esd-sq.po $(foreach f,$(SRC),en/$f) | |
99 | -po4a-translate $(PO4A_FLAGS) -m en/$*.html -p $< -l $@ | |
100 | # This replacement is already in the PO. | |
101 | # sed -i 's|<li><a class="current" href="/en">English - v4.0</a></li>|<li><a href="/en">English - v4.0</a></li>|' $@ | |
102 | # sed -i 's|<li><a href=\"/sq\">Shqip - v4.0</a></li>|<li><a class="current" href="/sq">Shqip - v4.0</a></li>|' $@ | |
103 | sed -i 's|img/en/|img/sq/|g' $@ |