Build translations with webpack

Convert the `po2json` script into a webpack plugin, and integrate the
(now trivial) po.empty.js template.

This is the last step for building the entire dist/ directory with
`npm run build` (i.e. a tool that web developers are familiar with),
and not having a split webpack+make toolchain any more.
This commit is contained in:
Martin Pitt 2021-01-05 14:52:59 +01:00 committed by GitHub
parent 07017f79d8
commit 7f6ef51c12
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 81 additions and 137 deletions

View file

@ -45,11 +45,6 @@ update-po: po/$(PACKAGE_NAME).pot
msgmerge --output-file=po/$$lang.po po/$$lang.po $<; \
done
dist/po.%.js: po/%.po $(NODE_MODULES_TEST)
mkdir -p $(dir $@)
po/po2json -m po/po.empty.js -o $@.js.tmp $<
mv $@.js.tmp $@
#
# Build/Install/dist
#
@ -57,7 +52,7 @@ dist/po.%.js: po/%.po $(NODE_MODULES_TEST)
%.spec: %.spec.in
sed -e 's/%{VERSION}/$(VERSION)/g' $< > $@
$(WEBPACK_TEST): $(NODE_MODULES_TEST) src/lib/patternfly/_fonts.scss $(shell find src/ -type f) package.json webpack.config.js $(patsubst %,dist/po.%.js,$(LINGUAS))
$(WEBPACK_TEST): $(NODE_MODULES_TEST) src/lib/patternfly/_fonts.scss $(shell find src/ -type f) package.json webpack.config.js
NODE_ENV=$(NODE_ENV) npm run build
watch: