-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generate and install localized help docs
This causes us to generate localized help docs whenever Geary builds, and then the localized docs are installed with the rest of the help pages. It would be great to also have the CMakeLists read from the Makefile.am file to determine what translations to run, but that hasn't happened yet. Closes: bgo #713831
- Loading branch information
1 parent
e6edaae
commit 2e30e47
Showing
4 changed files
with
92 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,5 @@ build/ | |
bindings/vapi/gmime-2.6/gmime-2.6.gi | ||
/valadoc | ||
/po/untitled.pot | ||
/help/*/*.page | ||
!/help/C/*.page |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,81 @@ | ||
set(HELP_DEST share/gnome/help/geary/C) | ||
|
||
set(HELP_FILES | ||
C/accounts.page | ||
C/archive.page | ||
C/bugs.page | ||
C/index.page | ||
C/label.page | ||
C/limits.page | ||
C/overview.page | ||
C/preferences.page | ||
C/search.page | ||
C/shortcuts.page | ||
C/star.page | ||
C/write.page | ||
accounts.page | ||
archive.page | ||
bugs.page | ||
index.page | ||
label.page | ||
limits.page | ||
overview.page | ||
preferences.page | ||
search.page | ||
shortcuts.page | ||
star.page | ||
write.page | ||
) | ||
|
||
# FIXME: don't re-specify this here, instead read it from Makefile.am. | ||
set(TRANSLATED | ||
el | ||
es | ||
) | ||
|
||
install(FILES ${HELP_FILES} DESTINATION ${HELP_DEST}) | ||
install(FILES C/figures/geary.svg DESTINATION ${HELP_DEST}/figures) | ||
set(HELP_DEST share/gnome/help/geary) | ||
|
||
set(HELP_SOURCE) | ||
foreach(_page ${HELP_FILES}) | ||
set(HELP_SOURCE ${HELP_SOURCE} C/${_page}) | ||
endforeach() | ||
|
||
install(FILES ${HELP_SOURCE} DESTINATION ${HELP_DEST}/C) | ||
install(FILES C/figures/geary.svg DESTINATION ${HELP_DEST}/C/figures) | ||
|
||
|
||
FIND_PROGRAM(XML2PO_BIN xml2po) | ||
IF(NOT XML2PO_BIN) | ||
MESSAGE(FATAL_ERROR "xml2po not found") | ||
ENDIF() | ||
|
||
# Hacked together from the similar macro in cmake/Gettext.cmake. | ||
MACRO(HELP_CREATE_TRANSLATIONS _firstLang) | ||
SET(_translatedPages) | ||
SET(_addToAll) | ||
SET(_isComment FALSE) | ||
|
||
FOREACH(_lang ${_firstLang} ${ARGN}) | ||
IF(_lang STREQUAL "ALL") | ||
SET(_addToAll "ALL") | ||
ELSEIF(_lang STREQUAL "COMMENT") | ||
SET(_isComment TRUE) | ||
ELSEIF(_isComment) | ||
SET(_isComment FALSE) | ||
SET(_comment ${_lang}) | ||
ELSE() | ||
GET_FILENAME_COMPONENT(_absPo ${_lang}/${_lang}.po ABSOLUTE) | ||
|
||
FOREACH(_page ${HELP_FILES}) | ||
GET_FILENAME_COMPONENT(_absSourcePage C/${_page} ABSOLUTE) | ||
SET(_destPage ${CMAKE_CURRENT_BINARY_DIR}/${_lang}/${_page}) | ||
GET_FILENAME_COMPONENT(_destPath ${_destPage} PATH) | ||
|
||
#MESSAGE("_absPo=${_absPo} _absSourcePage=${_absSourcePage} _destPage=${_destPage} _lang=${_lang} _page=${_page} curr_bin=${CMAKE_CURRENT_BINARY_DIR}\n") | ||
ADD_CUSTOM_COMMAND( | ||
OUTPUT ${_destPage} | ||
COMMAND mkdir -p ${_destPath} && ${XML2PO_BIN} -m mallard -p ${_absPo} -o ${_destPage} ${_absSourcePage} | ||
DEPENDS ${_absPo} ${_absSourcePage} | ||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} | ||
) | ||
|
||
INSTALL(FILES ${_destPage} DESTINATION ${HELP_DEST}/${_lang}) | ||
SET(_translatedPages ${_translatedPages} ${_destPage}) | ||
ENDFOREACH() | ||
ENDIF() | ||
ENDFOREACH() | ||
|
||
IF(DEFINED _comment) | ||
ADD_CUSTOM_TARGET(help_translations ${_addToAll} DEPENDS ${_translatedPages} COMMENT ${_comment}) | ||
ELSE() | ||
ADD_CUSTOM_TARGET(help_translations ${_addToAll} DEPENDS ${_translatedPages}) | ||
ENDIF() | ||
ENDMACRO() | ||
|
||
HELP_CREATE_TRANSLATIONS(ALL ${TRANSLATED} COMMENT "Translating help docs.") |