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 | ||
e9d73ead | 6 | # This Makefile.gen is used to generate the translated html files from the |
b121008a TS |
7 | # PO templates |
8 | ||
e9d73ead | 9 | # See Makefile for generation of translation files (po, pot) and |
5b824516 TS |
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 | |
4437e4d0 | 24 | LANG=tr |
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 | |
e9d73ead | 31 | # List of source files for the translation |
b121008a TS |
32 | SRC=confirmation.html\ |
33 | index.html\ | |
34 | infographic.html\ | |
b121008a | 35 | next_steps.html\ |
b121008a TS |
36 | workshops.html |
37 | ||
b121008a TS |
38 | # default target |
39 | all: $(foreach l,$(LANG),$(foreach f,$(SRC),$l/$f)) | |
40 | ||
5b824516 | 41 | |
d075dcd6 | 42 | ## Function to select gsed if sed is not GNU sed but BSD sed |
911e32fe | 43 | define sedi |
d075dcd6 | 44 | sed --version >/dev/null 2>&1 && sed -i || gsed -i |
911e32fe FE |
45 | endef |
46 | ||
47 | ||
be00f604 | 48 | ## RECIPES for the individual pages in each language |
5b824516 | 49 | |
7c436f63 TG |
50 | # Add yours if you migrate to PO, keeping the alphabetical order. |
51 | ||
52 | # NOTES | |
53 | # 1. You can use another recipe as a model, but be careful with global image | |
ddef485a | 54 | # localization; make sure that _all_ images are in the static/LANG/img |
7c436f63 | 55 | # subdirectory. |
10bd8a2d | 56 | # 2. The following modifications are essential for right to left languages: |
7c436f63 TG |
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. | |
61 | ||
62 | # cs - Czech | |
b121008a TS |
63 | cs/%.html: esd-cs.po $(foreach f,$(SRC),en/$f) |
64 | -po4a-translate $(PO4A_FLAGS) -m en/$*.html -p $< -l $@ | |
a5918155 | 65 | sed -i 's|img/en/|img/cs/|g' $@ |
b121008a | 66 | |
7c436f63 TG |
67 | # es - Spanish |
68 | es/%.html: esd-es.po $(foreach f,$(SRC),en/$f) | |
69 | -po4a-translate $(PO4A_FLAGS) -m en/$*.html -p $< -l $@ | |
70 | sed -i '/\/css\/main.css/a\ | |
cf27916f | 71 | <link rel="stylesheet" href="static/css/main.es.css" />' $@ |
05e08e3b TG |
72 | sed -i 's,static/img/en/\([^/]\+.png\),static/img/es/\1,g' $@ |
73 | sed -i 's,static/img/en\(/screenshots/section.\+.png\),static/img/es\1,g' $@ | |
74 | sed -i 's,static/img/en\(/screenshots/step1a.\+.png\),static/img/es\1,g' $@ | |
7c436f63 | 75 | |
8199a34c AC |
76 | # gl - Galician |
77 | gl/%.html: esd-gl.po $(foreach f,$(SRC),en/$f) | |
78 | -po4a-translate $(PO4A_FLAGS) -m en/$*.html -p $< -l $@ | |
79 | sed -i '/\/css\/main.css/a\ | |
cf27916f TG |
80 | <link rel="stylesheet" href="static/css/main.es.css" />' $@ |
81 | sed -i 's,static/img/en/\([^/]\+.png\),static/img/es/\1,g' $@ | |
82 | sed -i 's,static/img/en\(/screenshots/section.\+.png\),static/img/es\1,g' $@ | |
83 | sed -i 's,static/img/en\(/screenshots/step1a.\+.png\),static/img/es\1,g' $@ | |
8199a34c | 84 | |
911e32fe FE |
85 | # de - German |
86 | de/%.html: esd-de.po $(foreach f,$(SRC),en/$f) | |
deeb4ff2 FE |
87 | -po4a-translate $(PO4A_FLAGS) -m en/$*.html -p $< -l $@ |
88 | $(sedi) '{s|img/en/|img/de/|g;}' $@ | |
95edeb05 | 89 | $(sedi) '/\/css\/main.css/a\ |
cf27916f | 90 | <link rel="stylesheet" href="static/css/main.de.css" />' $@ |
911e32fe | 91 | |
7c436f63 | 92 | # fa - Persian |
caf2dc6e | 93 | fa/%.html: esd-fa.po $(foreach f,$(SRC),en/$f) |
b121008a | 94 | -po4a-translate $(PO4A_FLAGS) -m en/$*.html -p $< -l $@ |
be00f604 | 95 | sed -i 's|<html|<html dir="rtl"|' $@ |
8978c227 | 96 | sed -i '/\/css\/main.css/a\ |
cf27916f | 97 | <link rel="stylesheet" href="static/css/main.rtl.css" />' $@ |
b121008a | 98 | |
7c436f63 | 99 | # ja - Japanese |
be00f604 TG |
100 | ja/%.html: esd-ja.po $(foreach f,$(SRC),en/$f) |
101 | -po4a-translate $(PO4A_FLAGS) -m en/$*.html -p $< -l $@ | |
be00f604 | 102 | |
ddef485a TG |
103 | # pt-br - Brazilian Portuguese |
104 | pt-br/%.html: esd-pt-br.po $(foreach f,$(SRC),en/$f) | |
105 | -po4a-translate $(PO4A_FLAGS) -m en/$*.html -p $< -l $@ | |
106 | sed -i '/\/donate.png" \/><\/a><\/p>/a\ | |
107 | \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>' $@ | |
108 | ||
7c436f63 TG |
109 | # sq - Albanian |
110 | sq/%.html: esd-sq.po $(foreach f,$(SRC),en/$f) | |
be00f604 | 111 | -po4a-translate $(PO4A_FLAGS) -m en/$*.html -p $< -l $@ |
be00f604 | 112 | |
7c436f63 | 113 | # zh-han - Chinese (Han) |
be00f604 TG |
114 | zh-hans/%.html: esd-zh-hans.po $(foreach f,$(SRC),en/$f) |
115 | -po4a-translate $(PO4A_FLAGS) --keep 0 -m en/$*.html -p $< -l $@ | |
80ac8042 T |
116 | sed -i 's|img/en/|img/zh-hans/|g' $@ |
117 | sed -i '/\/css\/main.css/a\ | |
cf27916f | 118 | <link rel="stylesheet" href="static/css/main.zh-hans.css" />' $@ |
e0fc35c1 TG |
119 | |
120 | # tr - Turkish | |
121 | tr/%.html: esd-tr.po $(foreach f,$(SRC),en/$f) | |
122 | -po4a-translate $(PO4A_FLAGS) --keep 0 -m en/$*.html -p $< -l $@ | |
123 | sed -i 's|img/en/|img/tr/|g' $@ | |
6ddfc822 TG |
124 | sed -i '/alt="Bağış"/ i\ |
125 | style="width:160px"' $@ | |
e0fc35c1 | 126 | |
375dc31a TG |
127 | # fr - French |
128 | fr/%.html: esd-fr.po $(foreach f,$(SRC),en/$f) | |
129 | -po4a-translate $(PO4A_FLAGS) --keep 0 -m en/$*.html -p $< -l $@ | |
8dcfdadc | 130 | sed -i 's|img/en/|img/fr/|g' $@ |