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 | ||
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 | |
ddef485a | 24 | LANG=pt-br |
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 | |
be00f604 | 44 | ## RECIPES for the individual pages in each language |
5b824516 | 45 | |
7c436f63 TG |
46 | # Add yours if you migrate to PO, keeping the alphabetical order. |
47 | ||
48 | # NOTES | |
49 | # 1. You can use another recipe as a model, but be careful with global image | |
ddef485a | 50 | # localization; make sure that _all_ images are in the static/LANG/img |
7c436f63 TG |
51 | # subdirectory. |
52 | # 2. The following modifications are essential in right to left languages: | |
53 | # sed -i 's|<html|<html dir="rtl"|' $@ | |
54 | # sed -i '/\/css\/main.css/a\ | |
55 | # <link rel="stylesheet" href="//static.fsf.org/nosvn/enc-dev0/css/main.rtl.css" />' $@ | |
56 | # See Persian recipe as an example. | |
57 | ||
58 | # cs - Czech | |
06d24cc9 TS |
59 | # sed -i 's|<li><a href="/en">English - v4.0</a></li>|<li><a class="current" href="/cs">Čeština - v4.0</a></li>\ |
60 | # <li><a href="/en">English - v4.0</a></li>|' $@ | |
b121008a TS |
61 | cs/%.html: esd-cs.po $(foreach f,$(SRC),en/$f) |
62 | -po4a-translate $(PO4A_FLAGS) -m en/$*.html -p $< -l $@ | |
a5918155 | 63 | sed -i 's|img/en/|img/cs/|g' $@ |
b121008a | 64 | |
7c436f63 TG |
65 | # es - Spanish |
66 | es/%.html: esd-es.po $(foreach f,$(SRC),en/$f) | |
67 | -po4a-translate $(PO4A_FLAGS) -m en/$*.html -p $< -l $@ | |
68 | sed -i '/\/css\/main.css/a\ | |
69 | <link rel="stylesheet" href="//static.fsf.org/nosvn/enc-dev0/css/main.es.css" />' $@ | |
70 | ||
71 | # fa - Persian | |
caf2dc6e | 72 | fa/%.html: esd-fa.po $(foreach f,$(SRC),en/$f) |
b121008a | 73 | -po4a-translate $(PO4A_FLAGS) -m en/$*.html -p $< -l $@ |
be00f604 | 74 | sed -i 's|<html|<html dir="rtl"|' $@ |
8978c227 TG |
75 | sed -i '/\/css\/main.css/a\ |
76 | <link rel="stylesheet" href="//static.fsf.org/nosvn/enc-dev0/css/main.rtl.css" />' $@ | |
b121008a | 77 | |
7c436f63 | 78 | # ja - Japanese |
be00f604 TG |
79 | ja/%.html: esd-ja.po $(foreach f,$(SRC),en/$f) |
80 | -po4a-translate $(PO4A_FLAGS) -m en/$*.html -p $< -l $@ | |
be00f604 | 81 | |
ddef485a TG |
82 | # pt-br - Brazilian Portuguese |
83 | pt-br/%.html: esd-pt-br.po $(foreach f,$(SRC),en/$f) | |
84 | -po4a-translate $(PO4A_FLAGS) -m en/$*.html -p $< -l $@ | |
85 | sed -i '/\/donate.png" \/><\/a><\/p>/a\ | |
86 | \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>' $@ | |
87 | ||
7c436f63 TG |
88 | # sq - Albanian |
89 | sq/%.html: esd-sq.po $(foreach f,$(SRC),en/$f) | |
be00f604 | 90 | -po4a-translate $(PO4A_FLAGS) -m en/$*.html -p $< -l $@ |
be00f604 | 91 | |
7c436f63 | 92 | # zh-han - Chinese (Han) |
be00f604 TG |
93 | zh-hans/%.html: esd-zh-hans.po $(foreach f,$(SRC),en/$f) |
94 | -po4a-translate $(PO4A_FLAGS) --keep 0 -m en/$*.html -p $< -l $@ | |
b121008a | 95 |