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
1=== modified file 'src/FindIntltool.cmake'
2--- src/FindIntltool.cmake 2015-09-17 13:34:38 +0000
3+++ src/FindIntltool.cmake 2016-11-29 21:19:58 +0000
4@@ -281,50 +281,43 @@
5
6 function(INTLTOOL_INSTALL_TRANSLATIONS)
7 set(_options ALL)
8- set(_oneValueArgs GETTEXT_PACKAGE POT_FILE)
9+ set(_oneValueArgs GETTEXT_PACKAGE)
10
11 cmake_parse_arguments(_ARG "${_options}" "${_oneValueArgs}" "" ${ARGN})
12
13- set(_POT_FILE "${PROJECT}.pot")
14+ set(_GETTEXT_PACKAGE "${PROJECT}")
15
16 if(_ARG_GETTEXT_PACKAGE)
17- set(_POT_FILE "${_ARG_GETTEXT_PACKAGE}.pot")
18- endif()
19-
20- if(_ARG_OUTPUT_FILE)
21- set(_POT_FILE "${_ARG_OUTPUT_FILE}")
22+ set(_GETTEXT_PACKAGE "${_ARG_GETTEXT_PACKAGE}")
23 endif()
24
25 file(
26 GLOB _PO_FILES
27- ${CMAKE_CURRENT_SOURCE_DIR}/*.po
28+ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.po
29 )
30
31- get_filename_component(_ABS_POT_FILE ${_POT_FILE} ABSOLUTE)
32-
33 foreach(_PO_FILE ${_PO_FILES})
34- add_custom_command(
35- OUTPUT
36- ${_PO_FILE}
37- COMMAND
38- ${GETTEXT_MSGMERGE_EXECUTABLE} --quiet --update --backup=none -s ${_PO_FILE} ${_ABS_POT_FILE}
39- DEPENDS
40- ${_ABS_POT_FILE}
41+ string(REPLACE ".po" "" _LANG ${_PO_FILE})
42+ if(_ARG_ALL)
43+ gettext_process_po_files(
44+ ${_LANG}
45+ ALL
46+ PO_FILES ${_PO_FILE}
47+ )
48+ else()
49+ gettext_process_po_files(
50+ ${_LANG}
51+ PO_FILES ${_PO_FILE}
52+ )
53+ endif()
54+ # Must define install ourselves as process_po_files doesn't know
55+ # the gettext package, so installs en as en/LC_MESSAGES/en.mo
56+ install(
57+ FILES ${CMAKE_CURRENT_BINARY_DIR}/${_LANG}.gmo
58+ DESTINATION ${CMAKE_INSTALL_LOCALEDIR}/${_LANG}/LC_MESSAGES/
59+ RENAME ${_GETTEXT_PACKAGE}.mo
60 )
61 endforeach()
62-
63- if(_ARG_ALL)
64- gettext_create_translations(
65- ${_ABS_POT_FILE}
66- ALL
67- ${_PO_FILES}
68- )
69- else()
70- gettext_create_translations(
71- ${_ABS_POT_FILE}
72- ${_PO_FILES}
73- )
74- endif()
75 endfunction()
76
77 function(INTLTOOL_MERGE_TRANSLATIONS FILENAME OUTPUT_FILE)

Subscribers

People subscribed via source and target branches

to all changes: