updated my personal email address
[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
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 24LANG=de
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
b121008a
TS
31# list of source files for the translation
32SRC=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
41all: $(foreach l,$(LANG),$(foreach f,$(SRC),$l/$f))
42
5b824516 43
d075dcd6 44## Function to select gsed if sed is not GNU sed but BSD sed
911e32fe 45define sedi
d075dcd6 46 sed --version >/dev/null 2>&1 && sed -i || gsed -i
911e32fe
FE
47endef
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
67cs/%.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
72es/%.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
80de/%.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;}' $@
95edeb05
TG
83 $(sedi) '/\/css\/main.css/a\
84 <link rel="stylesheet" href="//static.fsf.org/nosvn/enc-dev0/css/main.de.css" />' $@
911e32fe 85
7c436f63 86# fa - Persian
caf2dc6e 87fa/%.html: esd-fa.po $(foreach f,$(SRC),en/$f)
b121008a 88 -po4a-translate $(PO4A_FLAGS) -m en/$*.html -p $< -l $@
be00f604 89 sed -i 's|<html|<html dir="rtl"|' $@
8978c227
TG
90 sed -i '/\/css\/main.css/a\
91 <link rel="stylesheet" href="//static.fsf.org/nosvn/enc-dev0/css/main.rtl.css" />' $@
b121008a 92
7c436f63 93# ja - Japanese
be00f604
TG
94ja/%.html: esd-ja.po $(foreach f,$(SRC),en/$f)
95 -po4a-translate $(PO4A_FLAGS) -m en/$*.html -p $< -l $@
be00f604 96
ddef485a
TG
97# pt-br - Brazilian Portuguese
98pt-br/%.html: esd-pt-br.po $(foreach f,$(SRC),en/$f)
99 -po4a-translate $(PO4A_FLAGS) -m en/$*.html -p $< -l $@
100 sed -i '/\/donate.png" \/><\/a><\/p>/a\
101 \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>' $@
102
7c436f63
TG
103# sq - Albanian
104sq/%.html: esd-sq.po $(foreach f,$(SRC),en/$f)
be00f604 105 -po4a-translate $(PO4A_FLAGS) -m en/$*.html -p $< -l $@
be00f604 106
7c436f63 107# zh-han - Chinese (Han)
be00f604
TG
108zh-hans/%.html: esd-zh-hans.po $(foreach f,$(SRC),en/$f)
109 -po4a-translate $(PO4A_FLAGS) --keep 0 -m en/$*.html -p $< -l $@
80ac8042
T
110 sed -i 's|img/en/|img/zh-hans/|g' $@
111 sed -i '/\/css\/main.css/a\
112 <link rel="stylesheet" href="//static.fsf.org/nosvn/enc-dev0/css/main.zh-hans.css" />' $@
e0fc35c1
TG
113
114# tr - Turkish
115tr/%.html: esd-tr.po $(foreach f,$(SRC),en/$f)
116 -po4a-translate $(PO4A_FLAGS) --keep 0 -m en/$*.html -p $< -l $@
117 sed -i 's|img/en/|img/tr/|g' $@
6ddfc822
TG
118 sed -i 's|img/tr/screenshots/workshop-section1|img/en/screenshots/workshop-section1|' $@
119 sed -i '/alt="Bağış"/ i\
120 style="width:160px"' $@
e0fc35c1 121