1
## This .pro file is used to create a Makefile with the necessary rules
2
## to create an initial translations template and to update it whenever
3
## there are new translatable strings in the project that are ready to be
4
## exposed to translators
6
## See the ../README.translations file for more information
10
3
PROJECTNAME = $$system(basename ../*.qmlproject)
11
4
PROJECTNAME = $$replace(PROJECTNAME,.qmlproject,)
13
DESKTOPFILE = ../com.ubuntu.calendar_calendar.desktop.in
15
SOURCECODE = ../*.qml \
19
DESKTOPFILETEMP = $${BUILDDIR}/com.ubuntu.calendar_calendar.desktop.in
22
9
message(" Project Name: $$PROJECTNAME ")
23
10
message(" Source Code: $$SOURCECODE ")
25
message(" Run 'make pot' to generate the pot file from source code. ")
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. ")
28
## Generate pot file 'make pot'
18
## generate pot file 'make pot'
29
19
potfile.target = pot
30
potfile.commands = xgettext \
31
-o $${PROJECTNAME}.pot \
32
--copyright=\"Canonical Ltd.\" \
33
--package-name $${PROJECTNAME} \
34
--qt --c++ --add-comments=TRANSLATORS \
35
--keyword=tr --keyword=tr:1,2 \
36
$${SOURCECODE} $${DESKTOPFILETEMP}
37
potfile.depends = desktopfile
20
potfile.commands = xgettext -o $${PROJECTNAME}.pot --package-name $${PROJECTNAME} --qt --c++ --add-comments=TRANSLATORS --keyword=tr $${SOURCECODE}
38
21
QMAKE_EXTRA_TARGETS += potfile
40
## Do not use this rule directly. It's a dependency rule to
41
## generate an intermediate .h file to extract translatable
42
## strings from the .desktop file
43
desktopfile.target = desktopfile
44
desktopfile.commands = awk \'BEGIN { FS=\"=\" }; /Name/ {print \"var s = i18n.tr(\42\" \$$2 \"\42);\"}\' $${DESKTOPFILE} > $${DESKTOPFILETEMP}
45
desktopfile.depends = makebuilddir
46
QMAKE_EXTRA_TARGETS += desktopfile
48
## Dependency rule to create the temporary build dir
49
makebuilddir.target = makebuilddir
50
makebuilddir.commands = mkdir -p $${BUILDDIR}
51
QMAKE_EXTRA_TARGETS += makebuilddir
53
## Rule to clean the products of the build
55
clean.commands = rm -Rf $${BUILDDIR}
56
QMAKE_EXTRA_TARGETS += clean
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