4 POTLIST=$(shell ls -d po/*)
5 DTDDIR=../../Open-ILS/web/opac/locale
6 CHROME_PROPSDIR=../../Open-ILS/xul/staff_client/chrome/locale
7 SERVER_PROPSDIR=../../Open-ILS/xul/staff_client/server/locale
8 DOJO_LOCALE := $(shell echo ${LOCALE} | tr '[:upper:]-' '[:lower:]/')
9 DOJO_CON_SRC=../../Open-ILS/web/js/dojo/openils/conify/nls
10 DOJO_OPAC_SRC=../../Open-ILS/web/js/dojo/openils/opac/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.dtd.pot
15 FMIDLENTITY=fm_IDL.dtd
16 EVTSRC=../../Open-ILS/src/extras/ils_events.xml
17 EVTOUT=ils_events.xml.pot
18 EVTPO=ils_events.xml.po
20 REPORTDIR=../../Open-ILS/web/reports/
21 SQLSRCDIR=../../Open-ILS/src/sql/Pg/
22 SQLSRCFILE=950.data.seed-values.sql
25 SQLOUT=950.data.seed-values
26 PROGRESS=--progress none
28 # This Makefile can be used to generate and update PO files for Evergreen,
29 # as well as generate updated SQL, fieldmapper IDL, DTD and JavaScript
30 # property files from the PO.
34 # To create a new set of untranslated PO files for locale ll-LL:
35 # make LOCALE=ll-LL newpo
37 # To create a new set of POT files from the en-US source:
38 # make LOCALE=ll-LL newpot
40 # To update a set of translated PO files with new or changed en-US strings:
41 # make LOCALE=ll-LL updatepo
43 # To create a set of translated project files (DTDs, JavaScript message catalogs):
44 # make LOCALE=ll-LL project
46 # To install a set of translated project files:
47 # make LOCALE=ll-LL install
49 # Generate PO files from all POT files in PO for locale LOCALE
51 # The template for the standard GNU gettext format is
52 # template1/template1.pot
54 # template2/template2.pot
57 # So, iterate over the list of POT directories and
58 # generate / update the specified locale PO file
60 @pot2po $(PROGRESS) -i po/admin.properties/admin.properties.pot -o $(PO)/admin.properties/$(LOCALE).po
61 @pot2po $(PROGRESS) -i po/auth.properties/auth.properties.pot -o $(PO)/auth.properties/$(LOCALE).po
62 @pot2po $(PROGRESS) -i po/cat.properties/cat.properties.pot -o $(PO)/cat.properties/$(LOCALE).po
63 @pot2po $(PROGRESS) -i po/circ.properties/circ.properties.pot -o $(PO)/circ.properties/$(LOCALE).po
64 @pot2po $(PROGRESS) -i po/common.properties/common.properties.pot -o $(PO)/common.properties/$(LOCALE).po
65 @pot2po $(PROGRESS) -i po/conify.dtd/conify.dtd.pot -o $(PO)/conify.dtd/$(LOCALE).po
66 @pot2po $(PROGRESS) -i po/conify.js/conify.js.pot -o $(PO)/conify.js/$(LOCALE).po
67 @pot2po $(PROGRESS) -i po/db.seed/db.seed.pot -o $(PO)/db.seed/$(LOCALE).po
68 @pot2po $(PROGRESS) -i po/fm_IDL.dtd/fm_IDL.dtd.pot -o $(PO)/fm_IDL.dtd/$(LOCALE).po
69 @pot2po $(PROGRESS) -i po/ils_events.xml/ils_events.xml.pot -o $(PO)/ils_events.xml/$(LOCALE).po
70 @pot2po $(PROGRESS) -i po/lang.dtd/lang.dtd.pot -o $(PO)/lang.dtd/$(LOCALE).po
71 @pot2po $(PROGRESS) -i po/multiclass_search_help.html/multiclass_search_help.html.pot -o $(PO)/multiclass_search_help.html/$(LOCALE).po
72 @pot2po $(PROGRESS) -i po/offline.properties/offline.properties.pot -o $(PO)/offline.properties/$(LOCALE).po
73 @pot2po $(PROGRESS) -i po/opac.dtd/opac.dtd.pot -o $(PO)/opac.dtd/$(LOCALE).po
74 @pot2po $(PROGRESS) -i po/opac.js/opac.js.pot -o $(PO)/opac.js/$(LOCALE).po
75 @pot2po $(PROGRESS) -i po/patron.properties/patron.properties.pot -o $(PO)/patron.properties/$(LOCALE).po
76 @pot2po $(PROGRESS) -i po/reports.dtd/reports.dtd.pot -o $(PO)/reports.dtd/$(LOCALE).po
77 @pot2po $(PROGRESS) -i po/reports.js/reports.js.pot -o $(PO)/reports.js/$(LOCALE).po
78 @pot2po $(PROGRESS) -i po/vandelay.dtd/vandelay.dtd.pot -o $(PO)/vandelay.dtd/$(LOCALE).po
79 @echo "Generated new PO files for locale $(LOCALE)"
81 # Generate a new set of POT files and entityized fieldmapper IDL
82 newpot: dtds2pot fmidl2pot fmidl2fmidlent ils2pot props2pot sql2pot dojo2pot
83 @echo "Generated new POT files"
85 # Generate DTD, JavaScript message catalogs, fieldmapper IDL,
86 # and SQL insert files from PO for locale LOCALE
87 project: po2dtds po2props po2sql fmidlpo2entity po2ils po2dojo
88 @echo "Generated project files for locale $(LOCALE)"
90 # Update PO files with new and changed strings from POT files
92 @pot2po $(PROGRESS) -i po/admin.properties/admin.properties.pot -o $(PO)/admin.properties/$(LOCALE).po -t $(PO)/admin.properties/$(LOCALE).po
93 @pot2po $(PROGRESS) -i po/auth.properties/auth.properties.pot -o $(PO)/auth.properties/$(LOCALE).po -t $(PO)/auth.properties/$(LOCALE).po
94 @pot2po $(PROGRESS) -i po/cat.properties/cat.properties.pot -o $(PO)/cat.properties/$(LOCALE).po -t $(PO)/cat.properties/$(LOCALE).po
95 @pot2po $(PROGRESS) -i po/circ.properties/circ.properties.pot -o $(PO)/circ.properties/$(LOCALE).po -t $(PO)/circ.properties/$(LOCALE).po
96 @pot2po $(PROGRESS) -i po/common.properties/common.properties.pot -o $(PO)/common.properties/$(LOCALE).po -t $(PO)/common.properties/$(LOCALE).po
97 @pot2po $(PROGRESS) -i po/conify.dtd/conify.dtd.pot -o $(PO)/conify.dtd/$(LOCALE).po -t $(PO)/conify.dtd/$(LOCALE).po
98 @pot2po $(PROGRESS) -i po/conify.js/conify.js.pot -o $(PO)/conify.js/$(LOCALE).po -t $(PO)/conify.js/$(LOCALE).po
99 @pot2po $(PROGRESS) -i po/db.seed/db.seed.pot -o $(PO)/db.seed/$(LOCALE).po -t $(PO)/db.seed/$(LOCALE).po
100 @pot2po $(PROGRESS) -i po/fm_IDL/fm_IDL.pot -o $(PO)/fm_IDL/$(LOCALE).po -t $(PO)/fm_IDL/$(LOCALE).po
101 @pot2po $(PROGRESS) -i po/fm_IDL.dtd/fm_IDL.dtd.pot -o $(PO)/fm_IDL.dtd/$(LOCALE).po -t $(PO)/fm_IDL.dtd/$(LOCALE).po
102 @pot2po $(PROGRESS) -i po/ils_events.xml/ils_events.xml.pot -o $(PO)/ils_events.xml/$(LOCALE).po -t $(PO)/ils_events.xml/$(LOCALE).po
103 @pot2po $(PROGRESS) -i po/lang.dtd/lang.dtd.pot -o $(PO)/lang.dtd/$(LOCALE).po -t $(PO)/lang.dtd/$(LOCALE).po
104 @pot2po $(PROGRESS) -i po/multiclass_search_help.html/multiclass_search_help.html.pot -o $(PO)/multiclass_search_help.html/$(LOCALE).po -t $(PO)/multiclass_search_help.html/$(LOCALE).po
105 @pot2po $(PROGRESS) -i po/offline.properties/offline.properties.pot -o $(PO)/offline.properties/$(LOCALE).po -t $(PO)/offline.properties/$(LOCALE).po
106 @pot2po $(PROGRESS) -i po/opac.dtd/opac.dtd.pot -o $(PO)/opac.dtd/$(LOCALE).po -t $(PO)/opac.dtd/$(LOCALE).po
107 @pot2po $(PROGRESS) -i po/opac.js/opac.js.pot -o $(PO)/opac.js/$(LOCALE).po -t $(PO)/opac.js/$(LOCALE).po
108 @pot2po $(PROGRESS) -i po/patron.properties/patron.properties.pot -o $(PO)/patron.properties/$(LOCALE).po -t $(PO)/patron.properties/$(LOCALE).po
109 @pot2po $(PROGRESS) -i po/reports.dtd/reports.dtd.pot -o $(PO)/reports.dtd/$(LOCALE).po -t $(PO)/reports.dtd/$(LOCALE).po
110 @pot2po $(PROGRESS) -i po/reports.js/reports.js.pot -o $(PO)/reports.js/$(LOCALE).po -t $(PO)/reports.js/$(LOCALE).po
111 @pot2po $(PROGRESS) -i po/vandelay.dtd/vandelay.dtd.pot -o $(PO)/vandelay.dtd/$(LOCALE).po -t $(PO)/vandelay.dtd/$(LOCALE).po
112 @echo "Updated PO files for locale $(LOCALE)"
115 @moz2po -P $(PROGRESS) -o $(PO)/conify.dtd/conify.dtd.pot -i $(DTDDIR)/en-US/conify.dtd 2>&1
116 @moz2po -P $(PROGRESS) -o $(PO)/lang.dtd/lang.dtd.pot -i $(DTDDIR)/en-US/lang.dtd 2>&1
117 @moz2po -P $(PROGRESS) -o $(PO)/opac.dtd/opac.dtd.pot -i $(DTDDIR)/en-US/opac.dtd 2>&1
118 @moz2po -P $(PROGRESS) -o $(PO)/reports.dtd/reports.dtd.pot -i $(DTDDIR)/en-US/reports.dtd 2>&1
119 @moz2po -P $(PROGRESS) -o $(PO)/vandelay.dtd/vandelay.dtd.pot -i $(DTDDIR)/en-US/vandelay.dtd 2>&1
122 @scripts/dojo_resource.py --pot $(DOJO_CON_SRC)/conify.js --output $(PO)/conify.js/conify.js.pot
123 @scripts/dojo_resource.py --pot $(DOJO_OPAC_SRC)/opac.js --output $(PO)/opac.js/opac.js.pot
124 @scripts/dojo_resource.py --pot $(DOJO_RPT_SRC)/reports.js --output $(PO)/reports.js/reports.js.pot
127 @mkdir -p locale/$(LOCALE)
128 @scripts/dojo_resource.py --create $(PO)/conify.js/$(LOCALE).po --output $(PROJECT)/$(LOCALE)/conify.js
129 @scripts/dojo_resource.py --create $(PO)/opac.js/$(LOCALE).po --output $(PROJECT)/$(LOCALE)/opac.js
130 @scripts/dojo_resource.py --create $(PO)/reports.js/$(LOCALE).po --output $(PROJECT)/$(LOCALE)/reports.js
133 @scripts/ils_events.py --pot $(EVTSRC) --output $(PO)/ils_events.xml/$(EVTOUT)
136 @mkdir -p locale/$(LOCALE)
137 @scripts/ils_events.py --create $(PO)/ils_events.xml/$(LOCALE).po --locale $(LOCALE) --output $(PROJECT)/$(LOCALE)/$(EVTXML)
140 @mkdir -p locale/$(LOCALE)
141 @moz2po -P $(PROGRESS) -o $(PO)/auth.properties/auth.properties.pot -i $(CHROME_PROPSDIR)/en-US/auth.properties 2>&1
142 @moz2po -P $(PROGRESS) -o $(PO)/offline.properties/offline.properties.pot -i $(CHROME_PROPSDIR)/en-US/offline.properties 2>&1
143 @moz2po -P $(PROGRESS) -o $(PO)/admin.properties/admin.properties.pot -i $(SERVER_PROPSDIR)/en-US/admin.properties 2>&1
144 @moz2po -P $(PROGRESS) -o $(PO)/cat.properties/cat.properties.pot -i $(SERVER_PROPSDIR)/en-US/cat.properties 2>&1
145 @moz2po -P $(PROGRESS) -o $(PO)/circ.properties/circ.properties.pot -i $(SERVER_PROPSDIR)/en-US/circ.properties 2>&1
146 @moz2po -P $(PROGRESS) -o $(PO)/common.properties/common.properties.pot -i $(SERVER_PROPSDIR)/en-US/common.properties 2>&1
147 @moz2po -P $(PROGRESS) -o $(PO)/multiclass_search_help.html/multiclass_search_help.html.pot -i $(SERVER_PROPSDIR)/en-US/multiclass_search_help.html 2>&1
148 @moz2po -P $(PROGRESS) -o $(PO)/patron.properties/patron.properties.pot -i $(SERVER_PROPSDIR)/en-US/patron.properties 2>&1
151 @mkdir -p locale/$(LOCALE)
152 @po2moz $(PROGRESS) -i $(PO)/conify.dtd/$(LOCALE).po -o $(PROJECT)/$(LOCALE)/conify.dtd -t $(DTDDIR)/en-US/conify.dtd 2>&1
153 @po2moz $(PROGRESS) -i $(PO)/lang.dtd/$(LOCALE).po -o $(PROJECT)/$(LOCALE)/lang.dtd -t $(DTDDIR)/en-US/lang.dtd 2>&1
154 @po2moz $(PROGRESS) -i $(PO)/opac.dtd/$(LOCALE).po -o $(PROJECT)/$(LOCALE)/opac.dtd -t $(DTDDIR)/en-US/opac.dtd 2>&1
155 @po2moz $(PROGRESS) -i $(PO)/reports.dtd/$(LOCALE).po -o $(PROJECT)/$(LOCALE)/reports.dtd -t $(DTDDIR)/en-US/reports.dtd 2>&1
156 @po2moz $(PROGRESS) -i $(PO)/vandelay.dtd/$(LOCALE).po -o $(PROJECT)/$(LOCALE)/vandelay.dtd -t $(DTDDIR)/en-US/vandelay.dtd 2>&1
159 @po2moz $(PROGRESS) -i $(PO)/auth.properties/$(LOCALE).po -o $(PROJECT)/$(LOCALE)/auth.properties -t $(CHROME_PROPSDIR)/en-US/auth.properties 2>&1
160 @po2moz $(PROGRESS) -i $(PO)/offline.properties/$(LOCALE).po -o $(PROJECT)/$(LOCALE)/offline.properties -t $(CHROME_PROPSDIR)/en-US/offline.properties 2>&1
161 @po2moz $(PROGRESS) -i $(PO)/admin.properties/$(LOCALE).po -o $(PROJECT)/$(LOCALE)/admin.properties -t $(SERVER_PROPSDIR)/en-US/admin.properties 2>&1
162 @po2moz $(PROGRESS) -i $(PO)/cat.properties/$(LOCALE).po -o $(PROJECT)/$(LOCALE)/cat.properties -t $(SERVER_PROPSDIR)/en-US/cat.properties 2>&1
163 @po2moz $(PROGRESS) -i $(PO)/circ.properties/$(LOCALE).po -o $(PROJECT)/$(LOCALE)/circ.properties -t $(SERVER_PROPSDIR)/en-US/circ.properties 2>&1
164 @po2moz $(PROGRESS) -i $(PO)/common.properties/$(LOCALE).po -o $(PROJECT)/$(LOCALE)/common.properties -t $(SERVER_PROPSDIR)/en-US/common.properties 2>&1
165 @po2moz $(PROGRESS) -i $(PO)/multiclass_search_help.html/$(LOCALE).po -o $(PROJECT)/$(LOCALE)/multiclass_search_help.html -t $(SERVER_PROPSDIR)/en-US/multiclass_search_help.html 2>&1
166 @po2moz $(PROGRESS) -i $(PO)/patron.properties/$(LOCALE).po -o $(PROJECT)/$(LOCALE)/patron.properties -t $(SERVER_PROPSDIR)/en-US/patron.properties 2>&1
169 @scripts/db-seed-i18n.py --pot $(SQLSRCDIR)/$(SQLSRCFILE) --output $(PO)/db.seed/$(SQLPOT)
170 # @msghack --empty -o $(PO)/$(SQLPOT) $(PO)/$(SQLPOT)
173 @mkdir -p locale/$(LOCALE)
174 @scripts/db-seed-i18n.py --sql $(PO)/db.seed/$(LOCALE).po --locale $(LOCALE) --output $(PROJECT)/$(LOCALE)/$(SQLOUT).sql
176 # Generate a fieldmapper IDL file that uses entities instead of hard-coded strings
178 @scripts/fieldmapper.py --convert $(FMIDLSRC) --output $(PO)/$(FMIDLENT)
180 # Generate a POT file for translating the entity values
182 @scripts/fieldmapper.py --pot $(FMIDLSRC) --output $(PO)/fm_IDL.dtd/$(FMIDLOUT)
184 # Generate a set of entity declarations from a PO file
186 @mkdir -p locale/$(LOCALE)
187 @scripts/fieldmapper.py --entity $(PO)/fm_IDL.dtd/$(LOCALE).po --output $(PROJECT)/$(LOCALE)/$(FMIDLENTITY)
189 # Generate en-US DTD from a POT file; required if any other locale is installed
191 mkdir -p $(PROJECT)/en-US
192 @scripts/fieldmapper.py --entity $(PO)/fm_IDL.dtd/$(FMIDLOUT) --output $(PROJECT)/en-US/$(FMIDLENTITY)
193 cp $(PROJECT)/en-US/$(FMIDLENTITY) $(DTDDIR)/en-US/
195 # Install updated project files to their corresponding location in the source tree
196 install: updatepo project fmidl2fmidlent fmidlpo2entity-en
197 mkdir -p $(CHROME_PROPSDIR)/$(LOCALE)
198 cp $(PROJECT)/$(LOCALE)/auth.properties $(CHROME_PROPSDIR)/$(LOCALE)/.
199 cp $(PROJECT)/$(LOCALE)/offline.properties $(CHROME_PROPSDIR)/$(LOCALE)/.
200 mkdir -p $(SERVER_PROPSDIR)/$(LOCALE)
201 cp $(PROJECT)/$(LOCALE)/admin.properties $(SERVER_PROPSDIR)/$(LOCALE)/.
202 cp $(PROJECT)/$(LOCALE)/cat.properties $(SERVER_PROPSDIR)/$(LOCALE)/.
203 cp $(PROJECT)/$(LOCALE)/circ.properties $(SERVER_PROPSDIR)/$(LOCALE)/.
204 cp $(PROJECT)/$(LOCALE)/common.properties $(SERVER_PROPSDIR)/$(LOCALE)/.
205 cp $(PROJECT)/$(LOCALE)/multiclass_search_help.html $(SERVER_PROPSDIR)/$(LOCALE)/.
206 cp $(PROJECT)/$(LOCALE)/patron.properties $(SERVER_PROPSDIR)/$(LOCALE)/.
207 mkdir -p $(DTDDIR)/$(LOCALE)
208 cp $(PROJECT)/$(LOCALE)/conify.dtd $(DTDDIR)/$(LOCALE)/
209 cp $(PROJECT)/$(LOCALE)/lang.dtd $(CHROME_PROPSDIR)/$(LOCALE)/
210 cp $(PROJECT)/$(LOCALE)/lang.dtd $(DTDDIR)/$(LOCALE)/
211 cp $(PROJECT)/$(LOCALE)/opac.dtd $(DTDDIR)/$(LOCALE)/
212 cp $(PROJECT)/$(LOCALE)/reports.dtd $(DTDDIR)/$(LOCALE)/
213 cp $(PROJECT)/$(LOCALE)/vandelay.dtd $(DTDDIR)/$(LOCALE)/
214 cp $(PROJECT)/$(LOCALE)/$(FMIDLENTITY) $(DTDDIR)/$(LOCALE)/
215 @scripts/merge_ils_events.py --master $(EVTSRC) --localization $(PROJECT)/$(LOCALE)/$(EVTXML) --output $(EVTSRC)
216 cp $(PROJECT)/$(LOCALE)/$(SQLOUT).sql $(SQLSRCDIR)/$(SQLOUT)-$(LOCALE).sql
217 cp $(PO)/$(FMIDLENT) $(REPORTDIR)/$(FMIDLENT)
218 mkdir -p $(DOJO_CON_SRC)/$(DOJO_LOCALE)
219 cp $(PROJECT)/$(LOCALE)/conify.js $(DOJO_CON_SRC)/$(DOJO_LOCALE)/conify.js
220 mkdir -p $(DOJO_OPAC_SRC)/$(DOJO_LOCALE)
221 cp $(PROJECT)/$(LOCALE)/opac.js $(DOJO_OPAC_SRC)/$(DOJO_LOCALE)/opac.js
222 mkdir -p $(DOJO_RPT_SRC)/$(DOJO_LOCALE)
223 cp $(PROJECT)/$(LOCALE)/reports.js $(DOJO_RPT_SRC)/$(DOJO_LOCALE)/reports.js