~kowal-h/+junk/Energy98

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
# More information: https://wiki.ubuntu.com/Touch/Testing
#
# Notes for autopilot tests:
# ---------------------------------------------------------------
# In order to run autopilot tests:
# sudo apt-add-repository ppa:autopilot/ppa
# sudo apt-get update
# sudo apt-get install python-autopilot autopilot-qt
#
# Notes for translations:
# ---------------------------------------------------------------
# In order to create translation files manually:
# 1) run make once to create and update the po/template.pot
# 2) copy the template file and set the name to the language you want to
#    translate to:   cp po/template.pot po/de.po
# 3) edit the po file
# 4) run make build-translations to build the translation files
#
# Steps 1) and 4) are automatically executed by QtCreator
#################################################################

#APP_ID needs to match the "name" field of the click manifest
APP_ID=kowal7.energy98

#provides a way for the IDE to set a specific target folder for the translations
TRANSLATION_ROOT=.

MO_FILES=$(shell for infile in `find po -name "*.po"`; do basename -s .po $$infile | awk '{print "$(TRANSLATION_ROOT)/share/locale/" $$0 "/LC_MESSAGES/$(APP_ID).mo";}' ; done)
QMLJS_FILES=$(shell find . -name "*.qml" -o -name "*.js" | grep -v ./tests)

all: po/template.pot

autopilot:
	chmod +x tests/autopilot/run
	tests/autopilot/run

check:
	qmltestrunner -input tests/qml

#translation targets

build-translations: $(MO_FILES)

po/template.pot: $(QMLJS_FILES)
	mkdir -p $(CURDIR)/po && xgettext -o po/template.pot --qt --c++ --add-comments=TRANSLATORS --keyword=tr --keyword=tr:1,2 $(QMLJS_FILES) --from-code=UTF-8

$(TRANSLATION_ROOT)/share/locale/%/LC_MESSAGES/$(APP_ID).mo: po/%.po
	mkdir -p $(TRANSLATION_ROOT)/share/locale/$*/LC_MESSAGES && msgfmt -o $(@) $(<)