4 # Creating the .pot file....
5 # POT_FILE_DEPENDS was set in ../src
6 SET( POT_FILE ${CMAKE_CURRENT_BINARY_DIR}/${POT_NAME}.pot )
8 SET( XGETTEXT_CMD "xgettext" )
9 SET( XGETTEXT_OPTIONS -L C++ --boost --no-wrap --add-comments --add-location --foreign-user )
10 SET( XGETTEXT_OPTIONS ${XGETTEXT_OPTIONS} --keyword=_ --keyword=_:1,2 --keyword=__ --keyword=N_ --keyword=PL_:1,2 )
11 SET( XGETTEXT_OPTIONS ${XGETTEXT_OPTIONS} --copyright-holder=\"SuSE Linux GmbH, Nuernberg\" )
12 SET( XGETTEXT_OPTIONS ${XGETTEXT_OPTIONS} --package-name=${POT_NAME} --default-domain=${POT_NAME} )
14 SET( _abs_POT_FILE_DEPENDS )
15 FOREACH( _currentDepends ${POT_FILE_DEPENDS} )
16 SET( _abs_POT_FILE_DEPENDS ${_abs_POT_FILE_DEPENDS} ${LIBZYPP_SOURCE_DIR}/${_currentDepends} )
19 ADD_CUSTOM_COMMAND( OUTPUT ${POT_FILE}
20 COMMAND ${XGETTEXT_CMD} ${XGETTEXT_OPTIONS} --output=${POT_FILE} ${POT_FILE_DEPENDS}
21 WORKING_DIRECTORY ${LIBZYPP_SOURCE_DIR}
22 DEPENDS ${_abs_POT_FILE_DEPENDS}
23 COMMENT "Extract translatable messages to ${POT_FILE}"
27 # Creating the .gmo files out of the .po files
28 FILE( GLOB PO_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.po" )
31 FOREACH( _currentPoFile ${PO_FILES} )
32 GET_FILENAME_COMPONENT( _absFile ${_currentPoFile} ABSOLUTE )
33 GET_FILENAME_COMPONENT( _lang ${_absFile} NAME_WE )
35 SET( _poFile ${CMAKE_CURRENT_BINARY_DIR}/${_lang}.po )
36 SET( _gmoFile ${CMAKE_CURRENT_BINARY_DIR}/${_lang}.gmo )
38 ADD_CUSTOM_COMMAND( OUTPUT ${_gmoFile}
39 COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} --quiet -o ${_poFile} ${_absFile} ${POT_FILE}
40 COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_poFile}
41 DEPENDS ${POT_FILE} ${_absFile}
42 COMMENT "Update ${_gmoFile}"
45 INSTALL( FILES ${_gmoFile}
46 DESTINATION share/locale/${_lang}/LC_MESSAGES
50 SET( GMO_FILES ${GMO_FILES} ${_gmoFile} )
54 # Provides the 'translations' target that
55 # creates the .gmo files out of the .po files
56 SET( SOURCE_POT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/${POT_NAME}.pot )
58 ADD_CUSTOM_TARGET( translations ALL
59 COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/PotfileDiff.sh ${SOURCE_POT_FILE} ${POT_FILE} | grep '^[+-][^+-]' || true
61 COMMENT ".pot file diff..."
64 ADD_CUSTOM_TARGET( potfile_update
65 COMMAND ./PotfileDiff.sh ${SOURCE_POT_FILE} ${POT_FILE} -q || ./PotfileUpadte.sh ${CMAKE_CURRENT_BINARY_DIR}
66 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
68 COMMENT "Checking for uncommitted changes to the .pot file..."