1 # This file is part of LyX, the document processor.
2 # Licence details can be found in the file COPYING.
4 # Copyright (c) 2008, 2009 Peter Kümmel, <syntheticpp@gmx.net>
5 # Copyright (c) 2008, 2009 Kornel Benko, <Kornel.Benko@berlin.de>
10 include_directories(${TOP_SRC_DIR}/po)
13 macro(add_gettext_python _par _dir)
14 file(GLOB _sources ${TOP_SRC_DIR}/${_dir}/${ARGN})
15 SET(_dst "${CMAKE_CURRENT_BINARY_DIR}/${_par}_l10n.pot")
20 ARGS "${TOP_SRC_DIR}/po/lyx_pot.py" -b "${TOP_SRC_DIR}" -o "${_dst}" -t ${_par} ${_sources}
23 SET_SOURCE_FILES_PROPERTIES("${_dst}" GENERATED)
24 LIST(APPEND _py_sources "${_dst}")
25 endmacro(add_gettext_python)
27 SET_SOURCE_FILES_PROPERTIES("${CMAKE_CURRENT_BINARY_DIR}/lyx.cat.pot" GENERATED)
28 SET_SOURCE_FILES_PROPERTIES("${CMAKE_CURRENT_BINARY_DIR}/lyx.fmt.pot" GENERATED)
29 SET_SOURCE_FILES_PROPERTIES("${CMAKE_CURRENT_BINARY_DIR}/lyx.pot" GENERATED)
31 add_gettext_python(encodings lib encodings)
32 add_gettext_python(external lib external_templates)
33 add_gettext_python(formats lib configure.py)
34 add_gettext_python(languages lib languages)
35 add_gettext_python(layouts lib/layouts *.layouts *.inc *.module)
36 add_gettext_python(qt4 src/frontends/qt4/ui *.ui)
37 add_gettext_python(ui lib/ui *.ui *.inc)
39 FIND_PROGRAM(GETTEXT_XGETTEXT_EXECUTABLE xgettext)
40 FIND_PROGRAM(GETTEXT_MSGUNIQ_EXECUTABLE msguniq)
43 # We need here perl, because I don't know how
44 # to write the alternative for "cat" in python
45 # e.g. perl -e "\"while(<>){print;}\""
46 # But maybe Jose knows?
49 OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/lyx.cat.pot"
51 ARGS -e "\"while(<>){print;}\"" ${_py_sources} > "${CMAKE_CURRENT_BINARY_DIR}/lyx.cat.pot"
52 DEPENDS ${_py_sources}
56 OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/lyx.fmt.pot"
57 COMMAND ${GETTEXT_MSGUNIQ_EXECUTABLE}
58 ARGS -o "${CMAKE_CURRENT_BINARY_DIR}/lyx.fmt.pot" "${CMAKE_CURRENT_BINARY_DIR}/lyx.cat.pot"
59 DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/lyx.cat.pot"
62 file(STRINGS "${TOP_SRC_DIR}/po/POTFILES.in" _tmppotfiles_dep)
64 foreach(_f ${_tmppotfiles_dep})
65 LIST(APPEND _potfiles_dep "${TOP_SRC_DIR}/${_f}")
69 OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/lyx.pot"
70 COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_BINARY_DIR}/lyx.fmt.pot" "${CMAKE_CURRENT_BINARY_DIR}/lyx.pot"
71 COMMAND ${GETTEXT_XGETTEXT_EXECUTABLE}
72 ARGS --default-domain=lyx --directory=${TOP_SRC_DIR} --add-comments=TRANSLATORS: --language=C++ --join-existing --keyword=_ --keyword=N_ --keyword=B_ --keyword=qt_ --files-from="${TOP_SRC_DIR}/po/POTFILES.in" --copyright-holder='LyX Developers' --msgid-bugs-address=lyx-devel@lists.lyx.org -o "${CMAKE_CURRENT_BINARY_DIR}/lyx.pot"
73 DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/lyx.fmt.pot" ${_potfiles_dep}
76 file(GLOB LYX_PO_FILES ${TOP_SRC_DIR}/po/*.po)
78 GETTEXT_CREATE_TRANSLATIONS(${CMAKE_CURRENT_BINARY_DIR}/lyx.pot ALL ${LYX_PO_FILES})