@@ -12,6 +12,7 @@ TEMPLATE = aux
12
12
13
13
TARGET = jolla-settings-screenmonitor
14
14
jolla-settings-screenmonitor.depends += ScreenMonitor
15
+ screenmonitor-executable.CONFIG += no_check_exist
15
16
16
17
# CONFIG += sailfishapp
17
18
@@ -30,7 +31,7 @@ screenmonitor-dbus-configuration.files = service/dbus/eu.medesimo.ScreenMonitor.
30
31
screenmonitor-dbus-service.path = /usr/share/dbus-1/system-services
31
32
screenmonitor-dbus-service.files = service/dbus/eu.medesimo.ScreenMonitor.service
32
33
33
- screenmonitor-systemd.path = /lib/systemd/system
34
+ screenmonitor-systemd.path = /usr/ lib/systemd/system
34
35
screenmonitor-systemd.files = service/dbus/ScreenMonitor.service
35
36
36
37
INSTALLS += \
@@ -39,29 +40,60 @@ INSTALLS += \
39
40
screenmonitor-executable \
40
41
screenmonitor-dbus-configuration \
41
42
screenmonitor-dbus-service \
42
- screenmonitor-systemd
43
+ screenmonitor-systemd
43
44
44
45
OTHER_FILES += \
45
46
rpm/jolla-settings-screenmonitor.spec \
46
47
rpm/jolla-settings-screenmonitor.yaml \
47
- service/dbus_interface.vala \
48
- service/ScreenMonitor.vala \
49
- service/ScreenMonitor \
50
- service/UnixTimer.vala \
51
- service/service.vala \
52
- service/Makefile \
53
- service/dbus/eu.medesimo.ScreenMonitor.service \
54
- service/dbus/eu.medesimo.ScreenMonitor.conf \
55
- service/dbus/Makefile \
48
+ service/dbus_interface.vala \
49
+ service/ScreenMonitor.vala \
50
+ service/ScreenMonitor \
51
+ service/UnixTimer.vala \
52
+ service/service.vala \
53
+ service/Makefile \
54
+ service/dbus/eu.medesimo.ScreenMonitor.service \
55
+ service/dbus/eu.medesimo.ScreenMonitor.conf \
56
+ service/dbus/Makefile \
56
57
service/UnixTimer.vala \
57
58
settings/DetailItem.qml \
58
59
rpm/jolla-settings-screenmonitor.changes \
59
60
service/FileWatcher.vala
60
61
61
- # to disable building translations every time, comment out the
62
- # following CONFIG line
63
- # CONFIG += sailfishapp_i18n
64
- # TRANSLATIONS += translations/jolla-settings-screenmonitor-de.ts
62
+ TRANSLATIONS += $$files (translations/ $${TARGET }- *.ts )
63
+ TS_FILE = $${_PRO_FILE_PWD_ }/translations/ $${TARGET }*.ts
64
+ HAVE_TRANSLATIONS = 0
65
+
66
+ TRANSLATION_SOURCES += $$_PRO_FILE_PWD_ /settings/
67
+
68
+ # prefix all TRANSLATIONS with the src dir
69
+ # the qm files are generated from the ts files copied to out dir
70
+ for (t, TRANSLATIONS ) {
71
+ TRANSLATIONS_IN += $${_PRO_FILE_PWD_ }/ $$t
72
+ TRANSLATIONS_OUT += $${OUT_PWD }/ $$t
73
+ HAVE_TRANSLATIONS = 1
74
+ }
75
+
76
+ qm.files = $$replace (TRANSLATIONS_OUT , \ .ts, .qm)
77
+ qm.path = /usr/share/translations
78
+ qm.CONFIG += no_check_exist
79
+
80
+ # update the ts files in the src dir and then copy them to the out dir
81
+ qm.commands += lupdate -noobsolete $${TRANSLATION_SOURCES } -ts $${TS_FILE } && \
82
+ mkdir -p translations && \
83
+ [ \ "$${OUT_PWD}\" != \"$${_PRO_FILE_PWD_}\" -a $$HAVE_TRANSLATIONS -eq 1 ] && \
84
+ cp -af $${TRANSLATIONS_IN } $${OUT_PWD }/translations || :
85
+
86
+ # create the qm files
87
+ qm.commands += ; [ $$HAVE_TRANSLATIONS -eq 1 ] && lrelease -nounfinished $${TRANSLATIONS_OUT } || :
88
+
89
+ # special case: as TS_FILE serves as both source file as well as
90
+ # the English translation source, create the en qm file from it:
91
+ qm.files += $$replace (TS_FILE , \ .ts, -en.qm)
92
+ qm.commands += lrelease -nounfinished $$TS_FILE -qm $$replace (TS_FILE , \ .ts, -en.qm)
93
+
94
+ INSTALLS += qm
95
+
96
+ OTHER_FILES += $$TRANSLATIONS
65
97
66
98
# This is needed to compile the DBus service
67
99
screenmonitor-service.target = ScreenMonitor
0 commit comments