~qqworini/ubuntu-rssreader-app/rssview

« back to all changes in this revision

Viewing changes to po/po.pro

  • Committer: Michael Hall
  • Date: 2013-02-12 16:18:48 UTC
  • Revision ID: mhall119@ubuntu.com-20130212161848-u5qt45e38jovrbyk
Initial code template

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
TEMPLATE = subdirs
 
2
 
 
3
PROJECTNAME = $$system(basename ../*.qmlproject)
 
4
PROJECTNAME = $$replace(PROJECTNAME,.qmlproject,)
 
5
 
 
6
SOURCECODE = ../*.qml
 
7
 
 
8
message("")
 
9
message(" Project Name: $$PROJECTNAME ")
 
10
message(" Source Code: $$SOURCECODE ")
 
11
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. ")
 
16
message("")
 
17
 
 
18
## generate pot file 'make pot'
 
19
potfile.target = pot
 
20
potfile.commands = xgettext -o $${PROJECTNAME}.pot --package-name $${PROJECTNAME} --qt --c++ --add-comments=TRANSLATORS --keyword=tr $${SOURCECODE}
 
21
QMAKE_EXTRA_TARGETS += potfile
 
22
 
 
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
 
48