[LyX/master] Cmake build: Try to omit using directory names as source-files in po
Kornel Benko
kornel at lyx.org
Mon Sep 7 18:58:09 UTC 2020
commit aadfb583740a2e1be58201408e3fcccf720b8803
Author: Kornel Benko <kornel at lyx.org>
Date: Mon Sep 7 21:12:22 2020 +0200
Cmake build: Try to omit using directory names as source-files in po
Previously there are po-entries like
#: lib/examples/Articles:0 src/TocBackend.cpp:296
#:src/frontends/qt/GuiExternal.cpp:87
msgid "External Material"
msgstr ""
now:
#: src/TocBackend.cpp:296 src/frontends/qt/GuiExternal.cpp:87
#: lib/examples/Articles:0
msgid "External Material"
msgstr ""
(The string at 'lib/examples/Articles:0' proceeds also from the directory name 'lib/examples/External_Material')
This makes it easier to use some po-editors like 'linguist'
---
development/cmake/modules/FindLyXGettext.cmake | 3 +-
po/CMakeLists.txt | 45 ++++++++++++++++-------
2 files changed, 33 insertions(+), 15 deletions(-)
diff --git a/development/cmake/modules/FindLyXGettext.cmake b/development/cmake/modules/FindLyXGettext.cmake
index 8533cbf..61ccc8f 100755
--- a/development/cmake/modules/FindLyXGettext.cmake
+++ b/development/cmake/modules/FindLyXGettext.cmake
@@ -17,6 +17,7 @@ FIND_PROGRAM(GETTEXT_MSGMERGE_EXECUTABLE msgmerge ${hints})
FIND_PROGRAM(GETTEXT_MSGFMT_EXECUTABLE msgfmt ${hints})
FIND_PROGRAM(GETTEXT_XGETTEXT_EXECUTABLE xgettext ${hints})
FIND_PROGRAM(GETTEXT_MSGUNIQ_EXECUTABLE msguniq ${hints})
+FIND_PROGRAM(GETTEXT_MSGCAT_EXECUTABLE msgcat ${hints})
MACRO(GETTEXT_CREATE_TRANSLATIONS _potFile _firstPoFile)
@@ -76,5 +77,5 @@ ELSE (GETTEXT_MSGMERGE_EXECUTABLE AND GETTEXT_MSGFMT_EXECUTABLE )
ENDIF (GetText_REQUIRED)
ENDIF (GETTEXT_MSGMERGE_EXECUTABLE AND GETTEXT_MSGFMT_EXECUTABLE )
-mark_as_advanced(GETTEXT_MSGMERGE_EXECUTABLE GETTEXT_MSGFMT_EXECUTABLE GETTEXT_XGETTEXT_EXECUTABLE GETTEXT_MSGUNIQ_EXECUTABLE)
+mark_as_advanced(GETTEXT_MSGMERGE_EXECUTABLE GETTEXT_MSGFMT_EXECUTABLE GETTEXT_XGETTEXT_EXECUTABLE GETTEXT_MSGUNIQ_EXECUTABLE GETTEXT_MSGCAT_EXECUTABLE)
diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt
index fd14bd2..065448e 100755
--- a/po/CMakeLists.txt
+++ b/po/CMakeLists.txt
@@ -104,9 +104,9 @@ add_gettext_python(encodings lib encodings)
add_gettext_python(ui lib/ui *.ui *.inc)
add_gettext_python(external lib/xtemplates *.xtemplate)
add_gettext_python(formats lib configure.py)
-add_gettext_python(examples_templates lib examples/[a-zA-Z]* templates/[a-zA-Z]*)
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"
@@ -145,20 +145,37 @@ execute_process(
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 at 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 at 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 at 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())
More information about the lyx-cvs
mailing list