it: localize postURL in subscription form of next_steps.html.
[enc.git] / Makefile.gen
CommitLineData
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
b64c2d2a 24LANG=sq
7c436f63 25
b121008a 26# flags for the po4a-getextize
5b824516
TS
27PO4A_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
32SRC=confirmation.html\
33 index.html\
34 infographic.html\
b121008a 35 next_steps.html\
b121008a
TS
36 workshops.html
37
b121008a
TS
38# default target
39all: $(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 43define sedi
d075dcd6 44 sed --version >/dev/null 2>&1 && sed -i || gsed -i
911e32fe
FE
45endef
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
63cs/%.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
68es/%.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
77gl/%.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
86de/%.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 93fa/%.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
100ja/%.html: esd-ja.po $(foreach f,$(SRC),en/$f)
101 -po4a-translate $(PO4A_FLAGS) -m en/$*.html -p $< -l $@
be00f604 102
70679d45
WZ
103# pl - Polish
104pl/%.html: esd-pl.po $(foreach f,$(SRC),en/$f)
105 -po4a-translate $(PO4A_FLAGS) -m en/$*.html -p $< -l $@
106
ddef485a
TG
107# pt-br - Brazilian Portuguese
108pt-br/%.html: esd-pt-br.po $(foreach f,$(SRC),en/$f)
109 -po4a-translate $(PO4A_FLAGS) -m en/$*.html -p $< -l $@
110 sed -i '/\/donate.png" \/><\/a><\/p>/a\
111 \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>' $@
112
7c436f63
TG
113# sq - Albanian
114sq/%.html: esd-sq.po $(foreach f,$(SRC),en/$f)
be00f604 115 -po4a-translate $(PO4A_FLAGS) -m en/$*.html -p $< -l $@
be00f604 116
7c436f63 117# zh-han - Chinese (Han)
be00f604
TG
118zh-hans/%.html: esd-zh-hans.po $(foreach f,$(SRC),en/$f)
119 -po4a-translate $(PO4A_FLAGS) --keep 0 -m en/$*.html -p $< -l $@
80ac8042
T
120 sed -i 's|img/en/|img/zh-hans/|g' $@
121 sed -i '/\/css\/main.css/a\
cc8bd872 122 <link rel="stylesheet" href="../static/css/main.zh-hans.css" />' $@
e0fc35c1
TG
123
124# tr - Turkish
125tr/%.html: esd-tr.po $(foreach f,$(SRC),en/$f)
126 -po4a-translate $(PO4A_FLAGS) --keep 0 -m en/$*.html -p $< -l $@
127 sed -i 's|img/en/|img/tr/|g' $@
66ad3cf6 128 sed -i 's,\(alt="Bağış[^"]*"\),style="width:160px" \1,' $@
e0fc35c1 129
375dc31a
TG
130# fr - French
131fr/%.html: esd-fr.po $(foreach f,$(SRC),en/$f)
132 -po4a-translate $(PO4A_FLAGS) --keep 0 -m en/$*.html -p $< -l $@
8dcfdadc 133 sed -i 's|img/en/|img/fr/|g' $@
c2ad75a9
I
134# ru
135ru/%.html: esd-ru.po $(foreach f,$(SRC),en/$f)
136 -po4a-translate $(PO4A_FLAGS) --keep 0 -m en/$*.html -p $< -l $@
137 sed -i 's|img/en/|img/ru/|g' $@