fr: add localized images.
[enc.git] / Makefile.gen
index 54aeb5f407926782156192c858692ce6adfd922f..4a48acabd0adb7a3904bb57148712225f0db7f03 100644 (file)
@@ -3,10 +3,10 @@
 # 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
 
 
 # In LANG add the code(s) of the language(s) you intend to translate
-LANG=de
+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
 
 # default target
 all: $(foreach l,$(LANG),$(foreach f,$(SRC),$l/$f))
 
 
-## Function to make this work with Gnu and BSD sed
+## Function to select gsed if sed is not GNU sed but BSD sed
 define sedi
-    sed --version >/dev/null 2>&1 && sed -i || sed -i ""
+    sed --version >/dev/null 2>&1 && sed -i || gsed -i
 endef
 
 
@@ -76,10 +74,20 @@ es/%.html: esd-es.po $(foreach f,$(SRC),en/$f)
        sed -i 's,static.fsf.org/nosvn/enc-dev0/img/en,static.fsf.org/nosvn/enc-dev0/img/es,g' $@
        sed -i 's,emailselfdefense.fsf.org/en/infographic.html,emailselfdefense.fsf.org/es/infographic.html,' $@
 
+# 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.fsf.org/nosvn/enc-dev0/css/main.es.css" />' $@
+       sed -i 's,static.fsf.org/nosvn/enc-dev0/img/en,static.fsf.org/nosvn/enc-dev0/img/gl,g' $@
+       sed -i 's,emailselfdefense.fsf.org/en/infographic.html,emailselfdefense.fsf.org/gl/infographic.html,' $@
+
 # 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.fsf.org/nosvn/enc-dev0/css/main.de.css" />' $@
 
 # fa - Persian
 fa/%.html: esd-fa.po $(foreach f,$(SRC),en/$f)
@@ -113,7 +121,14 @@ zh-hans/%.html: esd-zh-hans.po $(foreach f,$(SRC),en/$f)
 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|img/tr/screenshots/workshop-section1|img/en/screenshots/workshop-section1|' $@
        sed -i '/alt="Bağış"/ i\
        style="width:160px"' $@
 
+# 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 '/\/css\/main.css/a\
+       <link rel="stylesheet" ../static/css/main.fr.css" />' $@
+       sed -i 's|img/en/\([^/]\+\.png\)|img/fr/\1|g' $@
+       sed -i 's|img/en/\(screenshots/section.*\.png\)|img/fr/\1|g' $@
+       sed -i 's|img/en/\(screenshots/workshops.*\.png\)|img/fr/\1|g' $@