-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
54 lines (45 loc) · 1.63 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# On OSX the PATH variable isn't exported unless "SHELL" is also set, see: http://stackoverflow.com/a/25506676
SHELL = /bin/bash
NODE_MODULES := ${CURDIR}/node_modules
export PATH := node_modules/.bin:$(PATH)
# Where to find apps (it can be multiple paths).
APPS = $(shell find packages -maxdepth 1 -name 'web-app-*')
node_modules: package.json pnpm-lock.yaml
[ -n "${NO_INSTALL}" ] || pnpm install --frozen-lockfile
touch ${NODE_MODULES}
.PHONY: l10n-push
l10n-push:
@for app in $(APPS); \
do \
(cd $$app/l10n && tx push -s); \
done;
.PHONY: l10n-pull
l10n-pull:
@for app in $(APPS); \
do \
(cd $$app/l10n && rm locale/**/app.po && tx pull -a); \
done;
.PHONY: l10n-clean
l10n-clean:
rm -f $(foreach app,$(APPS),$(app)/l10n/template.pot); \
rm -rf $(foreach app,$(APPS),$(app)/l10n/locale);
.PHONY: l10n-read
l10n-read: node_modules ./template.pot
.PHONY: l10n-write
l10n-write: node_modules ./translations.json
# Create a main .pot template, then generate .po files for each available language.
# Thanks to Systematic: https://github.com/Polyconseil/systematic/blob/866d5a/mk/main.mk#L167-L183
./template.pot:
# Extract gettext strings from each apps templates files and create a POT dictionary template.
# Generate .po files for each available language.
@for app in $(APPS); \
do \
(cd $$app && pnpm exec vue-gettext-extract --config ../../gettext.config.cjs); \
done;
# Generate translations.json file from all available apps .pot templates.
.PHONY: ./translations.json
./translations.json:
@for app in $(APPS); \
do \
(cd $$app && pnpm exec vue-gettext-compile --config ../../gettext.config.cjs); \
done;