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
17 EVTSRC=../../Open-ILS/src/extras/ils_events.xml
18 EVTOUT=ils_events.xml.pot
19 EVTPO=ils_events.xml.po
21 REPORTDIR=../../Open-ILS/web/reports/
22 SQLSRCDIR=../../Open-ILS/src/sql/Pg/
23 SQLSRCFILE=950.data.seed-values.sql
26 SQLOUT=950.data.seed-values
27 PROGRESS=--progress none
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.
35 # To create a new set of untranslated PO files for locale ll-LL:
36 # make LOCALE=ll-LL newpo
38 # To create a new set of POT files from the en-US source:
39 # make LOCALE=ll-LL newpot
41 # To update a set of translated PO files with new or changed en-US strings:
42 # make LOCALE=ll-LL updatepo
44 # To create a set of translated project files (DTDs, JavaScript message catalogs):
45 # make LOCALE=ll-LL project
47 # To install a set of translated project files:
48 # make LOCALE=ll-LL install
50 # Generate PO files from all POT files in PO for locale LOCALE
52 # The template for the standard GNU gettext format is
53 # template1/template1.pot
55 # template2/template2.pot
58 # So, iterate over the list of POT directories and
59 # generate / update the specified locale PO file
61 @pot2po $(PROGRESS) -i po/admin.properties/admin.properties.pot -o $(PO)/admin.properties/$(LOCALE).po
62 @pot2po $(PROGRESS) -i po/auth.properties/auth.properties.pot -o $(PO)/auth.properties/$(LOCALE).po
63 @pot2po $(PROGRESS) -i po/cat.properties/cat.properties.pot -o $(PO)/cat.properties/$(LOCALE).po
64 @pot2po $(PROGRESS) -i po/circ.properties/circ.properties.pot -o $(PO)/circ.properties/$(LOCALE).po
65 @pot2po $(PROGRESS) -i po/common.properties/common.properties.pot -o $(PO)/common.properties/$(LOCALE).po
66 @pot2po $(PROGRESS) -i po/conify.dtd/conify.dtd.pot -o $(PO)/conify.dtd/$(LOCALE).po
67 @pot2po $(PROGRESS) -i po/conify.js/conify.js.pot -o $(PO)/conify.js/$(LOCALE).po
68 @pot2po $(PROGRESS) -i po/db.seed/db.seed.pot -o $(PO)/db.seed/$(LOCALE).po
69 @pot2po $(PROGRESS) -i po/fm_IDL/fm_IDL.pot -o $(PO)/fm_IDL/$(LOCALE).po
70 @pot2po $(PROGRESS) -i po/fm_IDL.dtd/fm_IDL.dtd.pot -o $(PO)/fm_IDL.dtd/$(LOCALE).po
71 @pot2po $(PROGRESS) -i po/ils_events.xml/ils_events.xml.pot -o $(PO)/ils_events.xml/$(LOCALE).po
72 @pot2po $(PROGRESS) -i po/lang.dtd/lang.dtd.pot -o $(PO)/lang.dtd/$(LOCALE).po
73 @pot2po $(PROGRESS) -i po/multiclass_search_help.html/multiclass_search_help.html.pot -o $(PO)/multiclass_search_help.html/$(LOCALE).po
74 @pot2po $(PROGRESS) -i po/offline.properties/offline.properties.pot -o $(PO)/offline.properties/$(LOCALE).po
75 @pot2po $(PROGRESS) -i po/opac.dtd/opac.dtd.pot -o $(PO)/opac.dtd/$(LOCALE).po
76 @pot2po $(PROGRESS) -i po/opac.js/opac.js.pot -o $(PO)/opac.js/$(LOCALE).po
77 @pot2po $(PROGRESS) -i po/patron.properties/patron.properties.pot -o $(PO)/patron.properties/$(LOCALE).po
78 @pot2po $(PROGRESS) -i po/reports.dtd/reports.dtd.pot -o $(PO)/reports.dtd/$(LOCALE).po
79 @pot2po $(PROGRESS) -i po/reports.js/reports.js.pot -o $(PO)/reports.js/$(LOCALE).po
80 @pot2po $(PROGRESS) -i po/vandelay.dtd/vandelay.dtd.pot -o $(PO)/vandelay.dtd/$(LOCALE).po
81 @echo "Generated new PO files for locale $(LOCALE)"
83 # Generate a new set of POT files and entityized fieldmapper IDL
84 newpot: dtds2pot fmidl2pot fmidl2fmidlent ils2pot props2pot sql2pot dojo2pot
85 @echo "Generated new POT files"
87 # Generate DTD, JavaScript message catalogs, fieldmapper IDL,
88 # and SQL insert files from PO for locale LOCALE
89 project: po2dtds po2props po2sql fmidlpo2entity po2ils po2dojo
90 @echo "Generated project files for locale $(LOCALE)"
92 # Update PO files with new and changed strings from POT files
94 @pot2po $(PROGRESS) -i po/admin.properties/admin.properties.pot -o $(PO)/admin.properties/$(LOCALE).po -t $(PO)/admin.properties/$(LOCALE).po
95 @pot2po $(PROGRESS) -i po/auth.properties/auth.properties.pot -o $(PO)/auth.properties/$(LOCALE).po -t $(PO)/auth.properties/$(LOCALE).po
96 @pot2po $(PROGRESS) -i po/cat.properties/cat.properties.pot -o $(PO)/cat.properties/$(LOCALE).po -t $(PO)/cat.properties/$(LOCALE).po
97 @pot2po $(PROGRESS) -i po/circ.properties/circ.properties.pot -o $(PO)/circ.properties/$(LOCALE).po -t $(PO)/circ.properties/$(LOCALE).po
98 @pot2po $(PROGRESS) -i po/common.properties/common.properties.pot -o $(PO)/common.properties/$(LOCALE).po -t $(PO)/common.properties/$(LOCALE).po
99 @pot2po $(PROGRESS) -i po/conify.dtd/conify.dtd.pot -o $(PO)/conify.dtd/$(LOCALE).po -t $(PO)/conify.dtd/$(LOCALE).po
100 @pot2po $(PROGRESS) -i po/conify.js/conify.js.pot -o $(PO)/conify.js/$(LOCALE).po -t $(PO)/conify.js/$(LOCALE).po
101 @pot2po $(PROGRESS) -i po/db.seed/db.seed.pot -o $(PO)/db.seed/$(LOCALE).po -t $(PO)/db.seed/$(LOCALE).po
102 @pot2po $(PROGRESS) -i po/fm_IDL/fm_IDL.pot -o $(PO)/fm_IDL/$(LOCALE).po -t $(PO)/fm_IDL/$(LOCALE).po
103 @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
104 @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
105 @pot2po $(PROGRESS) -i po/lang.dtd/lang.dtd.pot -o $(PO)/lang.dtd/$(LOCALE).po -t $(PO)/lang.dtd/$(LOCALE).po
106 @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
107 @pot2po $(PROGRESS) -i po/offline.properties/offline.properties.pot -o $(PO)/offline.properties/$(LOCALE).po -t $(PO)/offline.properties/$(LOCALE).po
108 @pot2po $(PROGRESS) -i po/opac.dtd/opac.dtd.pot -o $(PO)/opac.dtd/$(LOCALE).po -t $(PO)/opac.dtd/$(LOCALE).po
109 @pot2po $(PROGRESS) -i po/opac.js/opac.js.pot -o $(PO)/opac.js/$(LOCALE).po -t $(PO)/opac.js/$(LOCALE).po
110 @pot2po $(PROGRESS) -i po/patron.properties/patron.properties.pot -o $(PO)/patron.properties/$(LOCALE).po -t $(PO)/patron.properties/$(LOCALE).po
111 @pot2po $(PROGRESS) -i po/reports.dtd/reports.dtd.pot -o $(PO)/reports.dtd/$(LOCALE).po -t $(PO)/reports.dtd/$(LOCALE).po
112 @pot2po $(PROGRESS) -i po/reports.js/reports.js.pot -o $(PO)/reports.js/$(LOCALE).po -t $(PO)/reports.js/$(LOCALE).po
113 @pot2po $(PROGRESS) -i po/vandelay.dtd/vandelay.dtd.pot -o $(PO)/vandelay.dtd/$(LOCALE).po -t $(PO)/vandelay.dtd/$(LOCALE).po
114 @echo "Updated PO files for locale $(LOCALE)"
117 @moz2po -P $(PROGRESS) -o $(PO)/conify.dtd/conify.dtd.pot -i $(DTDDIR)/en-US/conify.dtd 2>&1
118 @moz2po -P $(PROGRESS) -o $(PO)/lang.dtd/lang.dtd.pot -i $(DTDDIR)/en-US/lang.dtd 2>&1
119 @moz2po -P $(PROGRESS) -o $(PO)/opac.dtd/opac.dtd.pot -i $(DTDDIR)/en-US/opac.dtd 2>&1
120 @moz2po -P $(PROGRESS) -o $(PO)/reports.dtd/reports.dtd.pot -i $(DTDDIR)/en-US/reports.dtd 2>&1
121 @moz2po -P $(PROGRESS) -o $(PO)/vandelay.dtd/vandelay.dtd.pot -i $(DTDDIR)/en-US/vandelay.dtd 2>&1
124 @scripts/dojo_resource.py --pot $(DOJO_CON_SRC)/conify.js --output $(PO)/conify.js/conify.js.pot
125 @scripts/dojo_resource.py --pot $(DOJO_OPAC_SRC)/opac.js --output $(PO)/opac.js/opac.js.pot
126 @scripts/dojo_resource.py --pot $(DOJO_RPT_SRC)/reports.js --output $(PO)/reports.js/reports.js.pot
129 @scripts/dojo_resource.py --create $(PO)/conify.js/$(LOCALE).po --output $(PROJECT)/$(LOCALE)/conify.js
130 @scripts/dojo_resource.py --create $(PO)/opac.js/$(LOCALE).po --output $(PROJECT)/$(LOCALE)/opac.js
131 @scripts/dojo_resource.py --create $(PO)/reports.js/$(LOCALE).po --output $(PROJECT)/$(LOCALE)/reports.js
134 @scripts/ils_events.py --pot $(EVTSRC) --output $(PO)/ils_events.xml/$(EVTOUT)
137 @scripts/ils_events.py --create $(PO)/ils_events.xml/$(LOCALE).po --locale $(LOCALE) --output $(PROJECT)/$(LOCALE)/$(EVTXML)
140 @moz2po -P $(PROGRESS) -o $(PO)/auth.properties/auth.properties.pot -i $(CHROME_PROPSDIR)/en-US/auth.properties 2>&1
141 @moz2po -P $(PROGRESS) -o $(PO)/offline.properties/offline.properties.pot -i $(CHROME_PROPSDIR)/en-US/offline.properties 2>&1
142 @moz2po -P $(PROGRESS) -o $(PO)/admin.properties/admin.properties.pot -i $(SERVER_PROPSDIR)/en-US/admin.properties 2>&1
143 @moz2po -P $(PROGRESS) -o $(PO)/cat.properties/cat.properties.pot -i $(SERVER_PROPSDIR)/en-US/cat.properties 2>&1
144 @moz2po -P $(PROGRESS) -o $(PO)/circ.properties/circ.properties.pot -i $(SERVER_PROPSDIR)/en-US/circ.properties 2>&1
145 @moz2po -P $(PROGRESS) -o $(PO)/common.properties/common.properties.pot -i $(SERVER_PROPSDIR)/en-US/common.properties 2>&1
146 @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
147 @moz2po -P $(PROGRESS) -o $(PO)/patron.properties/patron.properties.pot -i $(SERVER_PROPSDIR)/en-US/patron.properties 2>&1
150 @po2moz $(PROGRESS) -i $(PO)/conify.dtd/$(LOCALE).po -o $(PROJECT)/$(LOCALE)/conify.dtd -t $(DTDDIR)/en-US/conify.dtd 2>&1
151 @po2moz $(PROGRESS) -i $(PO)/lang.dtd/$(LOCALE).po -o $(PROJECT)/$(LOCALE)/lang.dtd -t $(DTDDIR)/en-US/lang.dtd 2>&1
152 @po2moz $(PROGRESS) -i $(PO)/opac.dtd/$(LOCALE).po -o $(PROJECT)/$(LOCALE)/opac.dtd -t $(DTDDIR)/en-US/opac.dtd 2>&1
153 @po2moz $(PROGRESS) -i $(PO)/reports.dtd/$(LOCALE).po -o $(PROJECT)/$(LOCALE)/reports.dtd -t $(DTDDIR)/en-US/reports.dtd 2>&1
154 @po2moz $(PROGRESS) -i $(PO)/vandelay.dtd/$(LOCALE).po -o $(PROJECT)/$(LOCALE)/vandelay.dtd -t $(DTDDIR)/en-US/vandelay.dtd 2>&1
157 @po2moz $(PROGRESS) -i $(PO)/auth.properties/$(LOCALE).po -o $(PROJECT)/$(LOCALE)/auth.properties -t $(CHROME_PROPSDIR)/en-US/auth.properties 2>&1
158 @po2moz $(PROGRESS) -i $(PO)/offline.properties/$(LOCALE).po -o $(PROJECT)/$(LOCALE)/offline.properties -t $(CHROME_PROPSDIR)/en-US/offline.properties 2>&1
159 @po2moz $(PROGRESS) -i $(PO)/admin.properties/$(LOCALE).po -o $(PROJECT)/$(LOCALE)/admin.properties -t $(SERVER_PROPSDIR)/en-US/admin.properties 2>&1
160 @po2moz $(PROGRESS) -i $(PO)/cat.properties/$(LOCALE).po -o $(PROJECT)/$(LOCALE)/cat.properties -t $(SERVER_PROPSDIR)/en-US/cat.properties 2>&1
161 @po2moz $(PROGRESS) -i $(PO)/circ.properties/$(LOCALE).po -o $(PROJECT)/$(LOCALE)/circ.properties -t $(SERVER_PROPSDIR)/en-US/circ.properties 2>&1
162 @po2moz $(PROGRESS) -i $(PO)/common.properties/$(LOCALE).po -o $(PROJECT)/$(LOCALE)/common.properties -t $(SERVER_PROPSDIR)/en-US/common.properties 2>&1
163 @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
164 @po2moz $(PROGRESS) -i $(PO)/patron.properties/$(LOCALE).po -o $(PROJECT)/$(LOCALE)/patron.properties -t $(SERVER_PROPSDIR)/en-US/patron.properties 2>&1
167 @scripts/db-seed-i18n.py --pot $(SQLSRCDIR)/$(SQLSRCFILE) --output $(PO)/db.seed/$(SQLPOT)
168 # @msghack --empty -o $(PO)/$(SQLPOT) $(PO)/$(SQLPOT)
171 @scripts/db-seed-i18n.py --sql $(PO)/db.seed/$(LOCALE).po --locale $(LOCALE) --output $(PROJECT)/$(LOCALE)/$(SQLOUT).sql
173 # Generate a fieldmapper IDL file that uses entities instead of hard-coded strings
175 @scripts/fieldmapper.py --convert $(FMIDLSRC) --output $(PO)/$(FMIDLENT)
177 # Generate a POT file for translating the entity values
179 @scripts/fieldmapper.py --pot $(FMIDLSRC) --output $(PO)/fm_IDL.dtd/$(FMIDLOUT)
181 # Generate a set of entity declarations from a PO file
183 @scripts/fieldmapper.py --entity $(PO)/fm_IDL.dtd/$(LOCALE).po --output $(PROJECT)/$(LOCALE)/$(FMIDLENTITY)
185 # Generate en-US DTD from a POT file; required if any other locale is installed
187 mkdir -p $(PROJECT)/en-US
188 @scripts/fieldmapper.py --entity $(PO)/fm_IDL.dtd/$(FMIDLOUT) --output $(PROJECT)/en-US/$(FMIDLENTITY)
189 cp $(PROJECT)/en-US/$(FMIDLENTITY) $(DTDDIR)/en-US/
191 # Install updated project files to their corresponding location in the source tree
192 install: updatepo project fmidl2fmidlent fmidlpo2entity-en
193 mkdir -p $(CHROME_PROPSDIR)/$(LOCALE)
194 cp $(PROJECT)/$(LOCALE)/auth.properties $(CHROME_PROPSDIR)/$(LOCALE)/.
195 cp $(PROJECT)/$(LOCALE)/offline.properties $(CHROME_PROPSDIR)/$(LOCALE)/.
196 mkdir -p $(SERVER_PROPSDIR)/$(LOCALE)
197 cp $(PROJECT)/$(LOCALE)/admin.properties $(SERVER_PROPSDIR)/$(LOCALE)/.
198 cp $(PROJECT)/$(LOCALE)/cat.properties $(SERVER_PROPSDIR)/$(LOCALE)/.
199 cp $(PROJECT)/$(LOCALE)/circ.properties $(SERVER_PROPSDIR)/$(LOCALE)/.
200 cp $(PROJECT)/$(LOCALE)/common.properties $(SERVER_PROPSDIR)/$(LOCALE)/.
201 cp $(PROJECT)/$(LOCALE)/multiclass_search_help.html $(SERVER_PROPSDIR)/$(LOCALE)/.
202 cp $(PROJECT)/$(LOCALE)/patron.properties $(SERVER_PROPSDIR)/$(LOCALE)/.
203 mkdir -p $(DTDDIR)/$(LOCALE)
204 cp $(PROJECT)/$(LOCALE)/conify.dtd $(DTDDIR)/$(LOCALE)/
205 cp $(PROJECT)/$(LOCALE)/lang.dtd $(CHROME_PROPSDIR)/$(LOCALE)/
206 cp $(PROJECT)/$(LOCALE)/lang.dtd $(DTDDIR)/$(LOCALE)/
207 cp $(PROJECT)/$(LOCALE)/opac.dtd $(DTDDIR)/$(LOCALE)/
208 cp $(PROJECT)/$(LOCALE)/reports.dtd $(DTDDIR)/$(LOCALE)/
209 cp $(PROJECT)/$(LOCALE)/vandelay.dtd $(DTDDIR)/$(LOCALE)/
210 cp $(PROJECT)/$(LOCALE)/$(FMIDLENTITY) $(DTDDIR)/$(LOCALE)/
211 @scripts/merge_ils_events.py --master $(EVTSRC) --localization $(PROJECT)/$(LOCALE)/$(EVTXML) --output $(EVTSRC)
212 cp $(PROJECT)/$(LOCALE)/$(SQLOUT).sql $(SQLSRCDIR)/$(SQLOUT)-$(LOCALE).sql
213 cp $(PO)/$(FMIDLENT) $(REPORTDIR)/$(FMIDLENT)
214 mkdir -p $(DOJO_CON_SRC)/$(DOJO_LOCALE)
215 cp $(PROJECT)/$(LOCALE)/conify.js $(DOJO_CON_SRC)/$(DOJO_LOCALE)/conify.js
216 mkdir -p $(DOJO_OPAC_SRC)/$(DOJO_LOCALE)
217 cp $(PROJECT)/$(LOCALE)/opac.js $(DOJO_OPAC_SRC)/$(DOJO_LOCALE)/opac.js
218 mkdir -p $(DOJO_RPT_SRC)/$(DOJO_LOCALE)
219 cp $(PROJECT)/$(LOCALE)/reports.js $(DOJO_RPT_SRC)/$(DOJO_LOCALE)/reports.js