Makefile.gen: add French recipe.
[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
4437e4d0 24LANG=tr
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
06d24cc9
TS
63# sed -i 's|<li><a href="/en">English - v4.0</a></li>|<li><a class="current" href="/cs">Čeština - v4.0</a></li>\
64# <li><a href="/en">English - v4.0</a></li>|' $@
b121008a
TS
65cs/%.html: esd-cs.po $(foreach f,$(SRC),en/$f)
66 -po4a-translate $(PO4A_FLAGS) -m en/$*.html -p $< -l $@
a5918155 67 sed -i 's|img/en/|img/cs/|g' $@
b121008a 68
7c436f63
TG
69# es - Spanish
70es/%.html: esd-es.po $(foreach f,$(SRC),en/$f)
71 -po4a-translate $(PO4A_FLAGS) -m en/$*.html -p $< -l $@
72 sed -i '/\/css\/main.css/a\
73 <link rel="stylesheet" href="//static.fsf.org/nosvn/enc-dev0/css/main.es.css" />' $@
10bd8a2d
TG
74 sed -i 's,static.fsf.org/nosvn/enc-dev0/img/en,static.fsf.org/nosvn/enc-dev0/img/es,g' $@
75 sed -i 's,emailselfdefense.fsf.org/en/infographic.html,emailselfdefense.fsf.org/es/infographic.html,' $@
7c436f63 76
8199a34c
AC
77# gl - Galician
78gl/%.html: esd-gl.po $(foreach f,$(SRC),en/$f)
79 -po4a-translate $(PO4A_FLAGS) -m en/$*.html -p $< -l $@
80 sed -i '/\/css\/main.css/a\
81 <link rel="stylesheet" href="//static.fsf.org/nosvn/enc-dev0/css/main.es.css" />' $@
82 sed -i 's,static.fsf.org/nosvn/enc-dev0/img/en,static.fsf.org/nosvn/enc-dev0/img/gl,g' $@
83 sed -i 's,emailselfdefense.fsf.org/en/infographic.html,emailselfdefense.fsf.org/gl/infographic.html,' $@
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
TG
89 $(sedi) '/\/css\/main.css/a\
90 <link rel="stylesheet" href="//static.fsf.org/nosvn/enc-dev0/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
TG
96 sed -i '/\/css\/main.css/a\
97 <link rel="stylesheet" href="//static.fsf.org/nosvn/enc-dev0/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
ddef485a
TG
103# pt-br - Brazilian Portuguese
104pt-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
110sq/%.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
114zh-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\
118 <link rel="stylesheet" href="//static.fsf.org/nosvn/enc-dev0/css/main.zh-hans.css" />' $@
e0fc35c1
TG
119
120# tr - Turkish
121tr/%.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
128fr/%.html: esd-fr.po $(foreach f,$(SRC),en/$f)
129 -po4a-translate $(PO4A_FLAGS) --keep 0 -m en/$*.html -p $< -l $@
130 sed -i '/\/css\/main.css/a\
131 <link rel="stylesheet" ../static/css/main.fr.css" />' $@
132 sed -i 's|img/en/\([^/]\+\.png\)|img/fr/\1|g' $@
133 sed -i 's|img/en/\(screenshots/section.*\.png\)|img/fr/\1|g' $@
134 sed -i 's|img/en/\(screenshots/workshops.*\.png\)|img/fr/\1|g' $@