~ories/ubuntu-calculator-app/unity8_preview_fix

« back to all changes in this revision

Viewing changes to po/po.pro

  • Committer: David Planella
  • Date: 2013-06-12 14:59:11 UTC
  • mto: This revision was merged to the branch mainline in revision 76.
  • Revision ID: david.planella@ubuntu.com-20130612145911-nfuxrwvtvbu3y4ve
Created qmake rules to update the .pot file, including translations from the .desktop file

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
PROJECTNAME = $$system(basename ../*.qmlproject)
4
4
PROJECTNAME = $$replace(PROJECTNAME,.qmlproject,)
5
5
 
6
 
SOURCECODE = ../*.qml
 
6
DESKTOPFILE = ../$${PROJECTNAME}.desktop
 
7
 
 
8
SOURCECODE = ../*.qml \
 
9
             ../*.js \
 
10
             ../Simple/*.qml \
 
11
             ../Scientific/*.qml
 
12
 
 
13
BUILDDIR = ../.build
 
14
DESKTOPFILETEMP = $${BUILDDIR}/$${PROJECTNAME}.desktop.js
7
15
 
8
16
message("")
9
17
message(" Project Name: $$PROJECTNAME ")
10
18
message(" Source Code: $$SOURCECODE ")
11
19
message("")
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. ")
16
21
message("")
17
22
 
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
22
34
 
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
27
 
 
28
 
## generate mo files 'make mo'
29
 
mofiles.target = mo
30
 
mofiles.commands = msgfmt *.po
31
 
QMAKE_EXTRA_TARGETS += mofiles
32
 
 
33
 
## Installation steps for mo files. 'make install'
34
 
MO_FILES = $$system(ls *.mo)
35
 
 
36
 
install_mo_commands =
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
44
 
}
45
 
 
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
 
42
 
 
43
## Dependency rule to create the temporary build dir
 
44
makebuilddir.target = makebuilddir
 
45
makebuilddir.commands = mkdir -p $${BUILDDIR}
 
46
QMAKE_EXTRA_TARGETS += makebuilddir
 
47
 
 
48
## Rule to clean the products of the build
 
49
clean.target = clean
 
50
clean.commands = rm -Rf $${BUILDDIR}
 
51
QMAKE_EXTRA_TARGETS += clean
48
52