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