Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to integrate QT internationalization to CMake?

Greetings all,

I am trying to use QT internationalization with CMake. I have configured my cmake file as follows :

#Internalization - this should generate core_jp.ts ?
SET(rinzo_core_TRANSLATIONS
   i18n/core_jp.ts
   )

#these are my source files in the project
SET(FILES_TO_TRANSLATE
   ${rinzo_core_srcs} 
   ${rinzo_core_moh_srcs}
 )

QT4_CREATE_TRANSLATION(QM_FILES ${FILES_TO_TRANSLATE} ${rinzo_core_TRANSLATIONS})
QT4_ADD_TRANSLATION(QM ${rinzo_core_TRANSLATIONS})

But it doesnt genereate any TS nor QM files.

My questions -

1.Does Cmake(by using QT tools) generate TS files automatically extracting "tr()" methods from the source ? (that means I dont have to create any TS file and above i18n/core_jp.ts will be genereated automatically)

2.What exacly are QM files ?

Thanks in advance

like image 397
Ashika Umanga Umagiliya Avatar asked Apr 12 '11 03:04

Ashika Umanga Umagiliya


1 Answers

In CMake documentation see QT4_CREATE_TRANSLATION and QT4_ADD_TRANSLATION macros.

So you should do the followings:

SET(Lang_files
  example.ts
)
...
QT4_CREATE_TRANSLATION(LangSrcs ${Lang_files})
...
ADD_EXECUTABLE(project_name ... others sources ... ${LangSrcs})
like image 93
Naszta Avatar answered Sep 24 '22 17:09

Naszta