Commit | Line | Data |
---|---|---|
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 | |
16 | PO4A_FLAGS=-M utf-8 -f xhtml | |
17 | # list of source files for the translation | |
18 | SRC=confirmation.html\ | |
19 | index.html\ | |
20 | infographic.html\ | |
21 | mac.html\ | |
22 | next_steps.html\ | |
23 | windows.html\ | |
24 | workshops.html | |
25 | ||
26 | ############################################################ | |
27 | # initialise the po template from English version, this is to be used, | |
28 | # there is no translation for now, and you are going to build it from | |
29 | # scratch. Then copy the file esd-temp.pot to your language file | |
30 | # esd-$(lang).po such as esd-cs.po, and edit it in your favourite PO | |
31 | # editor (such as poedit, or emacs with po-mode). | |
32 | ||
33 | # If you already have an old translation you can convert it to PO | |
34 | # files as described bellow. | |
35 | esd-temp.pot: $(foreach f,$(SRC),en/$f) | |
36 | po4a-gettextize $(PO4A_FLAGS) $(foreach f,$+,-m $f) -p $@ | |
37 | ||
38 | ############################################################ | |
39 | # Convert existing translations into PO files. | |
40 | ||
41 | # NOTE: You need to make sure that your translated document is formaly | |
42 | # correct xhtml (there might be accidental mistakes). | |
43 | # Validate your document to find errors (e.g. https://validator.w3.org) | |
44 | ||
45 | # IMPORTANT: when you generate the PO files from the existing | |
46 | # translation, the original files in the version *corresponding* to | |
47 | # the translation have to be provided as a command line argument (with | |
48 | # parameter -m). | |
49 | ||
50 | # for that specify the directory where the original files are placed | |
51 | DIR=en | |
52 | # and the list of files that were translated within the corresponding | |
53 | # version | |
54 | FILES=$(SRC) | |
55 | ||
56 | # The generation of the PO file is likely to go wrong, because of the | |
57 | # mistakes which were introduced by the direct translation of the html | |
58 | # files. In this case the po4a gives quite good error message with a | |
59 | # reference in which file and line number to look at to find the | |
60 | # mistake. Go to that file and try to correct the errors and then | |
61 | # repeat the procedure. | |
62 | ||
63 | # Don't give it up translating PO files is nicer. | |
64 | ||
65 | # For more details and troubleshooting see: | |
66 | # http://dev.man-online.org/man7/po4a/ | |
67 | # in section: HOWTO convert a pre-existing translation to po4a? | |
68 | esd-%.po.extract: $(foreach d,$(DIR) %,$(foreach f,$(FILES),$d/$f)) | |
69 | po4a-gettextize $(PO4A_FLAGS) $(foreach f,$(FILES),-m $(DIR)/$f) $(foreach f,$(FILES),-l $*/$f) -p $@ | |
70 | cp $@ `basename -s .extract $@` | |
71 | ||
72 | ############################################################ | |
73 | # update the PO translation after the original has changed. This will | |
74 | # make a new PO file automaticaly reusing identical translations, but | |
75 | # the strings will be made fuzzy and need to verified manualy. Strings | |
76 | # that changed need to be translated again. | |
77 | esd-%.po.update: esd-%.po $(foreach f,$(SRC),en/$f) | |
78 | cp $< $@ | |
79 | po4a-updatepo $(PO4A_FLAGS) $(foreach f,$(SRC),-m en/$f) -p $@ | |
80 | cp $@ $< |