3
3
PROJECTNAME = $$system(basename ../*.qmlproject)
4
4
PROJECTNAME = $$replace(PROJECTNAME,.qmlproject,)
6
DESKTOPFILE = ../$${PROJECTNAME}.desktop
8
SOURCECODE = ../*.qml \
14
DESKTOPFILETEMP = $${BUILDDIR}/$${PROJECTNAME}.desktop.js
9
17
message(" Project Name: $$PROJECTNAME ")
10
18
message(" Source Code: $$SOURCECODE ")
12
message(" run 'make pot' to generate the pot file from source code. ")
13
message(" run 'make translate' to create a new translation (po) based on pot. ")
14
message(" run 'make mo' to generate the mo files from po files. ")
15
message(" run 'qmake; make install' to install the mo files. ")
20
message(" Run 'make pot' to generate the pot file from source code. ")
18
## generate pot file 'make pot'
23
## Generate pot file 'make pot'
19
24
potfile.target = pot
20
potfile.commands = xgettext -o $${PROJECTNAME}.pot --package-name $${PROJECTNAME} --qt --c++ --add-comments=TRANSLATORS --keyword=tr $${SOURCECODE}
25
potfile.commands = xgettext \
26
-o $${PROJECTNAME}.pot \
27
--copyright=\"Canonical Ltd. \" \
28
--package-name $${PROJECTNAME} \
29
--qt --c++ --add-comments=TRANSLATORS \
30
--keyword=tr --keyword=tr:1,2 \
31
$${SOURCECODE} $${DESKTOPFILETEMP}
32
potfile.depends = desktopfile
21
33
QMAKE_EXTRA_TARGETS += potfile
23
## poedit target for new translations 'make translate'
24
poedit.target = translate
25
poedit.commands = cp messages.pot new_language.po; poedit new_language.po
26
QMAKE_EXTRA_TARGETS += poedit
28
## generate mo files 'make mo'
30
mofiles.commands = msgfmt *.po
31
QMAKE_EXTRA_TARGETS += mofiles
33
## Installation steps for mo files. 'make install'
34
MO_FILES = $$system(ls *.mo)
37
for(mo_file, MO_FILES) {
38
mo_name = $$replace(mo_file,.mo,)
39
mo_targetpath = $(INSTALL_ROOT)/usr/share/locale/$${mo_name}/LC_MESSAGES
40
mo_target = $${mo_targetpath}/$${PROJECTNAME}.mo
41
!isEmpty(install_mo_commands): install_mo_commands += &&
42
install_mo_commands += test -d $$mo_targetpath || mkdir -p $$mo_targetpath
43
install_mo_commands += && cp $$mo_file $$mo_target
46
install.commands = $$install_mo_commands
47
QMAKE_EXTRA_TARGETS += install
35
## Do not use this rule directly. It's a dependency rule to
36
## generate an intermediate .h file to extract translatable
37
## strings from the .desktop file
38
desktopfile.target = desktopfile
39
desktopfile.commands = awk \'BEGIN { FS=\"=\" }; /Name/ {print \"var s = i18n.tr(\42\" \$$2 \"\42);\"}\' $${DESKTOPFILE} > $${DESKTOPFILETEMP}
40
desktopfile.depends = makebuilddir
41
QMAKE_EXTRA_TARGETS += desktopfile
43
## Dependency rule to create the temporary build dir
44
makebuilddir.target = makebuilddir
45
makebuilddir.commands = mkdir -p $${BUILDDIR}
46
QMAKE_EXTRA_TARGETS += makebuilddir
48
## Rule to clean the products of the build
50
clean.commands = rm -Rf $${BUILDDIR}
51
QMAKE_EXTRA_TARGETS += clean