sv: infographic-button.png
[enc.git] / Makefile
CommitLineData
b121008a
TS
1# This is a Makefile to generate the PO files for automated
2# translation. If you get through the trouble of creating PO file for
3# your language, you will save a lot of hassles with editing plain html
4# and repeated text, which also implies potential mistakes.
5
6# Please read the manual on the page:
7# http://dev.man-online.org/man7/po4a/
8
9# This Makefile only contains commands from the manual tested for the
10# esd translation.
11
12# After the translation of the PO file has been finished, generate new
13# files using: make -f Makefile.gen
14
15# flags for the po4a-getextize
a8687551
TS
16PO4A_FLAGS=-M utf-8 -f xhtml -o porefs=none \
17 -o 'untranslated=<script>' \
18 -o 'attributes=<meta>content' \
19 --package-name emailselfdefense --package-version $version
20
b121008a
TS
21# list of source files for the translation
22SRC=confirmation.html\
23 index.html\
24 infographic.html\
25 mac.html\
26 next_steps.html\
27 windows.html\
28 workshops.html
29
30############################################################
31# initialise the po template from English version, this is to be used,
32# there is no translation for now, and you are going to build it from
33# scratch. Then copy the file esd-temp.pot to your language file
34# esd-$(lang).po such as esd-cs.po, and edit it in your favourite PO
35# editor (such as poedit, or emacs with po-mode).
36
37# If you already have an old translation you can convert it to PO
38# files as described bellow.
39esd-temp.pot: $(foreach f,$(SRC),en/$f)
40 po4a-gettextize $(PO4A_FLAGS) $(foreach f,$+,-m $f) -p $@
41
42############################################################
43# Convert existing translations into PO files.
44
45# NOTE: You need to make sure that your translated document is formaly
46# correct xhtml (there might be accidental mistakes).
47# Validate your document to find errors (e.g. https://validator.w3.org)
48
49# IMPORTANT: when you generate the PO files from the existing
50# translation, the original files in the version *corresponding* to
51# the translation have to be provided as a command line argument (with
52# parameter -m).
53
54# for that specify the directory where the original files are placed
55DIR=en
56# and the list of files that were translated within the corresponding
57# version
58FILES=$(SRC)
59
60# The generation of the PO file is likely to go wrong, because of the
61# mistakes which were introduced by the direct translation of the html
62# files. In this case the po4a gives quite good error message with a
63# reference in which file and line number to look at to find the
64# mistake. Go to that file and try to correct the errors and then
65# repeat the procedure.
66
67# Don't give it up translating PO files is nicer.
68
69# For more details and troubleshooting see:
70# http://dev.man-online.org/man7/po4a/
71# in section: HOWTO convert a pre-existing translation to po4a?
72esd-%.po.extract: $(foreach d,$(DIR) %,$(foreach f,$(FILES),$d/$f))
73 po4a-gettextize $(PO4A_FLAGS) $(foreach f,$(FILES),-m $(DIR)/$f) $(foreach f,$(FILES),-l $*/$f) -p $@
74 cp $@ `basename -s .extract $@`
75
76############################################################
77# update the PO translation after the original has changed. This will
78# make a new PO file automaticaly reusing identical translations, but
79# the strings will be made fuzzy and need to verified manualy. Strings
80# that changed need to be translated again.
81esd-%.po.update: esd-%.po $(foreach f,$(SRC),en/$f)
82 cp $< $@
83 po4a-updatepo $(PO4A_FLAGS) $(foreach f,$(SRC),-m en/$f) -p $@
84 cp $@ $<
a8687551
TS
85
86# TODO: The system could be further refined with 2 external scripts:
87
88# - gnun-add-fuzzy-diff (from the GNUN package [4]). Very useful to locate
89# a change within a string. It runs after po4a-updatepo.
90
91# - some sort of reformatting script to get rid of the extra spaces, tabs,
92# linefeeds, etc., to make sure that a spurious difference between
93# index.html, mac.html and windows.html isn't going to add useless strings
94# to an existing POT file, or make the POs fuzzy for no reason. There is
95# such a script in the kitchen (reformat-html), but I am currently using a
96# simpler one (reformat-original, attached).