Merge lp:~dobey/cmake-extras/intltool-fixes into lp:cmake-extras

Proposed by dobey
Status: Merged
Approved by: Pete Woods
Approved revision: 48
Merged at revision: 48
Proposed branch: lp:~dobey/cmake-extras/intltool-fixes
Merge into: lp:cmake-extras
Diff against target: 77 lines (+23/-30)
1 file modified
src/FindIntltool.cmake (+23/-30)
To merge this branch: bzr merge lp:~dobey/cmake-extras/intltool-fixes
Reviewer Review Type Date Requested Status
James Henstridge Approve
Pete Woods Approve
Review via email: mp+312094@code.launchpad.net

Commit message

Simplify the INSTALL_TRANSLATIONS command to avoid regenerating po files.

To post a comment you must log in.
Revision history for this message
James Henstridge (jamesh) wrote :

If the message catalogue contains out of date translations, msgmerge will comment them out IIRC. Does anything similar happen with the gettext_process_po_files() function? Or are we just assuming that it doesn't matter because the files will naturally get updated as Launchpad merges translation updates? to trunk?

Other than that, I'm happy to see anything that reduces the work these cmake modules do.

review: Needs Information
Revision history for this message
dobey (dobey) wrote :

We don't auto-update the po files with msgmerge in upstream intltool's automake rules either. We leave it up to maintainers to decide when that should happen. We made that decision a very long time ago, and there has never been a need to re-introduce the automatic updating.

Any cmake integration for intltool should provide the same level of functionality as upstream (and ideally, this stuff will end up upstream, once I figure out how to deal with the file conflict issue).

Revision history for this message
Pete Woods (pete-woods) wrote :

Tried building a couple of the indicators, and all still seems good!

Also the changes look sane, too.

review: Approve
Revision history for this message
Pete Woods (pete-woods) wrote :

(glad someone who knows exactly what is supposed to be happening in this macro had time to look at it, as I just had to guess when writing it)

Revision history for this message
James Henstridge (jamesh) wrote :

Sounds good to me too then.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/FindIntltool.cmake'
--- src/FindIntltool.cmake 2015-09-17 13:34:38 +0000
+++ src/FindIntltool.cmake 2016-11-29 21:19:58 +0000
@@ -281,50 +281,43 @@
281281
282function(INTLTOOL_INSTALL_TRANSLATIONS)282function(INTLTOOL_INSTALL_TRANSLATIONS)
283 set(_options ALL)283 set(_options ALL)
284 set(_oneValueArgs GETTEXT_PACKAGE POT_FILE)284 set(_oneValueArgs GETTEXT_PACKAGE)
285285
286 cmake_parse_arguments(_ARG "${_options}" "${_oneValueArgs}" "" ${ARGN})286 cmake_parse_arguments(_ARG "${_options}" "${_oneValueArgs}" "" ${ARGN})
287287
288 set(_POT_FILE "${PROJECT}.pot")288 set(_GETTEXT_PACKAGE "${PROJECT}")
289289
290 if(_ARG_GETTEXT_PACKAGE)290 if(_ARG_GETTEXT_PACKAGE)
291 set(_POT_FILE "${_ARG_GETTEXT_PACKAGE}.pot")291 set(_GETTEXT_PACKAGE "${_ARG_GETTEXT_PACKAGE}")
292 endif()
293
294 if(_ARG_OUTPUT_FILE)
295 set(_POT_FILE "${_ARG_OUTPUT_FILE}")
296 endif()292 endif()
297293
298 file(294 file(
299 GLOB _PO_FILES295 GLOB _PO_FILES
300 ${CMAKE_CURRENT_SOURCE_DIR}/*.po296 RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.po
301 )297 )
302298
303 get_filename_component(_ABS_POT_FILE ${_POT_FILE} ABSOLUTE)
304
305 foreach(_PO_FILE ${_PO_FILES})299 foreach(_PO_FILE ${_PO_FILES})
306 add_custom_command(300 string(REPLACE ".po" "" _LANG ${_PO_FILE})
307 OUTPUT301 if(_ARG_ALL)
308 ${_PO_FILE}302 gettext_process_po_files(
309 COMMAND303 ${_LANG}
310 ${GETTEXT_MSGMERGE_EXECUTABLE} --quiet --update --backup=none -s ${_PO_FILE} ${_ABS_POT_FILE}304 ALL
311 DEPENDS305 PO_FILES ${_PO_FILE}
312 ${_ABS_POT_FILE}306 )
307 else()
308 gettext_process_po_files(
309 ${_LANG}
310 PO_FILES ${_PO_FILE}
311 )
312 endif()
313 # Must define install ourselves as process_po_files doesn't know
314 # the gettext package, so installs en as en/LC_MESSAGES/en.mo
315 install(
316 FILES ${CMAKE_CURRENT_BINARY_DIR}/${_LANG}.gmo
317 DESTINATION ${CMAKE_INSTALL_LOCALEDIR}/${_LANG}/LC_MESSAGES/
318 RENAME ${_GETTEXT_PACKAGE}.mo
313 )319 )
314 endforeach()320 endforeach()
315
316 if(_ARG_ALL)
317 gettext_create_translations(
318 ${_ABS_POT_FILE}
319 ALL
320 ${_PO_FILES}
321 )
322 else()
323 gettext_create_translations(
324 ${_ABS_POT_FILE}
325 ${_PO_FILES}
326 )
327 endif()
328endfunction()321endfunction()
329322
330function(INTLTOOL_MERGE_TRANSLATIONS FILENAME OUTPUT_FILE)323function(INTLTOOL_MERGE_TRANSLATIONS FILENAME OUTPUT_FILE)

Subscribers

People subscribed via source and target branches

to all changes: