diff options
| author | Elmar Ludwig <elmar.ludwig@uni-osnabrueck.de> | 2022-01-12 11:31:01 +0000 |
|---|---|---|
| committer | Elmar Ludwig <elmar.ludwig@uni-osnabrueck.de> | 2022-01-12 11:31:01 +0000 |
| commit | 483a260c7a17cc164db31937004b769a0693a9b0 (patch) | |
| tree | 163eaf2cc8086f10312e0ae6edba7ea2afa10417 /Makefile | |
| parent | 98d7db55cd486e04be186d4b50fac9068fdb5754 (diff) | |
rework and fix handling of JS translations, re #5
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 36 |
1 files changed, 28 insertions, 8 deletions
@@ -1,7 +1,11 @@ CODECEPT = composer/bin/codecept -SVGO = node_modules/svgo/bin/svgo +CATALOGS = locale/en/LC_MESSAGES/studip.mo locale/en/LC_MESSAGES/js-resources.json +NPM_BIN = $(shell npm bin) RESOURCES = $(shell find resources -type f) +PHP_SOURCES = $(shell find app config lib public templates -name '*.php' \( ! -path 'public/plugins_packages/*' -o -path 'public/plugins_packages/core/*' \)) +VUE_SOURCES = $(shell find resources -name '*.js' -o -name '*.vue') + # build all needed files build: composer webpack-prod @@ -75,14 +79,30 @@ test-jsonapi: $(CODECEPT) test-unit: $(CODECEPT) $(CODECEPT) run unit +catalogs: npm $(CATALOGS) + optimize-icons: npm - $(SVGO) --config=config/svgo.config.js -f public/assets/images/icons/black -r - $(SVGO) --config=config/svgo.config.js -f public/assets/images/icons/blue -r - $(SVGO) --config=config/svgo.config.js -f public/assets/images/icons/green -r - $(SVGO) --config=config/svgo.config.js -f public/assets/images/icons/grey -r - $(SVGO) --config=config/svgo.config.js -f public/assets/images/icons/red -r - $(SVGO) --config=config/svgo.config.js -f public/assets/images/icons/white -r - $(SVGO) --config=config/svgo.config.js -f public/assets/images/icons/yellow -r + find public/assets/images/icons -type f | xargs -P0 $(NPM_BIN)/svgo -q --config=config/svgo.config.js + +# default rules for gettext handling +%.pot: $(PHP_SOURCES) + xgettext -o $@ --from-code=UTF-8 $(PHP_SOURCES) + +%.po: %.pot + msgmerge -qU $@ $< + +%.mo: %.po + msgfmt -o $@ $< + +js-%.pot: $(VUE_SOURCES) + $(NPM_BIN)/gettext-extract --attribute v-translate --output $@ $(VUE_SOURCES) + +js-%.po: js-%.pot + msgmerge -qU -C $(dir $@)studip.po $@ $< + +js-%.json: js-%.po + $(NPM_BIN)/gettext-compile --output $@ $< + sed -i 's/^{[^{]*//;s/}$$//' $@ # dummy target to force update of "doc" target force_update: |
