blob: bf6d127128bd767e2045b165c87704f577d6a751 (
plain)
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
|
# This file is in the public domain.
include build-system/config.mk
# List of all supported languages, add new languages here!
LANGUAGES="en ar zh_Hant fr de hi it ja ko pt pt_BR ru es sv tr"
# All: build HTML pages in all languages and compile the
.PHONY: all
all: locale template
env BASEURL=$(opt_baseurl) ./make_site.py
# Extract translateable strings from jinja2 templates.
locale/messages.pot: template/*.j2 template/news/*.j2 common/*.j2 common/*.j2.inc
$(python) inc/mybabel.py $(pybabel) extract -F locale/babel.map -o locale/messages.pot .
# Update translation (.po) files with new strings.
.PHONY: locale-update
locale-update: locale/messages.pot
for lang in `echo $(LANGUAGES)`; do \
$(msgmerge) -q -U -m --previous locale/$$lang/LC_MESSAGES/messages.po locale/messages.pot ; \
done
if $(grep) -nA1 '#-#-#-#-#' locale/*/LC_MESSAGES/messages.po; then \
$(echo) -e "\nERROR: Conflicts encountered in PO files.\n"; \
exit 1; \
fi
# Compile translation files for use.
.PHONY: locale-compile
locale-compile:
for lang in `echo $(LANGUAGES)`; do \
echo compiling $$lang; \
$(pybabel) -q compile -d locale -l $$lang --use-fuzzy ; \
done
# Process everything related to gettext translations.
.PHONY: locale
locale: locale-update locale-compile
.PHONY: run
run: all
$(browser) http://0.0.0.0:8000/rendered/en &
$(python) -m http.server
variant = $(opt_variant)
ifndef variant
$(error variant is not set)
endif
.PHONY: install
install: all
$(mkdir) -p $(prefix)/$(variant)
$(cp) -r rendered/* $(prefix)/$(variant)/
$(cp) -r rendered/.well-known/ $(prefix)/$(variant)/
.PHONY: clean
clean:
$(rm) -rf __pycache__ *.pyc *~ \.*~ \#*\#
$(rm) -rf rendered/
.PHONY: submodules/update
submodules/update:
$(git) submodule update --recursive --remote
|