]> git.evergreen-ils.org Git - Evergreen.git/blob - build/i18n/Makefile
Avoid generating duplicate msgs in Dojo POT file; avoid populating msgstr in Dojo...
[Evergreen.git] / build / i18n / Makefile
1 POTSRC=po/en-US
2 POOUTDIR=po
3 POINDIR=po
4 PROJECT=locale
5 LOCALE=fr-CA
6 DTDDIR=../../Open-ILS/web/opac/locale
7 CHROME_PROPSDIR=../../Open-ILS/xul/staff_client/chrome/locale
8 SERVER_PROPSDIR=../../Open-ILS/xul/staff_client/server/locale
9 DOJO_LOCALE := $(shell echo ${LOCALE} | tr '[:upper:]-' '[:lower:]/')
10 DOJO_CON_SRC=../../Open-ILS/web/js/dojo/openils/conify/nls
11 DOJO_RPT_SRC=../../Open-ILS/web/js/dojo/openils/reports/nls
12 FMIDLSRC=../../Open-ILS/examples/fm_IDL.xml
13 FMIDLOUT=fm_IDL.pot
14 FMIDLENT=fm_IDL.xml
15 FMIDLENTITY=fm_IDL.dtd
16 FMIDLPO=fm_IDL.po
17 EVTSRC=../../Open-ILS/src/extras/ils_events.xml
18 EVTOUT=ils_events.xml.pot
19 EVTPO=ils_events.xml.po
20 EVTXML=ils_events.xml
21 REPORTDIR=../../Open-ILS/web/reports/
22 SQLSRCDIR=../../Open-ILS/src/sql/Pg/
23 SQLSRCFILE=950.data.seed-values.sql
24 SQLPOT=db.seed.pot
25 SQLPO=db.seed.po
26 SQLOUT=950.data.seed-values
27 PROGRESS=--progress none
28
29 # This Makefile can be used to generate and update PO files for Evergreen,
30 # as well as generate updated SQL, fieldmapper IDL, DTD and JavaScript
31 # property files from the PO.
32 #
33 # Usage:
34 #
35 # To create a new set of untranslated PO files for locale ll-LL:
36 #   make LOCALE=ll-LL newpo
37 #
38 # To create a new set of POT files from the en-US source:
39 #   make LOCALE=ll-LL newpot
40 #
41 # To update a set of translated PO files with new or changed en-US strings:
42 #   make LOCALE=ll-LL updatepo
43 #
44 # To create a set of translated project files (DTDs, JavaScript message catalogs):
45 #   make LOCALE=ll-LL project
46 #
47 # To install a set of translated project files:
48 #   make LOCALE=ll-LL install
49
50 # Generate PO files from all POT files in POOUTDIR for locale LOCALE
51 newpo: 
52         @pot2po $(PROGRESS) -i $(POTSRC) -o $(POOUTDIR)/$(LOCALE) 
53         @echo "Generated new PO files for locale $(LOCALE)"
54
55 # Generate a new set of POT files and entityized fieldmapper IDL
56 newpot: dtds2pot fmidl2pot fmidl2fmidlent ils2pot props2pot sql2pot dojo2pot
57         @echo "Generated new POT files"
58
59 # Generate DTD, JavaScript message catalogs, fieldmapper IDL,
60 # and SQL insert files from PO for locale LOCALE
61 project: po2dtds po2props po2sql fmidlpo2entity po2ils po2dojo
62         @echo "Generated project files for locale $(LOCALE)"
63
64 # Update PO files with new and changed strings from POT files
65 updatepo: 
66         pot2po $(PROGRESS) -o $(POOUTDIR)/$(LOCALE) -i $(POTSRC) -t $(POOUTDIR)/$(LOCALE) 2>&1
67         @echo "Updated PO files for locale $(LOCALE)"
68
69 # Update PO files with new and changed strings from POT files
70 updateopac: 
71         @msgmerge -U $(POOUTDIR)/$(LOCALE)/opac.dtd.po $(POTSRC)/opac.dtd.pot 2>&1
72         @echo "Updated PO file opac.dtd.po for locale $(LOCALE)"
73
74 dtds2po:
75         @moz2po $(PROGRESS) -o $(POOUTDIR)/$(LOCALE) -i $(DTDDIR)/en-US/ 2>&1
76
77 props2po:
78         @moz2po $(PROGRESS) -o $(POOUTDIR)/$(LOCALE) -i $(CHROME_PROPSDIR)/en-US/ 2>&1
79         @moz2po $(PROGRESS) -o $(POOUTDIR)/$(LOCALE) -i $(SERVER_PROPSDIR)/en-US/ 2>&1
80
81 dtds2pot:
82         @moz2po -P $(PROGRESS) -o $(POTSRC) -i $(DTDDIR)/en-US/ 2>&1
83
84 dojo2pot:
85         @scripts/dojo_resource.py --pot $(DOJO_CON_SRC)/conify.js --output $(POTSRC)/conify.js.pot
86         @scripts/dojo_resource.py --pot $(DOJO_RPT_SRC)/reports.js --output $(POTSRC)/reports.js.pot
87
88 po2dojo:
89         @scripts/dojo_resource.py --create $(POINDIR)/$(LOCALE)/conify.js.po --output $(PROJECT)/$(LOCALE)/conify.js
90         @scripts/dojo_resource.py --create $(POINDIR)/$(LOCALE)/reports.js.po --output $(PROJECT)/$(LOCALE)/reports.js
91
92 ils2pot:
93         @scripts/ils_events.py --pot $(EVTSRC) --output $(POTSRC)/$(EVTOUT)
94
95 po2ils:
96         @scripts/ils_events.py --create $(POINDIR)/$(LOCALE)/$(EVTPO) --locale $(LOCALE) --output $(PROJECT)/$(LOCALE)/$(EVTXML) 
97
98 props2pot:
99         @moz2po -P $(PROGRESS) -o $(POTSRC) -i $(CHROME_PROPSDIR)/en-US/ 2>&1
100         @moz2po -P $(PROGRESS) -o $(POTSRC) -i $(SERVER_PROPSDIR)/en-US/ 2>&1
101
102 po2dtds:
103         @po2moz $(PROGRESS) -o $(PROJECT)/$(LOCALE) -t $(DTDDIR)/en-US/ -i $(POINDIR)/$(LOCALE) 2>&1
104
105 po2props:
106         @po2moz $(PROGRESS) -o $(PROJECT)/$(LOCALE) -t $(CHROME_PROPSDIR)/en-US/ -i $(POINDIR)/$(LOCALE) 2>&1
107         @po2moz $(PROGRESS) -o $(PROJECT)/$(LOCALE) -t $(SERVER_PROPSDIR)/en-US/ -i $(POINDIR)/$(LOCALE) 2>&1
108
109 sql2pot:
110         @scripts/db-seed-i18n.py --pot $(SQLSRCDIR)/$(SQLSRCFILE) --output $(POTSRC)/$(SQLPOT)
111 #       @msghack --empty -o $(POTSRC)/$(SQLPOT) $(POTSRC)/$(SQLPOT)
112
113 po2sql:
114         scripts/db-seed-i18n.py --sql $(POINDIR)/$(LOCALE)/$(SQLPO) --locale $(LOCALE) --output $(PROJECT)/$(LOCALE)/$(SQLOUT).sql
115
116 # Generate a fieldmapper IDL file that uses entities instead of hard-coded strings
117 fmidl2fmidlent:
118         @scripts/fieldmapper.py --convert $(FMIDLSRC) --output $(POOUTDIR)/$(FMIDLENT)
119
120 # Generate a POT file for translating the entity values
121 fmidl2pot:
122         @scripts/fieldmapper.py --pot $(FMIDLSRC) --output $(POTSRC)/$(FMIDLOUT)
123
124 # Generate a set of entity declarations from a PO file
125 fmidlpo2entity:
126         @scripts/fieldmapper.py --entity $(POINDIR)/$(LOCALE)/$(FMIDLPO) --output $(PROJECT)/$(LOCALE)/$(FMIDLENTITY)
127
128 # Generate en-US DTD from a POT file; required if any other locale is installed
129 fmidlpo2entity-en:
130         mkdir -p $(PROJECT)/en-US
131         @scripts/fieldmapper.py --entity $(POINDIR)/en-US/$(FMIDLOUT) --output $(PROJECT)/en-US/$(FMIDLENTITY)
132         cp $(PROJECT)/en-US/$(FMIDLENTITY) $(DTDDIR)/en-US/
133
134 # Install updated project files to their corresponding location in the source tree
135 install: updatepo project fmidl2fmidlent fmidlpo2entity-en
136         mkdir -p $(CHROME_PROPSDIR)/$(LOCALE)
137         cp $(PROJECT)/$(LOCALE)/auth.properties $(CHROME_PROPSDIR)/$(LOCALE)/.
138         cp $(PROJECT)/$(LOCALE)/offline.properties $(CHROME_PROPSDIR)/$(LOCALE)/.
139         mkdir -p $(SERVER_PROPSDIR)/$(LOCALE)
140         cp $(PROJECT)/$(LOCALE)/admin.properties $(SERVER_PROPSDIR)/$(LOCALE)/.
141         cp $(PROJECT)/$(LOCALE)/cat.properties $(SERVER_PROPSDIR)/$(LOCALE)/.
142         cp $(PROJECT)/$(LOCALE)/circ.properties $(SERVER_PROPSDIR)/$(LOCALE)/.
143         cp $(PROJECT)/$(LOCALE)/common.properties $(SERVER_PROPSDIR)/$(LOCALE)/.
144         cp $(PROJECT)/$(LOCALE)/multiclass_search_help.html $(SERVER_PROPSDIR)/$(LOCALE)/.
145         cp $(PROJECT)/$(LOCALE)/patron.properties $(SERVER_PROPSDIR)/$(LOCALE)/.
146         mkdir -p $(DTDDIR)/$(LOCALE)
147         cp $(PROJECT)/$(LOCALE)/conify.dtd $(DTDDIR)/$(LOCALE)/
148         cp $(PROJECT)/$(LOCALE)/lang.dtd $(CHROME_PROPSDIR)/$(LOCALE)/
149         cp $(PROJECT)/$(LOCALE)/lang.dtd $(DTDDIR)/$(LOCALE)/
150         cp $(PROJECT)/$(LOCALE)/opac.dtd $(DTDDIR)/$(LOCALE)/
151         cp $(PROJECT)/$(LOCALE)/vandelay.dtd $(DTDDIR)/$(LOCALE)/
152         cp $(PROJECT)/$(LOCALE)/$(FMIDLENTITY) $(DTDDIR)/$(LOCALE)/
153         @scripts/merge_ils_events.py --master $(EVTSRC) --localization $(PROJECT)/$(LOCALE)/$(EVTXML) --output $(EVTSRC)
154         cp $(PROJECT)/$(LOCALE)/$(SQLOUT).sql $(SQLSRCDIR)/$(SQLOUT)-$(LOCALE).sql
155         cp $(POOUTDIR)/$(FMIDLENT) $(REPORTDIR)/$(FMIDLENT)
156         mkdir -p $(DOJO_CON_SRC)/$(DOJO_LOCALE)
157         cp $(PROJECT)/$(LOCALE)/conify.js $(DOJO_CON_SRC)/$(DOJO_LOCALE)/conify.js
158         mkdir -p $(DOJO_RPT_SRC)/$(DOJO_LOCALE)
159         cp $(PROJECT)/$(LOCALE)/reports.js $(DOJO_RPT_SRC)/$(DOJO_LOCALE)/reports.js