Commit | Line | Data |
---|---|---|
5b824516 TS |
1 | # This source code is released in public domain. |
2 | ||
911e32fe | 3 | # Author Tomas Stary (2016) <tomichec@gmail.com> |
5b824516 TS |
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 | ||
7c436f63 TG |
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 | |
911e32fe | 24 | LANG=de |
7c436f63 | 25 | |
b121008a | 26 | # flags for the po4a-getextize |
5b824516 TS |
27 | PO4A_FLAGS=-M utf-8 -f xhtml --keep 30 -o porefs=none \ |
28 | -o 'untranslated=<script>' \ | |
29 | -o 'attributes=<meta>content' | |
be00f604 | 30 | |
b121008a TS |
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 | ||
b121008a TS |
40 | # default target |
41 | all: $(foreach l,$(LANG),$(foreach f,$(SRC),$l/$f)) | |
42 | ||
5b824516 | 43 | |
911e32fe FE |
44 | ## Function to make this work with Gnu and BSD sed |
45 | define sedi | |
deeb4ff2 | 46 | sed --version >/dev/null 2>&1 && sed -i || sed -i "" |
911e32fe FE |
47 | endef |
48 | ||
49 | ||
be00f604 | 50 | ## RECIPES for the individual pages in each language |
5b824516 | 51 | |
7c436f63 TG |
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 | |
ddef485a | 56 | # localization; make sure that _all_ images are in the static/LANG/img |
7c436f63 | 57 | # subdirectory. |
10bd8a2d | 58 | # 2. The following modifications are essential for right to left languages: |
7c436f63 TG |
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 | |
06d24cc9 TS |
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>|' $@ | |
b121008a TS |
67 | cs/%.html: esd-cs.po $(foreach f,$(SRC),en/$f) |
68 | -po4a-translate $(PO4A_FLAGS) -m en/$*.html -p $< -l $@ | |
a5918155 | 69 | sed -i 's|img/en/|img/cs/|g' $@ |
b121008a | 70 | |
7c436f63 TG |
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" />' $@ | |
10bd8a2d TG |
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,' $@ | |
7c436f63 | 78 | |
911e32fe FE |
79 | # de - German |
80 | de/%.html: esd-de.po $(foreach f,$(SRC),en/$f) | |
deeb4ff2 FE |
81 | -po4a-translate $(PO4A_FLAGS) -m en/$*.html -p $< -l $@ |
82 | $(sedi) '{s|img/en/|img/de/|g;}' $@ | |
911e32fe | 83 | |
7c436f63 | 84 | # fa - Persian |
caf2dc6e | 85 | fa/%.html: esd-fa.po $(foreach f,$(SRC),en/$f) |
b121008a | 86 | -po4a-translate $(PO4A_FLAGS) -m en/$*.html -p $< -l $@ |
be00f604 | 87 | sed -i 's|<html|<html dir="rtl"|' $@ |
8978c227 TG |
88 | sed -i '/\/css\/main.css/a\ |
89 | <link rel="stylesheet" href="//static.fsf.org/nosvn/enc-dev0/css/main.rtl.css" />' $@ | |
b121008a | 90 | |
7c436f63 | 91 | # ja - Japanese |
be00f604 TG |
92 | ja/%.html: esd-ja.po $(foreach f,$(SRC),en/$f) |
93 | -po4a-translate $(PO4A_FLAGS) -m en/$*.html -p $< -l $@ | |
be00f604 | 94 | |
ddef485a TG |
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 | ||
7c436f63 TG |
101 | # sq - Albanian |
102 | sq/%.html: esd-sq.po $(foreach f,$(SRC),en/$f) | |
be00f604 | 103 | -po4a-translate $(PO4A_FLAGS) -m en/$*.html -p $< -l $@ |
be00f604 | 104 | |
7c436f63 | 105 | # zh-han - Chinese (Han) |
be00f604 TG |
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 $@ | |
80ac8042 T |
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" />' $@ | |
e0fc35c1 TG |
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' $@ | |
6ddfc822 TG |
116 | sed -i 's|img/tr/screenshots/workshop-section1|img/en/screenshots/workshop-section1|' $@ |
117 | sed -i '/alt="Bağış"/ i\ | |
118 | style="width:160px"' $@ | |
e0fc35c1 | 119 |