Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Automated translation management with Cmake and Qt5

I used to use the following qt4 commands for creation of translation files:

SET(PROJECTNAME "TEST")

SET(${PROJECTNAME}_TRANSLATIONS
    ${PROJECTNAME}_de.ts
)  

SET(${PROJECTNAME}_TRANSLATIONS_COMPILED
    ${PROJECTNAME}_de.qm
)

QT4_CREATE_TRANSLATION (${PROJECTNAME}_TRANSLATION_FILES
    ${${PROJECTNAME}_FORMS}
    ${${PROJECTNAME}_HEADERS}
    ${${PROJECTNAME}_SOURCES}
    ${${PROJECTNAME}_RESSOURCES}
    ${${PROJECTNAME}_TRANSLATIONS}
)

How to port this kind of translation cmake snippet to work with Qt5 ?

like image 383
DomTomCat Avatar asked Oct 05 '13 01:10

DomTomCat


1 Answers

The answer can be found in the Qt5-Cmake docs, here:
http://qt-project.org/doc/qt-5.0/qtdoc/cmake-manual.html#qt5linguisttools-macros

so, to your Cmakelists add:

find_package(Qt5LinguistTools)

then use:

QT5_CREATE_TRANSLATION(...)

Note for Ubuntu users (Oct.2013): you will need to install qttools5-dev

like image 169
DomTomCat Avatar answered Nov 16 '22 03:11

DomTomCat