The catalog-{lang}.mo files are generated only with strings that are
relevant to the proxmox-datacenter-manager instead of the whole
{lang}.po file. The msgmerge command will produce all strings containing
in the {lang}.po file but the ones that do not concern
proxmox-datacenter-manager.pot will be written without a source file,
then msgattrib will discard all those strings with --no-obsolete. We
throw a --no-fuzzy to further decrease the resulting catalog-{lang}.mo's
file size.

Signed-off-by: Maximiliano Sandoval <m.sando...@proxmox.com>
---

Differences from v2:
 - Add pdm submodules to `submodule` target
 - Rebase on top of origin/master
 - Match xgettext commands to the ones used now in master
 - Add proxmox-datacenter-manager.pot to clean target
 - Add missing bits to do_update target

Differences from v1:
 - Add dependencies to control file
 - Remove new subprojects as they have to be added manually anyways

 .gitignore                 |  1 +
 .gitmodules                |  9 ++++++++
 Makefile                   | 47 ++++++++++++++++++++++++++++++++++----
 debian/control             |  8 ++++++-
 debian/pdm-i18n.install    |  1 +
 proxmox-datacenter-manager |  1 +
 proxmox-yew-comp           |  1 +
 proxmox-yew-widget-toolkit |  1 +
 8 files changed, 64 insertions(+), 5 deletions(-)
 create mode 100644 debian/pdm-i18n.install
 create mode 160000 proxmox-datacenter-manager
 create mode 160000 proxmox-yew-comp
 create mode 160000 proxmox-yew-widget-toolkit

diff --git a/.gitignore b/.gitignore
index 96633ff..6a318aa 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,4 +7,5 @@
 /pmg-lang-*.js
 /pve-lang-*.js
 /messages.pot
+/proxmox-datacenter-manager.pot
 /build-debs
diff --git a/.gitmodules b/.gitmodules
index a81a7e3..885b6e1 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -12,3 +12,12 @@
 [submodule "proxmox-backup"]
        path = proxmox-backup
        url = ../proxmox-backup
+[submodule "proxmox-datacenter-manager"]
+       path = proxmox-datacenter-manager
+       url = ../proxmox-datacenter-manager
+[submodule "proxmox-yew-widget-toolkit"]
+       path = proxmox-yew-widget-toolkit
+       url = ../proxmox-yew-widget-toolkit
+[submodule "proxmox-yew-comp"]
+       path = proxmox-yew-comp
+       url = ../proxmox-yew-comp
diff --git a/Makefile b/Makefile
index 34859f5..5dc03f6 100644
--- a/Makefile
+++ b/Makefile
@@ -38,16 +38,19 @@ DSC=$(DEB_SOURCE)_$(DEB_VERSION_UPSTREAM_REVISION).dsc
 PVE_I18N_DEB=pve-i18n_$(DEB_VERSION)_all.deb
 PMG_I18N_DEB=pmg-i18n_$(DEB_VERSION)_all.deb
 PBS_I18N_DEB=pbs-i18n_$(DEB_VERSION)_all.deb
+PDM_I18N_DEB=pdm-i18n_$(DEB_VERSION)_all.deb
 
-DEBS=$(PMG_I18N_DEB) $(PVE_I18N_DEB) $(PBS_I18N_DEB)
+DEBS=$(PMG_I18N_DEB) $(PVE_I18N_DEB) $(PBS_I18N_DEB) $(PDM_I18N_DEB)
 
 PMGLOCALEDIR=$(DESTDIR)/usr/share/pmg-i18n
 PVELOCALEDIR=$(DESTDIR)/usr/share/pve-i18n
 PBSLOCALEDIR=$(DESTDIR)/usr/share/pbs-i18n
+PDMLOCALEDIR=$(DESTDIR)/usr/share/pdm-i18n
 
 PMG_LANG_FILES=$(patsubst %, pmg-lang-%.js, $(LINGUAS))
 PVE_LANG_FILES=$(patsubst %, pve-lang-%.js, $(LINGUAS))
 PBS_LANG_FILES=$(patsubst %, pbs-lang-%.js, $(LINGUAS))
