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'
This commit is contained in:
Kornel Benko 2020-09-07 21:12:22 +02:00
parent b2109b9d39
commit aadfb58374
2 changed files with 33 additions and 15 deletions

View File

@ -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)

View File

@ -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,9 +145,25 @@ 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(
if (GETTEXT_MSGCAT_EXECUTABLE)
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++ --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}
@ -159,6 +175,7 @@ ADD_CUSTOM_COMMAND(
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())