Commit 2e30e47b authored by Charles Lindsay's avatar Charles Lindsay

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
parent e6edaae8
......@@ -11,3 +11,5 @@ build/
bindings/vapi/gmime-2.6/gmime-2.6.gi
/valadoc
/po/untitled.pot
/help/*/*.page
!/help/C/*.page
......@@ -17,8 +17,8 @@
* Dependencies
Building Geary requires Vala 0.22.1 or higher with a full GObject
introspection repository, intltool, cmake, and desktop-file-validate.
Vala's vapigen must be installed as well.
introspection repository, intltool, cmake, desktop-file-validate, and
xml2po. Vala's vapigen must be installed as well.
The developer packages and headers for the following libraries are also
required when building Geary:
......@@ -61,9 +61,10 @@
of Fedora by running this command:
$ sudo yum install gobject-introspection-devel intltool cmake \
desktop-file-utils libcanberra-devel libgee-devel glib2-devel \
gmime-devel gtk3-devel libnotify-devel sqlite-devel unique3-devel \
webkitgtk3-devel libsecret-devel libxml2-devel vala-tools
desktop-file-utils gnome-doc-utils libcanberra-devel libgee-devel \
glib2-devel gmime-devel gtk3-devel libnotify-devel sqlite-devel \
unique3-devel webkitgtk3-devel libsecret-devel libxml2-devel \
vala-tools
* Installing dependencies on Ubuntu
......@@ -78,10 +79,11 @@
command:
$ sudo apt-get install valac-0.20 libgirepository1.0-dev intltool \
cmake desktop-file-utils libcanberra-dev libgee-0.8-dev \
libglib2.0-dev libgmime-2.6-dev libgtk-3-dev libsecret-1-dev \
libxml2-dev libnotify-dev libsqlite3-dev libunique-3.0-dev \
libwebkitgtk-3.0-dev libmessaging-menu-dev libunity-dev
cmake desktop-file-utils gnome-doc-utils libcanberra-dev \
libgee-0.8-dev libglib2.0-dev libgmime-2.6-dev libgtk-3-dev \
libsecret-1-dev libxml2-dev libnotify-dev libsqlite3-dev \
libunique-3.0-dev libwebkitgtk-3.0-dev libmessaging-menu-dev \
libunity-dev
You should check that you are using the right version of valac by running:
......
......@@ -19,7 +19,8 @@ Build-Depends: debhelper (>= 8),
libunity-dev (>= 5.12.0),
intltool,
libgirepository1.0-dev (>= 1.32.0),
desktop-file-utils
desktop-file-utils,
gnome-doc-utils
Standards-Version: 3.8.3
Homepage: http://www.yorba.org
......
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.")
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment