[geary/wip/install-l10n-help-713831: 1/2] Generate and install localized help docs
- From: Charles Lindsay <clindsay src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/wip/install-l10n-help-713831: 1/2] Generate and install localized help docs
- Date: Sat, 15 Mar 2014 01:35:30 +0000 (UTC)
commit 7bc933922d021af8800f18d5de67fc6d26a54e1f
Author: Charles Lindsay <chaz yorba org>
Date: Fri Mar 14 18:28:54 2014 -0700
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.
.gitignore | 2 +
help/CMakeLists.txt | 93 ++++++++++++++++++++++++++++++++++++++++++---------
2 files changed, 79 insertions(+), 16 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 9ec36a2..79773b1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,3 +11,5 @@ build/
bindings/vapi/gmime-2.6/gmime-2.6.gi
/valadoc
/po/untitled.pot
+/help/*/*.page
+!/help/C/*.page
diff --git a/help/CMakeLists.txt b/help/CMakeLists.txt
index bdef358..f726d41 100644
--- a/help/CMakeLists.txt
+++ b/help/CMakeLists.txt
@@ -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.")
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]