3
PROJECTNAME = $$system(basename ../*.qmlproject)
4
PROJECTNAME = $$replace(PROJECTNAME,.qmlproject,)
9
message(" Project Name: $$PROJECTNAME ")
10
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. ")
18
## generate pot file 'make pot'
20
potfile.commands = xgettext -o $${PROJECTNAME}.pot --package-name $${PROJECTNAME} --qt --c++ --add-comments=TRANSLATORS --keyword=tr $${SOURCECODE}
21
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