# This source code is released in public domain.
-# Author Tomas Stary (2016) <tomichec@gmail.com>
+# Author Tomas Stary (2016) <tomichec@gmail.com>
# Thanks for helpfull discussion to Thérèse Godefroy
-# this Makefile.gen is used to generate the translated html files from the
+# This Makefile.gen is used to generate the translated html files from the
# PO templates
-# see Makefile for generation of translation files (po, pot) and
+# See Makefile for generation of translation files (po, pot) and
# extraction of translated strings from existing translation
# usage: make -f Makefile.gen
+# IMPORTANT
+# 1. Make sure your esd-LANG.po is encoded in unix format (end
+# of line \n, not DOS \n\r), otherwise po4a-translate complains
+# about strange lines.
+# 2. Before generating a page for publication, make sure the PO has no
+# untranslated or fuzzy strings, otherwise the translation will be
+# interspersed with English strings.
+
+
+# In LANG add the code(s) of the language(s) you intend to translate
+LANG=tr
+
# flags for the po4a-getextize
PO4A_FLAGS=-M utf-8 -f xhtml --keep 30 -o porefs=none \
-o 'untranslated=<script>' \
-o 'attributes=<meta>content'
-# list of source files for the translation
+# List of source files for the translation
SRC=confirmation.html\
index.html\
infographic.html\
- mac.html\
next_steps.html\
- windows.html\
workshops.html
-# list of languages that use the PO files (add yours if you migrate to PO)
-# Czech - cs, Persian - fa, Japanese - ja, Spanish - es,
-# Chinese (Han script)- zh-hans, Albanian - sq
-
-# In LANG add the code(s) of the language(s) you intend to translate
-LANG=es
+# default target
+all: $(foreach l,$(LANG),$(foreach f,$(SRC),$l/$f))
-# NOTE:
-# The following replacement is essential in right to left languages
-# sed -i 's|<html|<html dir="rtl"|' $@
-# See Persian recipe as an example
-# IMPORTANT
-# 1. Make sure your esd-lang.po is encoded in unix format (end
-# of line \n, not DOS \n\r), otherwise po4a-translate complains
-# about strange lines.
-# 2. Before generating a page for publication, make sure the PO has no
-# untranslated or fuzzy strings, otherwise the translation will be
-# interspersed with English strings.
+## Function to select gsed if sed is not GNU sed but BSD sed
+define sedi
+ sed --version >/dev/null 2>&1 && sed -i || gsed -i
+endef
-# default target
-all: $(foreach l,$(LANG),$(foreach f,$(SRC),$l/$f))
+## RECIPES for the individual pages in each language
+# Add yours if you migrate to PO, keeping the alphabetical order.
-## RECIPES for the individual pages in each language
+# NOTES
+# 1. You can use another recipe as a model, but be careful with global image
+# localization; make sure that _all_ images are in the static/LANG/img
+# subdirectory.
+# 2. The following modifications are essential for right to left languages:
+# sed -i 's|<html|<html dir="rtl"|' $@
+# sed -i '/\/css\/main.css/a\
+# <link rel="stylesheet" href="//static.fsf.org/nosvn/enc-dev0/css/main.rtl.css" />' $@
+# See Persian recipe as an example.
-# Czech
-# sed -i 's|<li><a href="/en">English - v4.0</a></li>|<li><a class="current" href="/cs">Čeština - v4.0</a></li>\
-# <li><a href="/en">English - v4.0</a></li>|' $@
+# cs - Czech
cs/%.html: esd-cs.po $(foreach f,$(SRC),en/$f)
-po4a-translate $(PO4A_FLAGS) -m en/$*.html -p $< -l $@
- sed -i 's|<li><a class="current" href="/en">English - v4.0</a></li>|<li><a href="/en">English - v4.0</a></li>|' $@
sed -i 's|img/en/|img/cs/|g' $@
-# Persian
+# es - Spanish
+es/%.html: esd-es.po $(foreach f,$(SRC),en/$f)
+ -po4a-translate $(PO4A_FLAGS) -m en/$*.html -p $< -l $@
+ sed -i '/\/css\/main.css/a\
+ <link rel="stylesheet" href="static/css/main.es.css" />' $@
+ sed -i 's,static/img/en/\([^/]\+.png\),static/img/es/\1,g' $@
+ sed -i 's,static/img/en\(/screenshots/section.\+.png\),static/img/es\1,g' $@
+ sed -i 's,static/img/en\(/screenshots/step1a.\+.png\),static/img/es\1,g' $@
+
+# gl - Galician
+gl/%.html: esd-gl.po $(foreach f,$(SRC),en/$f)
+ -po4a-translate $(PO4A_FLAGS) -m en/$*.html -p $< -l $@
+ sed -i '/\/css\/main.css/a\
+ <link rel="stylesheet" href="static/css/main.es.css" />' $@
+ sed -i 's,static/img/en/\([^/]\+.png\),static/img/es/\1,g' $@
+ sed -i 's,static/img/en\(/screenshots/section.\+.png\),static/img/es\1,g' $@
+ sed -i 's,static/img/en\(/screenshots/step1a.\+.png\),static/img/es\1,g' $@
+
+# de - German
+de/%.html: esd-de.po $(foreach f,$(SRC),en/$f)
+ -po4a-translate $(PO4A_FLAGS) -m en/$*.html -p $< -l $@
+ $(sedi) '{s|img/en/|img/de/|g;}' $@
+ $(sedi) '/\/css\/main.css/a\
+ <link rel="stylesheet" href="static/css/main.de.css" />' $@
+
+# fa - Persian
fa/%.html: esd-fa.po $(foreach f,$(SRC),en/$f)
-po4a-translate $(PO4A_FLAGS) -m en/$*.html -p $< -l $@
sed -i 's|<html|<html dir="rtl"|' $@
- sed -i 's|<li><a class="current" href="/en">English - v4.0</a></li>|<li><a href="/en">English - v4.0</a></li>|' $@
- sed -i 's|<li><a href="/fa">فارسی - v4.0</a></li>|<li><a class="current" href="/fa">فارسی - v4.0</a></li>|' $@
sed -i '/\/css\/main.css/a\
- <link rel="stylesheet" href="//static.fsf.org/nosvn/enc-dev0/css/main.rtl.css" />' $@
+ <link rel="stylesheet" href="static/css/main.rtl.css" />' $@
-# Japanese
+# ja - Japanese
ja/%.html: esd-ja.po $(foreach f,$(SRC),en/$f)
-po4a-translate $(PO4A_FLAGS) -m en/$*.html -p $< -l $@
-# This replacement is already in the PO.
-# sed -i 's|<li><a class="current" href="/en">English - v4.0</a></li>|<li><a href="/en">English - v4.0</a></li>|' $@
-# sed -i 's|<li><a href="/fa">فارسی - v4.0</a></li>|<li><a class="current" href="/fa">فارسی - v4.0</a></li>|' $@
- sed -i 's|img/en/|img/ja/|g' $@
-# Spanish
-es/%.html: esd-es.po $(foreach f,$(SRC),en/$f)
+# pt-br - Brazilian Portuguese
+pt-br/%.html: esd-pt-br.po $(foreach f,$(SRC),en/$f)
-po4a-translate $(PO4A_FLAGS) -m en/$*.html -p $< -l $@
-# This replacement is already in the PO.
-# sed -i 's|<li><a class="current" href="/en">English - v4.0</a></li>|<li><a href="/en">English - v4.0</a></li>|' $@
-# sed -i 's|<li><a href="/fa">فارسی - v4.0</a></li>|<li><a class="current" href="/fa">فارسی - v4.0</a></li>|' $@
- sed -i 's|img/en/|img/es/|g' $@
+ sed -i '/\/donate.png" \/><\/a><\/p>/a\
+ \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>' $@
-# Chinese (Han)
+# sq - Albanian
+sq/%.html: esd-sq.po $(foreach f,$(SRC),en/$f)
+ -po4a-translate $(PO4A_FLAGS) -m en/$*.html -p $< -l $@
+
+# zh-han - Chinese (Han)
zh-hans/%.html: esd-zh-hans.po $(foreach f,$(SRC),en/$f)
-po4a-translate $(PO4A_FLAGS) --keep 0 -m en/$*.html -p $< -l $@
- sed -i 's|<li><a class="current" href="/en">English - v4.0</a></li>|<li><a href="/en">English - v4.0</a></li>|' $@
- sed -i 's|<li><a href="/zh-hans">简体中文 - v4.0</a></li>|<li><a class="current" href="/zh-hans">简体中文 - v4.0</a></li>|' $@
-# sed -i 's|img/en/|img/zh-hans/|g' $@
+ sed -i 's|img/en/|img/zh-hans/|g' $@
+ sed -i '/\/css\/main.css/a\
+ <link rel="stylesheet" href="../static/css/main.zh-hans.css" />' $@
-# (copy the recipe for your language if you migrate to PO)
+# tr - Turkish
+tr/%.html: esd-tr.po $(foreach f,$(SRC),en/$f)
+ -po4a-translate $(PO4A_FLAGS) --keep 0 -m en/$*.html -p $< -l $@
+ sed -i 's|img/en/|img/tr/|g' $@
+ sed -i 's,\(alt="Bağış[^"]*"\),style="width:160px" \1,' $@
-# Albanian
-sq/%.html: esd-sq.po $(foreach f,$(SRC),en/$f)
- -po4a-translate $(PO4A_FLAGS) -m en/$*.html -p $< -l $@
-# This replacement is already in the PO.
-# sed -i 's|<li><a class="current" href="/en">English - v4.0</a></li>|<li><a href="/en">English - v4.0</a></li>|' $@
-# sed -i 's|<li><a href=\"/sq\">Shqip - v4.0</a></li>|<li><a class="current" href="/sq">Shqip - v4.0</a></li>|' $@
- sed -i 's|img/en/|img/sq/|g' $@
+# fr - French
+fr/%.html: esd-fr.po $(foreach f,$(SRC),en/$f)
+ -po4a-translate $(PO4A_FLAGS) --keep 0 -m en/$*.html -p $< -l $@
+ sed -i 's|img/en/|img/fr/|g' $@
+# ru
+ru/%.html: esd-ru.po $(foreach f,$(SRC),en/$f)
+ -po4a-translate $(PO4A_FLAGS) --keep 0 -m en/$*.html -p $< -l $@
+ sed -i 's|img/en/|img/ru/|g' $@