]> git.proxmox.com Git - proxmox-i18n.git/blobdiff - Makefile
update traditional chinese translations
[proxmox-i18n.git] / Makefile
index 65127f1eff40ca0c51b441a11b0e9b6e49e0c9e7..442081fc7ba3bedaf3b416410a07c038e6eb6216 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,12 +1,13 @@
-LINGUAS=de it fr ja es sv ru tr zh_CN da ca pl sl nb nn pt_BR eu fa gl hu
+include /usr/share/dpkg/pkg-info.mk
 
-VERSION=1.0
-PKGREL=2
+LINGUAS=de it fr ja es sv ru tr zh_CN zh_TW da ca pl sl nb nn pt_BR eu fa gl hu he
 
-PVE_I18N_DEB=pve-i18n_${VERSION}-${PKGREL}_all.deb
-PMG_I18N_DEB=pmg-i18n_${VERSION}-${PKGREL}_all.deb
+PVE_I18N_DEB=pve-i18n_${DEB_VERSION_UPSTREAM_REVISION}_all.deb
+PMG_I18N_DEB=pmg-i18n_${DEB_VERSION_UPSTREAM_REVISION}_all.deb
 
-DEBS=${PMG_I18N_DEB} ${PVE_I18N_DEB}
+DEB1=${PMG_I18N_DEB}
+DEB2=$(PVE_I18N_DEB)
+DEBS=$(DEB1) $(DEB2)
 
 PMGLOCALEDIR=${DESTDIR}/usr/share/pmg-i18n
 PVELOCALEDIR=${DESTDIR}/usr/share/pve-i18n
@@ -14,25 +15,23 @@ PVELOCALEDIR=${DESTDIR}/usr/share/pve-i18n
 PMG_LANG_FILES=$(patsubst %, pmg-lang-%.js, $(LINGUAS))
 PVE_LANG_FILES=$(patsubst %, pve-lang-%.js, $(LINGUAS))
 
-all: | submodule
+all:
 
 .PHONY: deb
 deb: $(DEBS)
-$(DEBS): | submodule
+$(DEB2): $(DEB1)
+$(DEB1): | submodule
        rm -rf dest
-       mkdir dest
-       rsync -a debian dest
-       make DESTDIR=dest install 
+       rsync -a * dest
        cd dest; dpkg-buildpackage -b -us -uc
-       lintian ${PMG_I18N_DEB}
-       lintian ${PVE_I18N_DEB}
+       lintian $(DEBS)
 
 .PHONY: submodule
 submodule:
        test -f "pmg-gui/Makefile" || git submodule update --init
 
 .PHONY: install
-install: ${PMG_LANG_FILES} ${PVE_LANG_FILES} 
+install: ${PMG_LANG_FILES} ${PVE_LANG_FILES}
        install -d ${PMGLOCALEDIR}
        install -m 0644 ${PMG_LANG_FILES} ${PMGLOCALEDIR}
        install -d ${PVELOCALEDIR}
@@ -51,23 +50,25 @@ define potupdate
     ./jsgettext.pl -p "$(1) $(shell cd $(2);git rev-parse HEAD)" -o $(1).pot $(2)
 endef
 
-.PHONY: update
-update:
+.PHONY: update update_pot
+update_pot: submodule
        git submodule foreach 'git pull --ff-only origin master'
        $(call potupdate,proxmox-widget-toolkit,proxmox-widget-toolkit/)
        $(call potupdate,pve-manager,pve-manager/www/manager6/)
        $(call potupdate,proxmox-mailgateway,pmg-gui/js/)
-       msgcat proxmox-widget-toolkit.pot proxmox-mailgateway.pot pve-manager.pot > messages.pot.tmp
-       mv messages.pot.tmp messages.pot
+
+update: | update_pot messages.pot
        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;
-       rm messages.pot
 
-# try to generate po files when someone add a new language
-.SECONDARY: # do not delete generated intermediate file
-%.po: proxmox-widget-toolkit.pot proxmox-mailgateway.pot pve-manager.pot
-       msgcat $+ > $*.pot
-       msginit -i $*.pot -l $* -o $*.po
-       rm $*.pot
+stats:
+       @for i in $(LINGUAS); do echo -n "$$i: "; msgfmt --statistics -o /dev/null $$i.po; done
+
+init-%.po: messages.pot
+       msginit -i $^ -l $^ -o $*.po --no-translator
+
+.INTERMEDIATE: messages.pot
+messages.pot: proxmox-widget-toolkit.pot proxmox-mailgateway.pot pve-manager.pot
+       msgcat $^ > $@
 
 .PHONY: distclean
 distclean: clean
@@ -75,11 +76,11 @@ distclean: clean
 .PHONY: clean
 clean:
        find . -name '*~' -exec rm {} ';'
-       rm -rf dest *.po.tmp *.js.tmp *.deb *.buildinfo *.changes pve-lang-*.js pmg-lang-*.js
+       rm -rf dest *.po.tmp *.js.tmp *.deb *.buildinfo *.changes *.js messages.pot
 
 .PHONY: upload-pve
 upload-pve: ${PVE_I18N_DEB}
-       tar cf - ${PVE_I18N_DEB}|ssh -X repoman@repo.proxmox.com -- upload --product pve --dist stretch
+       tar cf - ${PVE_I18N_DEB}|ssh -X repoman@repo.proxmox.com -- upload --product pve --dist buster
 
 .PHONY: upload-pmg
 upload-pmg: ${PMG_I18N_DEB}