root/trunk/qt4-gui/po/CMakeLists.txt

Revision 5557, 2.2 kB (checked in by eugene, 14 months ago)

Killed the trailing whitespace from the lines.

Line 
1set(po_SRCS
2  be.ts
3  bg_BG.ts
4  cs_CZ.ts
5  de.ts
6  es.ts
7  fi.ts
8  fr.ts
9  hu_HU.ts
10  it.ts
11  ja_JP.eucJP.ts
12  pl.ts
13  pt_BR.ts
14  pt.ts
15  ru.ts
16  sr.ts
17  sv.ts
18  tr.ts
19  uk.ts
20)
21
22# Translatable source files
23file(GLOB_RECURSE translate_files
24  ${CMAKE_CURRENT_SOURCE_DIR}/../src/*.cpp
25  ${CMAKE_CURRENT_SOURCE_DIR}/../src/*.h)
26
27find_program(QT_LUPDATE
28  NAMES lupdate-qt4 lupdate
29  PATHS $ENV{QTDIR}/bin
30  DOC "Path to the lupdate program"
31)
32
33find_program(QT_LRELEASE
34  NAMES lrelease-qt4 lrelease
35  PATHS $ENV{QTDIR}/bin
36  DOC "Path to the lrelease program"
37)
38
39# Update translations (note that [clean-]merge targets write to source directory)
40if (QT_LUPDATE)
41  # merge: update all translations
42  add_custom_target(merge
43    ${QT_LUPDATE} ${translate_files} -ts ${po_SRCS}
44    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
45
46  # clean-merge: update all translations and remove obsolete strings
47  add_custom_target(clean-merge
48    ${QT_LUPDATE} -noobsolete ${translate_files} -ts ${po_SRCS}
49    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
50
51  # Create template.ts to be used for new translations
52  add_custom_command(OUTPUT template.ts
53    COMMAND ${QT_LUPDATE} -noobsolete ${translate_files} -ts template.ts
54    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
55    DEPENDS ${translate_files})
56
57  # template: create po/template.ts
58  add_custom_target(template DEPENDS template.ts)
59else (QT_LUPDATE)
60  message(STATUS "lupdate could not be found. You will not be able to update the translations.")
61endif (QT_LUPDATE)
62
63
64# Build translations
65if (QT_LRELEASE)
66  # Clear list
67  set(qms)
68
69  # Add command to build X.qm from X.po
70  foreach (po ${po_SRCS})
71    get_filename_component(qm ${po} NAME_WE)
72    set(qm "${CMAKE_CURRENT_BINARY_DIR}/${qm}.qm")
73    set(po "${CMAKE_CURRENT_SOURCE_DIR}/${po}")
74    add_custom_command(OUTPUT ${qm}
75      COMMAND ${QT_LRELEASE} ${po} -qm ${qm}
76      DEPENDS ${po})
77    set(qms ${qms} ${qm})
78  endforeach(po)
79
80  # translations: build all *.qm files
81  add_custom_target(translations ALL DEPENDS ${qms})
82
83  # Install *.qm to <prefix>/share/licq/qt4-gui/locale
84  install(FILES ${qms}
85    DESTINATION ${INSTALL_DATA_DIR}/licq/${INSTALL_QTGUI_DIR}/locale)
86else (QT_LRELEASE)
87  message(STATUS "lrelease could not be found. You're losing the localisation.")
88endif (QT_LRELEASE)
Note: See TracBrowser for help on using the browser.