-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathMakefile.i18n
More file actions
75 lines (68 loc) · 2.13 KB
/
Copy pathMakefile.i18n
File metadata and controls
75 lines (68 loc) · 2.13 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# Medulla Translation Makefile
#
# Usage:
# make -f Makefile.i18n extract # Extract strings → .pot
# make -f Makefile.i18n extract MODULE=store # Single module
# make -f Makefile.i18n init # Create/update .po files
# make -f Makefile.i18n translate DEEPL_KEY=xxx # Translate via DeepL
# make -f Makefile.i18n compile # Compile .po → .mo (local test)
# make -f Makefile.i18n all DEEPL_KEY=xxx # Full workflow
#
# Note: .mo files are compiled at installation time by autotools.
.PHONY: help extract init translate compile all
help:
@echo "Medulla Translation Tools"
@echo ""
@echo "Commands:"
@echo " make extract Extract strings from PHP → .pot"
@echo " make init Create/update .po files from .pot"
@echo " make translate Translate empty strings via DeepL"
@echo " make compile Compile .po → .mo (local testing)"
@echo " make all Full workflow: extract → init → translate"
@echo ""
@echo "Variables:"
@echo " MODULE Specific module (optional, default: all)"
@echo " DEEPL_KEY DeepL API key (required for translate/all)"
@echo ""
@echo "Examples:"
@echo " make -f Makefile.i18n extract MODULE=store"
@echo " make -f Makefile.i18n translate DEEPL_KEY=abc123"
@echo " make -f Makefile.i18n all MODULE=store DEEPL_KEY=abc123"
extract:
ifdef MODULE
python3 tools/i18n.py extract $(MODULE)
else
python3 tools/i18n.py extract
endif
init:
ifdef MODULE
python3 tools/i18n.py init $(MODULE)
else
python3 tools/i18n.py init
endif
translate:
ifndef DEEPL_KEY
@echo "❌ DEEPL_KEY required. Usage: make translate DEEPL_KEY=xxx"
@exit 1
endif
ifdef MODULE
python3 tools/i18n.py translate $(MODULE) --key=$(DEEPL_KEY)
else
python3 tools/i18n.py translate --key=$(DEEPL_KEY)
endif
compile:
ifdef MODULE
python3 tools/i18n.py compile $(MODULE)
else
python3 tools/i18n.py compile
endif
all:
ifndef DEEPL_KEY
@echo "❌ DEEPL_KEY required. Usage: make all DEEPL_KEY=xxx"
@exit 1
endif
ifdef MODULE
python3 tools/i18n.py all $(MODULE) --key=$(DEEPL_KEY)
else
python3 tools/i18n.py all --key=$(DEEPL_KEY)
endif