]> git.proxmox.com Git - proxmox-i18n.git/blob - Makefile
44e77056828ad1aea1278e680e1b9214e48ad25f
[proxmox-i18n.git] / Makefile
1 LINGUAS=de it fr ja es sv ru tr zh_CN da ca pl sl nb nn pt_BR eu fa gl hu
2
3 VERSION=1.0
4 PKGREL=2
5
6 PVE_I18N_DEB=pve-i18n_${VERSION}-${PKGREL}_all.deb
7 PMG_I18N_DEB=pmg-i18n_${VERSION}-${PKGREL}_all.deb
8
9 DEBS=${PMG_I18N_DEB} ${PVE_I18N_DEB}
10
11 PMGLOCALEDIR=${DESTDIR}/usr/share/pmg-i18n
12 PVELOCALEDIR=${DESTDIR}/usr/share/pve-i18n
13
14 PMG_LANG_FILES=$(patsubst %, pmg-lang-%.js, $(LINGUAS))
15 PVE_LANG_FILES=$(patsubst %, pve-lang-%.js, $(LINGUAS))
16
17 all: | submodule
18
19 .PHONY: deb
20 deb: $(DEBS)
21 $(DEBS): | submodule
22 rm -rf dest
23 mkdir dest
24 rsync -a debian dest
25 make DESTDIR=dest install
26 cd dest; dpkg-buildpackage -b -us -uc
27 lintian $@
28
29 .PHONY: submodule
30 submodule:
31 test -f "pmg-gui/Makefile" || git submodule update --init
32
33 .PHONY: install
34 install: ${PMG_LANG_FILES} ${PVE_LANG_FILES}
35 install -d ${PMGLOCALEDIR}
36 install -m 0644 ${PMG_LANG_FILES} ${PMGLOCALEDIR}
37 install -d ${PVELOCALEDIR}
38 install -m 0644 ${PVE_LANG_FILES} ${PVELOCALEDIR}
39
40
41 pmg-lang-%.js: %.po
42 ./po2js.pl -t pmg -v "${VERSION}-${PKGREL}" -o pmg-lang-$*.js $?
43
44 pve-lang-%.js: %.po
45 ./po2js.pl -t pve -v "${VERSION}-${PKGREL}" -o pve-lang-$*.js $?
46
47 # parameter 1 is the name
48 # parameter 2 is the directory
49 define potupdate
50 ./jsgettext.pl -p "$(1) $(shell cd $(2);git rev-parse HEAD)" -o $(1).pot $(2)
51 endef
52
53 .PHONY: update
54 update:
55 git submodule foreach 'git pull --ff-only origin master'
56 $(call potupdate,proxmox-widget-toolkit,proxmox-widget-toolkit/)
57 $(call potupdate,pve-manager,pve-manager/www/manager6/)
58 $(call potupdate,proxmox-mailgateway,pmg-gui/js/)
59 msgcat proxmox-widget-toolkit.pot proxmox-mailgateway.pot pve-manager.pot > messages.pot.tmp
60 mv messages.pot.tmp messages.pot
61 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;
62 rm messages.pot
63
64 # try to generate po files when someone add a new language
65 .SECONDARY: # do not delete generated intermediate file
66 %.po: proxmox-widget-toolkit.pot proxmox-mailgateway.pot pve-manager.pot
67 msgcat $+ > $*.pot
68 msginit -i $*.pot -l $* -o $*.po
69 rm $*.pot
70
71 .PHONY: distclean
72 distclean: clean
73
74 .PHONY: clean
75 clean:
76 find . -name '*~' -exec rm {} ';'
77 rm -rf dest *.po.tmp *.js.tmp *.deb *.buildinfo *.changes pve-lang-*.js pmg-lang-*.js
78
79 .PHONY: upload-pve
80 upload-pve: ${PVE_I18N_DEB}
81 tar cf - ${PVE_I18N_DEB}|ssh -X repoman@repo.proxmox.com -- upload --product pve --dist stretch
82
83 .PHONY: upload-pmg
84 upload-pmg: ${PMG_I18N_DEB}
85 tar cf - ${PMG_I18N_DEB}|ssh -X repoman@repo.proxmox.com -- upload --product pmg --dist stretch