]> git.proxmox.com Git - proxmox-i18n.git/blame - Makefile
po2js: generate modern JavaScript
[proxmox-i18n.git] / Makefile
CommitLineData
5c0bd157 1include /usr/share/dpkg/pkg-info.mk
3f7b1143 2
1524e1af
TL
3LINGUAS=\
4 ar \
5 ca \
6 da \
7 de \
8 es \
9 eu \
10 fa \
11 fr \
12 gl \
13 he \
14 hu \
15 it \
16 ja \
17 kr \
18 nb \
19 nl \
20 nn \
21 pl \
22 pt_BR \
23 ru \
24 sl \
25 sv \
26 tr \
27 zh_CN \
28 zh_TW \
3f7b1143 29
3539b194
TL
30BUILDDIR ?= ${DEB_SOURCE}-${DEB_VERSION}
31
0de4c3ca
TL
32PVE_I18N_DEB=pve-i18n_${DEB_VERSION}_all.deb
33PMG_I18N_DEB=pmg-i18n_${DEB_VERSION}_all.deb
34PBS_I18N_DEB=pbs-i18n_${DEB_VERSION}_all.deb
3f7b1143 35
31f04d6b 36DEBS=${PMG_I18N_DEB} $(PVE_I18N_DEB) $(PBS_I18N_DEB)
3f7b1143
DM
37
38PMGLOCALEDIR=${DESTDIR}/usr/share/pmg-i18n
39PVELOCALEDIR=${DESTDIR}/usr/share/pve-i18n
31f04d6b 40PBSLOCALEDIR=${DESTDIR}/usr/share/pbs-i18n
3f7b1143
DM
41
42PMG_LANG_FILES=$(patsubst %, pmg-lang-%.js, $(LINGUAS))
43PVE_LANG_FILES=$(patsubst %, pve-lang-%.js, $(LINGUAS))
31f04d6b 44PBS_LANG_FILES=$(patsubst %, pbs-lang-%.js, $(LINGUAS))
3f7b1143 45
ee60f2d8 46all:
3f7b1143 47
3539b194
TL
48$(BUILDDIR): submodule
49 rm -rf $@ $@.tmp
50 rsync -a * $@.tmp
51 mv $@.tmp $@
52
3f7b1143
DM
53.PHONY: deb
54deb: $(DEBS)
3539b194
TL
55$(DEBS): build-debs
56
57build-debs: $(BUILDDIR)
58 cd $(BUILDDIR); dpkg-buildpackage -b -us -uc
ee60f2d8 59 lintian $(DEBS)
3539b194 60 touch "$@"
3f7b1143 61
42d82cd2 62submodule:
26220b7e
TL
63 test -f pmg-gui/Makefile -a -f proxmox-backup/Makefile -a -f pve-manager/Makefile \
64 || git submodule update --init
42d82cd2 65
3f7b1143 66.PHONY: install
31f04d6b 67install: ${PMG_LANG_FILES} ${PVE_LANG_FILES} ${PBS_LANG_FILES}
3f7b1143
DM
68 install -d ${PMGLOCALEDIR}
69 install -m 0644 ${PMG_LANG_FILES} ${PMGLOCALEDIR}
70 install -d ${PVELOCALEDIR}
71 install -m 0644 ${PVE_LANG_FILES} ${PVELOCALEDIR}
31f04d6b
TL
72 install -d ${PBSLOCALEDIR}
73 install -m 0644 ${PBS_LANG_FILES} ${PBSLOCALEDIR}
3f7b1143 74
c1ae7daa 75pmg-lang-%.js: %.po
0de4c3ca 76 ./po2js.pl -t pmg -v "${DEB_VERSION}" -o pmg-lang-$*.js $?
3f7b1143 77
c1ae7daa 78pve-lang-%.js: %.po
0de4c3ca 79 ./po2js.pl -t pve -v "${DEB_VERSION}" -o pve-lang-$*.js $?
c1ae7daa 80
31f04d6b 81pbs-lang-%.js: %.po
0de4c3ca 82 ./po2js.pl -t pbs -v "${DEB_VERSION}" -o pbs-lang-$*.js $?
31f04d6b 83
c1ae7daa
DC
84# parameter 1 is the name
85# parameter 2 is the directory
86define potupdate
87 ./jsgettext.pl -p "$(1) $(shell cd $(2);git rev-parse HEAD)" -o $(1).pot $(2)
88endef
3f7b1143 89
910254e8 90.PHONY: update update_pot do_update
ee60f2d8 91update_pot: submodule
c1ae7daa
DC
92 $(call potupdate,proxmox-widget-toolkit,proxmox-widget-toolkit/)
93 $(call potupdate,pve-manager,pve-manager/www/manager6/)
94 $(call potupdate,proxmox-mailgateway,pmg-gui/js/)
31f04d6b 95 $(call potupdate,proxmox-backup,proxmox-backup/www/)
ee60f2d8 96
910254e8
TL
97do_update:
98 $(MAKE) update_pot
99 $(MAKE) messages.pot
c1ae7daa 100 for i in $(LINGUAS); do echo -n "$$i: "; msgmerge -s -v $$i.po messages.pot >$$i.po.tmp && mv $$i.po.tmp $$i.po; done;
3f7b1143 101
910254e8
TL
102update:
103 git submodule foreach 'git pull --ff-only origin master'
104 $(MAKE) do_update
105
16b20080
RV
106stats:
107 @for i in $(LINGUAS); do echo -n "$$i: "; msgfmt --statistics -o /dev/null $$i.po; done
108
ee60f2d8
TL
109init-%.po: messages.pot
110 msginit -i $^ -l $^ -o $*.po --no-translator
111
112.INTERMEDIATE: messages.pot
31f04d6b 113messages.pot: proxmox-widget-toolkit.pot proxmox-mailgateway.pot pve-manager.pot proxmox-backup.pot
ee60f2d8 114 msgcat $^ > $@
cbc629ce
DM
115
116.PHONY: distclean
117distclean: clean
118
3f7b1143
DM
119.PHONY: clean
120clean:
121 find . -name '*~' -exec rm {} ';'
3539b194 122 rm -rf $(DEB_SOURCE)-[0-9]*/ *.po.tmp *.js.tmp *.deb *.buildinfo *.changes *.js messages.pot
cbc629ce 123
0a877479 124.PHONY: upload-pve upload-pmg upload-pbs upload
86f072ca 125upload-%: UPLOAD_DIST ?= $(DEB_DISTRIBUTION)
cbc629ce 126upload-pve: ${PVE_I18N_DEB}
86f072ca 127 tar cf - $^|ssh -X repoman@repo.proxmox.com -- upload --product pve --dist $(UPLOAD_DIST)
cbc629ce 128upload-pmg: ${PMG_I18N_DEB}
86f072ca 129 tar cf - $^|ssh -X repoman@repo.proxmox.com -- upload --product pmg --dist $(UPLOAD_DIST)
31f04d6b 130upload-pbs: ${PBS_I18N_DEB}
86f072ca 131 tar cf - $^|ssh -X repoman@repo.proxmox.com -- upload --product pbs --dist $(UPLOAD_DIST)
0a877479
TL
132
133upload: upload-pve upload-pmg upload-pbs