summaryrefslogtreecommitdiff
path: root/talerbackoffice/backoffice/templates/Makefile
blob: b25897dcce9f5d64ed8bda2e7c75a567db3d90bd (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
# This file is in the public domain.

# All: build HTML pages in all languages and compile the
# TypeScript logic in web-common.
all: locale
	true

# Extract translateable strings from jinja2 templates.
locale/messages.pot: *.html
	env PYTHONPATH="." pybabel extract -F translations/babel.map -o translations/messages.pot .

# Update translation (.po) files with new strings.
locale-update: locale/messages.pot
	msgmerge -U -m --previous translations/en/LC_MESSAGES/messages.po translations/messages.pot 
	msgmerge -U -m --previous translations/de/LC_MESSAGES/messages.po translations/messages.pot
	msgmerge -U -m --previous translations/fr/LC_MESSAGES/messages.po translations/messages.pot
	msgmerge -U -m --previous translations/es/LC_MESSAGES/messages.po translations/messages.pot
	msgmerge -U -m --previous translations/it/LC_MESSAGES/messages.po translations/messages.pot
	msgmerge -U -m --previous translations/ru/LC_MESSAGES/messages.po translations/messages.pot
	msgmerge -U -m --previous translations/pt/LC_MESSAGES/messages.po translations/messages.pot

	if grep -nA1 '#-#-#-#-#' translations/*/LC_MESSAGES/messages.po; then echo -e "\nERROR: Conflicts encountered in PO files.\n"; exit 1; fi

# Compile translation files for use.
locale-compile:
	pybabel compile -d translations -l en --use-fuzzy
	pybabel compile -d translations -l de --use-fuzzy
	pybabel compile -d translations -l fr --use-fuzzy
	pybabel compile -d translations -l it --use-fuzzy
	pybabel compile -d translations -l es --use-fuzzy
	pybabel compile -d translations -l ru --use-fuzzy
	pybabel compile -d translations -l pt --use-fuzzy

# Process everything related to gettext translations.
locale: locale-update locale-compile

# Run the jinja2 templating engine to expand templates to HTML
# incorporating translations.  NOTE; likely NOT needed when another
# templating is happening -- like in a Flask settlement.
template: locale-compile
	./template.py