build: use translation tools from pkg/lib

Use the html2po and manifest2po tools that we already check out from
cockpit repo pkg/lib.

These tools switched to a new argument parser library (`argparse`) in
cockpit-project/cockpit#16271, so add it to our package.json and drop
`stdio`.

Drop our old copies.

I checked the result of building `po/starter-kit.pot` before and after
the change, and aside from the timestamp, it's identical.

Cherry-picked from cockpit-podman commit bf53f801b17ba6.
This commit is contained in:
Martin Pitt 2022-06-30 07:27:35 +02:00 committed by Martin Pitt
parent e38a1c3906
commit ebe52bcdb7
4 changed files with 6 additions and 463 deletions

View file

@ -55,13 +55,13 @@ po/$(PACKAGE_NAME).js.pot:
--keyword=gettext:1,1t --keyword=gettext:1c,2,2t \
--keyword=ngettext:1,2,3t --keyword=ngettext:1c,2,3,4t \
--keyword=gettextCatalog.getString:1,3c --keyword=gettextCatalog.getPlural:2,3,4c \
--from-code=UTF-8 $$(find src/ \( -name '*.js' -o -name '*.jsx' \))
--from-code=UTF-8 $$(find src/ -name '*.js' -o -name '*.jsx')
po/$(PACKAGE_NAME).html.pot: $(NODE_MODULES_TEST)
po/html2po -o $@ $$(find src -name '*.html')
po/$(PACKAGE_NAME).html.pot: $(NODE_MODULES_TEST) $(COCKPIT_REPO_STAMP)
pkg/lib/html2po -o $@ $$(find src -name '*.html')
po/$(PACKAGE_NAME).manifest.pot: $(NODE_MODULES_TEST)
po/manifest2po src/manifest.json -o $@
po/$(PACKAGE_NAME).manifest.pot: $(NODE_MODULES_TEST) $(COCKPIT_REPO_STAMP)
pkg/lib/manifest2po src/manifest.json -o $@
po/$(PACKAGE_NAME).metainfo.pot: $(APPSTREAMFILE)
xgettext --default-domain=$(PACKAGE_NAME) --output=$@ $<