+PDM_LANG_FILES=$(patsubst %, catalog-%.mo, $(LINGUAS))
 
 all:
 
@@ -75,17 +78,25 @@ $(DSC): $(BUILDDIR)
        lintian $(DSC)
 
 submodule:
-       test  -f pmg-gui/Makefile -a -f proxmox-backup/Makefile -a -f 
pve-manager/Makefile \
+       test  -f pmg-gui/Makefile \
+          -a -f proxmox-datacenter-manager/Makefile \
+          -a -f proxmox-backup/Makefile \
+          -a -f proxmox-yew-widget-toolkit/Makefile \
+          -a -f pve-manager/Makefile \
+          -a -f pve-manager/Makefile \
            || git submodule update --init
 
 .PHONY: install
-install: $(PMG_LANG_FILES) $(PVE_LANG_FILES) $(PBS_LANG_FILES)
+install: $(PMG_LANG_FILES) $(PVE_LANG_FILES) $(PBS_LANG_FILES) 
$(PDM_LANG_FILES)
        install -d $(PMGLOCALEDIR)
        install -m 0644 $(PMG_LANG_FILES) $(PMGLOCALEDIR)
        install -d $(PVELOCALEDIR)
        install -m 0644 $(PVE_LANG_FILES) $(PVELOCALEDIR)
        install -d $(PBSLOCALEDIR)
        install -m 0644 $(PBS_LANG_FILES) $(PBSLOCALEDIR)
+       install -d $(PDMLOCALEDIR)
+       install -m 0644 $(PDM_LANG_FILES) $(PDMLOCALEDIR)
+
 # compat symlinks for kr -> ko correction.
        ln -s pmg-lang-ko.js $(PMGLOCALEDIR)/pmg-lang-kr.js
        ln -s pve-lang-ko.js $(PVELOCALEDIR)/pve-lang-kr.js
@@ -100,6 +111,9 @@ pve-lang-%.js: %.po
 pbs-lang-%.js: %.po
        ./po2js.pl -t pbs -v "$(DEB_VERSION)" -o pbs-lang-$*.js $?
 
+catalog-%.mo: %.po
+       msgmerge $< proxmox-datacenter-manager.pot | msgattrib --no-fuzzy 
--no-obsolete | msgfmt --verbose --output-file $@ $<;
+
 # parameter 1 is the name
 # parameter 2 is the directory
 define potupdate
@@ -114,17 +128,34 @@ define potupdate
       --output="$(1)".pot
 endef
 
+# parameter 1 is the name
+# parameter 2 is the directory
+define xtrpotupdate
+     xtr \
+           --package-name "$(1)" \
+               --package-version="$(shell cd $(2);git rev-parse HEAD)" \
+        --msgid-bugs-address="<supp...@proxmox.com>" \
+               --copyright-holder="Copyright (C) Proxmox Server Solutions GmbH 
<supp...@proxmox.com> & the translation contributors." \
+               --output "$(1)".pot \
+           $(shell find . -name "*.rs" -path "./$(2)*" | sort | xargs)
+endef
+
 .PHONY: update update_pot do_update
 update_pot: submodule
        $(call potupdate,proxmox-widget-toolkit,proxmox-widget-toolkit/)
        $(call potupdate,pve-manager,pve-manager/www/manager6/)
        $(call potupdate,proxmox-mailgateway,pmg-gui/js/)
        $(call potupdate,proxmox-backup,proxmox-backup/www/)
+       $(call 
xtrpotupdate,proxmox-datacenter-manager-ui,proxmox-datacenter-manager/ui/src/)
+       $(call xtrpotupdate,proxmox-yew-comp,proxmox-yew-comp/src/)
+       $(call 
xtrpotupdate,proxmox-yew-widget-toolkit,proxmox-yew-widget-toolkit/src/)
 
 do_update:
        $(MAKE) update_pot
        $(MAKE) messages.pot
