SET(_lyxname ${PACKAGE})
SET(_py_sources)
-# Idea stolen from http://public.kitware.com/pipermail/cmake/2011-January/041666.html
-
macro(add_gettext_python _par _dir)
set(_sources)
foreach(_arg ${ARGN})
if (${_par} MATCHES "layouttranslations")
# lyx_pot.py requires the module "polib" if using target layouttranslations1,
# so we have to check for it
- find_python_module("polib" REQUIRED)
+ find_python_module("polib")
+ if ("${LYX_PY_POLIB}" STREQUAL "")
+ message(STATUS "You will be unable to update layouttranslations file")
+ endif()
ADD_CUSTOM_COMMAND(
OUTPUT "${_dst}"
PRE_BUILD
"-DLYX_PYTHON_EXECUTABLE=${LYX_PYTHON_EXECUTABLE}"
"-DParType=${_par1}"
"-DSources=${_src_files}"
+ "-DLYX_PY_POLIB=${LYX_PY_POLIB}"
-P "${TOP_SRC_DIR}/po/CreateLayoutTranslations.cmake"
- DEPENDS ${_sources} ${_src_files} "${TOP_SRC_DIR}/lib/layouttranslations"
+ DEPENDS ${_sources} ${_src_files} "${TOP_SRC_DIR}/lib/layouttranslations" "${TOP_SRC_DIR}/po/lyx_pot.py"
COMMENT "${LYX_PYTHON_EXECUTABLE} ${TOP_SRC_DIR}/po/lyx_pot.py -b ${TOP_SRC_DIR} -o ${_dst} -t ${_par1} --src_file=${_src_files}"
)
ADD_CUSTOM_TARGET(layouttranslations1 DEPENDS "${_dst}")
PRE_BUILD
COMMAND ${LYX_PYTHON_EXECUTABLE}
ARGS "${TOP_SRC_DIR}/po/lyx_pot.py" -b "${TOP_SRC_DIR}" -o "${_dst}" -t ${_par1} "--src_file=${_src_files}"
- DEPENDS ${_sources} ${_src_files}
+ DEPENDS ${_sources} ${_src_files} "${TOP_SRC_DIR}/po/lyx_pot.py"
COMMENT "${LYX_PYTHON_EXECUTABLE} ${TOP_SRC_DIR}/po/lyx_pot.py -b ${TOP_SRC_DIR} -o ${_dst} -t ${_par1} --src_file=${_src_files}"
)
LIST(APPEND _py_sources "${_dst}")
SET_SOURCE_FILES_PROPERTIES("${CMAKE_CURRENT_BINARY_DIR}/${_lyxname}.cat.pot" GENERATED)
SET_SOURCE_FILES_PROPERTIES("${CMAKE_CURRENT_BINARY_DIR}/${_lyxname}.fmt.pot" GENERATED)
SET_SOURCE_FILES_PROPERTIES("${CMAKE_CURRENT_BINARY_DIR}/${_lyxname}.pot" GENERATED)
+if (UNIX)
+ # create symbolic links for external lokalizations programs
+ # to be able to find the referenced sources if used on
+ # built po-files
+ foreach (_dir lib src)
+ execute_process(
+ COMMAND ${CMAKE_COMMAND} -E create_symlink "${TOP_SRC_DIR}/${_dir}" "${CMAKE_CURRENT_BINARY_DIR}/${_dir}")
+ endforeach()
+endif()
-add_gettext_python(qt4 src/frontends/qt4/ui *.ui)
-add_gettext_python(layouts lib/layouts *.layout *.inc *.module)
+add_gettext_python(layouttranslations lib layouts/*.layout layouts/*.inc layouts/*.module citeengines/*.citeengine)
add_gettext_python(languages lib languages)
+add_gettext_python(layouts lib layouts/*.layout layouts/*.inc layouts/*.module citeengines/*.citeengine)
add_gettext_python(latexfonts lib latexfonts)
add_gettext_python(encodings lib encodings)
add_gettext_python(ui lib/ui *.ui *.inc)
-add_gettext_python(external lib external_templates)
+add_gettext_python(external lib/xtemplates *.xtemplate)
add_gettext_python(formats lib configure.py)
-add_gettext_python(layouttranslations lib/layouts *.layout *.inc *.module)
+add_gettext_python(tabletemplates lib tabletemplates/*.lyx)
+add_gettext_python(qt src/frontends/qt/ui *.ui)
+add_gettext_python(examples_templates lib examples/[a-zA-Z]* templates/[a-zA-Z]*)
ADD_CUSTOM_COMMAND(
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${_lyxname}.cat.pot"
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_CURRENT_BINARY_DIR}/POTFILES.in.tmp" "${CMAKE_CURRENT_BINARY_DIR}/POTFILES.in"
)
-ADD_CUSTOM_COMMAND(
- OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${_lyxname}.pot"
- COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_BINARY_DIR}/${_lyxname}.fmt.pot" "${CMAKE_CURRENT_BINARY_DIR}/${_lyxname}.pot"
- COMMAND ${GETTEXT_XGETTEXT_EXECUTABLE}
- --from-code=UTF-8
- --default-domain=${_lyxname} --directory=${TOP_SRC_DIR}
- --add-comments=TRANSLATORS:
- --language=C++ --join-existing --keyword=_ --keyword=N_ --keyword=B_ --keyword=qt_
- --files-from=${CMAKE_CURRENT_BINARY_DIR}/POTFILES.in
- --copyright-holder="LyX Developers" --msgid-bugs-address=lyx-devel@lists.lyx.org
- -o "${CMAKE_CURRENT_BINARY_DIR}/${_lyxname}.pot"
- DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/${_lyxname}.fmt.pot" ${_potfiles_dep}
- )
+if (GETTEXT_MSGCAT_EXECUTABLE)
+ ADD_CUSTOM_COMMAND(
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${_lyxname}.pot"
+ COMMAND ${GETTEXT_XGETTEXT_EXECUTABLE}
+ --from-code=UTF-8
+ --default-domain=${_lyxname} --directory=${TOP_SRC_DIR}
+ --add-comments=TRANSLATORS:
+ --language=C++ --keyword=_ --keyword=N_ --keyword=B_ --keyword=qt_
+ --files-from=${CMAKE_CURRENT_BINARY_DIR}/POTFILES.in
+ --copyright-holder="LyX Developers" --msgid-bugs-address=lyx-devel@lists.lyx.org
+ -o "${CMAKE_CURRENT_BINARY_DIR}/${_lyxname}.src.pot"
+ COMMAND ${GETTEXT_MSGCAT_EXECUTABLE} "${CMAKE_CURRENT_BINARY_DIR}/${_lyxname}.src.pot" "${CMAKE_CURRENT_BINARY_DIR}/${_lyxname}.fmt.pot" -o "${CMAKE_CURRENT_BINARY_DIR}/${_lyxname}.pot"
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/${_lyxname}.fmt.pot" ${_potfiles_dep}
+ )
+
+else()
+ ADD_CUSTOM_COMMAND(
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${_lyxname}.pot"
+ COMMAND ${CMAKE_COMMAD} -E copy "${CMAKE_CURRENT_BINARY_DIR}/${_lyxname}.fmt.pot" "${CMAKE_CURRENT_BINARY_DIR}/${_lyxname}.pot"
+ COMMAND ${GETTEXT_XGETTEXT_EXECUTABLE}
+ --from-code=UTF-8
+ --default-domain=${_lyxname} --directory=${TOP_SRC_DIR}
+ --add-comments=TRANSLATORS:
+ --language=C++ --join-existing --keyword=_ --keyword=N_ --keyword=B_ --keyword=qt_
+ --files-from=${CMAKE_CURRENT_BINARY_DIR}/POTFILES.in
+ --copyright-holder="LyX Developers" --msgid-bugs-address=lyx-devel@lists.lyx.org
+ -o "${CMAKE_CURRENT_BINARY_DIR}/${_lyxname}.pot"
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/${_lyxname}.fmt.pot" ${_potfiles_dep}
+ )
+endif()
#
# We have to copy the po-files first,
# otherwise they would be modified (inside the macro GETTEXT_CREATE_TRANSLATIONS())
ADD_CUSTOM_TARGET(update-po DEPENDS ${LYX_UPDATED_PO_FILES} ${LYX_UPDATED_GMO_FILES})
set_target_properties(update-po update-gmo PROPERTIES FOLDER "i18n")
add_dependencies(update-po translations)
+add_dependencies(update-gmo translations)
+add_dependencies(update-gmo update-po)