zh-hans: Substitute "Email Self-Defense" with Chinese.
[enc.git] / Makefile.gen
index c07991ddb9f59649b6f2c49119554a851fcee27b..72891ceb9ab2be8635c8a2d76fd3239994d64cc7 100644 (file)
@@ -1,6 +1,6 @@
 # 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
@@ -21,7 +21,7 @@
 
 
 # In LANG add the code(s) of the language(s) you intend to translate
-LANG=es
+LANG=de
 
 # flags for the po4a-getextize
 PO4A_FLAGS=-M utf-8 -f xhtml --keep 30 -o porefs=none \
@@ -41,6 +41,12 @@ SRC=confirmation.html\
 all: $(foreach l,$(LANG),$(foreach f,$(SRC),$l/$f))
 
 
+## Function to make this work with Gnu and BSD sed
+define sedi
+    sed --version >/dev/null 2>&1 && sed -i || sed -i ""
+endef
+
+
 ## RECIPES for the individual pages in each language
 
 # Add yours if you migrate to PO, keeping the alphabetical order.
@@ -70,6 +76,11 @@ 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,' $@
 
+# 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;}' $@
+
 # fa - Persian
 fa/%.html: esd-fa.po $(foreach f,$(SRC),en/$f)
        -po4a-translate $(PO4A_FLAGS) -m en/$*.html -p $< -l $@
@@ -94,4 +105,6 @@ sq/%.html: esd-sq.po $(foreach f,$(SRC),en/$f)
 # 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|img/en/|img/zh-hans/|g' $@
+       sed -i '/\/css\/main.css/a\
+       <link rel="stylesheet" href="//static.fsf.org/nosvn/enc-dev0/css/main.zh-hans.css" />' $@