+       $(MAKE) proxmox-datacenter-manager.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;
+       for i in $(LINGUAS); do echo -n "$$i: "; msgmerge -s -v $$i.po 
proxmox-datacenter-manager.pot >$$i.po.tmp && mv $$i.po.tmp $$i.po; done;
 
 update:
        git submodule foreach 'git pull --ff-only origin master'
@@ -144,12 +175,20 @@ messages.pot: proxmox-widget-toolkit.pot 
proxmox-mailgateway.pot pve-manager.pot
       --copyright-holder="Copyright (C) Proxmox Server Solutions GmbH 
<supp...@proxmox.com> & the translation contributors." \
       --output $@
 
+.INTERMEDIATE: proxmox-datacenter-manager.pot
+proxmox-datacenter-manager.pot: proxmox-datacenter-manager-ui.pot 
proxmox-yew-comp.pot proxmox-yew-widget-toolkit.pot
+       xgettext $^ \
+    --package-name="Proxmox Datacenter Manager" \
+    --msgid-bugs-address="<supp...@proxmox.com>" \
+    --copyright-holder="Copyright (C) Proxmox Server Solutions GmbH 
<supp...@proxmox.com> & the translation contributors." \
+    --output $@
+
 .PHONY: distclean
 distclean: clean
 
 .PHONY: clean
 clean:
-       rm -rf $(DEB_SOURCE)-[0-9]*/ *.po.tmp *.js.tmp *.deb *.dsc *.tar.* 
*.build *.buildinfo *.changes *.js messages.pot
+       rm -rf $(DEB_SOURCE)-[0-9]*/ *.po.tmp *.js.tmp *.deb *.dsc *.tar.* 
*.build *.buildinfo *.changes *.js messages.pot proxmox-datacenter-manager.pot
 
 .PHONY: upload-pve upload-pmg upload-pbs upload
 upload-%: UPLOAD_DIST ?= $(DEB_DISTRIBUTION)
diff --git a/debian/control b/debian/control
index 4163074..6c2a2ad 100644
--- a/debian/control
+++ b/debian/control
@@ -2,7 +2,7 @@ Source: proxmox-i18n
 Section: perl
 Priority: optional
 Maintainer: Proxmox Support Team <supp...@proxmox.com>
-Build-Depends: debhelper-compat (= 13), gettext, libjson-perl, 
liblocale-po-perl,
+Build-Depends: debhelper-compat (= 13), gettext, libjson-perl, 
liblocale-po-perl, xtr,
 Standards-Version: 4.6.2
 Homepage: https://www.proxmox.com
 
@@ -23,3 +23,9 @@ Architecture: all
 Depends: ${misc:Depends},
 Description: Internationalization support for Proxmox VE
  This package provides the translations into all available languages.
+
+Package: pdm-i18n
+Architecture: all
+Depends: ${misc:Depends},
+Description: Internationalization support for Proxmox Datacenter Manager
+ This package provides the translations into all available languages.
diff --git a/debian/pdm-i18n.install b/debian/pdm-i18n.install
new file mode 100644
index 0000000..628332b
--- /dev/null
+++ b/debian/pdm-i18n.install
@@ -0,0 +1 @@
+/usr/share/pdm-i18n/
diff --git a/proxmox-datacenter-manager b/proxmox-datacenter-manager
new file mode 160000
index 0000000..f6ca750
--- /dev/null
+++ b/proxmox-datacenter-manager
@@ -0,0 +1 @@
+Subproject commit f6ca750d6bde7e950c3c79dca0709fece9c1c6c6
diff --git a/proxmox-yew-comp b/proxmox-yew-comp
new file mode 160000
index 0000000..3dc8a1f
--- /dev/null
+++ b/proxmox-yew-comp
@@ -0,0 +1 @@
+Subproject commit 3dc8a1faa12d7b6f1ebcf69e0303e4bbcce79869
diff --git a/proxmox-yew-widget-toolkit b/proxmox-yew-widget-toolkit
new file mode 160000
index 0000000..64b2394
--- /dev/null
+++ b/proxmox-yew-widget-toolkit
@@ -0,0 +1 @@
+Subproject commit 64b2394b7f09e8f814eac9fe47905e94158ac285
-- 
2.39.5



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to