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 ?
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With