-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
43 lines (31 loc) · 985 Bytes
/
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
LANGUAGES := en zh_CN zh_TW fr_FR ja_JP ko_KR de_DE es_ES
DOMAIN := beanbot
POT_FILE := locale/$(DOMAIN).pot
PO_FILES := $(foreach lang,$(LANGUAGES),locale/$(lang)/LC_MESSAGES/$(DOMAIN).po)
MO_FILES := $(foreach lang,$(LANGUAGES),locale/$(lang)/LC_MESSAGES/$(DOMAIN).mo)
.PHONY: all gentranslations compiletranslations clean lint
all: gentranslations compiletranslations
gentranslations: $(PO_FILES)
compiletranslations: $(MO_FILES)
$(POT_FILE): **/*.py
xgettext -d $(DOMAIN) -o $@ $^
define po_rule
locale/$(1)/LC_MESSAGES/$(DOMAIN).po: $(POT_FILE)
@mkdir -p $$(dir $$@)
@if [ ! -f $$@ ]; then \
msginit -i $$< -o $$@ -l $(1); \
else \
msgmerge --update $$@ $$<; \
fi
endef
$(foreach lang,$(LANGUAGES),$(eval $(call po_rule,$(lang))))
%.mo: %.po
msgfmt -o $@ $^
# clean:
# rm -f $(POT_FILE) $(PO_FILES) $(MO_FILES)
lint:
@ruff check
test:
coverage run --source=. --omit="**/*_test.py,bots/*_bot.py,main.py,test.py" -m pytest
coverage report
@coverage html