From 373ffe1d1d221f0e28793d65b40e49311f2e1ed5 Mon Sep 17 00:00:00 2001 From: Rodney Dawes Date: Fri, 3 Feb 2017 12:23:56 -0500 Subject: Use cmake-extras intltool module, and keep pot file in vcs. --- cmake/FindIntltool.cmake | 23 ----------------------- cmake/Translations.cmake | 37 ------------------------------------- po/CMakeLists.txt | 15 ++++++++++++--- po/Makevars | 7 ------- 4 files changed, 12 insertions(+), 70 deletions(-) delete mode 100644 cmake/FindIntltool.cmake delete mode 100644 cmake/Translations.cmake delete mode 100644 po/Makevars diff --git a/cmake/FindIntltool.cmake b/cmake/FindIntltool.cmake deleted file mode 100644 index 69ffab9..0000000 --- a/cmake/FindIntltool.cmake +++ /dev/null @@ -1,23 +0,0 @@ -# FindIntltool.cmake -# -# Jim Nelson -# Copyright 2012 Yorba Foundation - -find_program (INTLTOOL_MERGE_EXECUTABLE intltool-merge) - -if (INTLTOOL_MERGE_EXECUTABLE) - set (INTLTOOL_MERGE_FOUND TRUE) -else (INTLTOOL_MERGE_EXECUTABLE) - set (INTLTOOL_MERGE_FOUND FALSE) -endif (INTLTOOL_MERGE_EXECUTABLE) - -if (INTLTOOL_MERGE_FOUND) - macro (INTLTOOL_MERGE_DESKTOP desktop_id po_dir) - add_custom_target (geary.desktop ALL - ${INTLTOOL_MERGE_EXECUTABLE} --desktop-style ${CMAKE_SOURCE_DIR}/${po_dir} - ${CMAKE_CURRENT_SOURCE_DIR}/${desktop_id}.desktop.in ${desktop_id}.desktop - ) - install (FILES ${CMAKE_CURRENT_BINARY_DIR}/geary.desktop DESTINATION /usr/share/applications) - endmacro (INTLTOOL_MERGE_DESKTOP desktop_id po_dir) -endif (INTLTOOL_MERGE_FOUND) - diff --git a/cmake/Translations.cmake b/cmake/Translations.cmake deleted file mode 100644 index b51c39d..0000000 --- a/cmake/Translations.cmake +++ /dev/null @@ -1,37 +0,0 @@ -# Translations.cmake, CMake macros written for Marlin, feel free to re-use them - -macro(add_translations_directory NLS_PACKAGE) - add_custom_target (i18n ALL) - find_program (MSGFMT_EXECUTABLE msgfmt) - file (GLOB PO_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.po) - foreach (PO_INPUT ${PO_FILES}) - get_filename_component (PO_INPUT_BASE ${PO_INPUT} NAME_WE) - set (MO_OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${PO_INPUT_BASE}.mo) - add_custom_command (TARGET i18n COMMAND ${MSGFMT_EXECUTABLE} -o ${MO_OUTPUT} ${PO_INPUT}) - - install (FILES ${MO_OUTPUT} DESTINATION - ${CMAKE_INSTALL_LOCALEDIR}/${PO_INPUT_BASE}/LC_MESSAGES - RENAME ${NLS_PACKAGE}.mo) - endforeach (PO_INPUT ${PO_FILES}) -endmacro(add_translations_directory) - - -macro(add_translations_catalog NLS_PACKAGE) - add_custom_target (pot COMMENT “Building translation catalog.”) - find_program (XGETTEXT_EXECUTABLE xgettext) - - # init this list, which will hold all the sources across all dirs - set(SOURCES "") - - # add each directory's sources to the overall sources list - foreach(FILES_INPUT ${ARGN}) - set (DIR ${CMAKE_CURRENT_SOURCE_DIR}/${FILES_INPUT}) - file (GLOB_RECURSE DIR_SOURCES ${DIR}/*.c ${DIR}/*.cc ${DIR}/*.cpp ${DIR}/*.cxx ${DIR}/*.vala) - set (SOURCES ${SOURCES} ${DIR_SOURCES}) - endforeach() - - add_custom_command (TARGET pot COMMAND - ${XGETTEXT_EXECUTABLE} -d ${NLS_PACKAGE} -o ${CMAKE_CURRENT_SOURCE_DIR}/${NLS_PACKAGE}.pot - ${SOURCES} --keyword="_" --keyword="N_" --from-code=UTF-8 - ) -endmacro() diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt index 8325f6e..e78a9df 100644 --- a/po/CMakeLists.txt +++ b/po/CMakeLists.txt @@ -1,3 +1,12 @@ -include (Translations) -add_translations_directory ("${GETTEXT_PACKAGE}") -add_translations_catalog ("${GETTEXT_PACKAGE}" ../src/) +find_package(Intltool REQUIRED) + +intltool_update_potfile( + KEYWORDS "_" "_:1,2" "N_" "N_:1,2" + GETTEXT_PACKAGE ${GETTEXT_PACKAGE} + COPYRIGHT_HOLDER "Canonical Ltd." +) + +intltool_install_translations( + ALL + GETTEXT_PACKAGE ${GETTEXT_PACKAGE} +) diff --git a/po/Makevars b/po/Makevars deleted file mode 100644 index e877468..0000000 --- a/po/Makevars +++ /dev/null @@ -1,7 +0,0 @@ -DOMAIN = $(PACKAGE) -subdir = po -top_builddir = .. -XGETTEXT_OPTIONS = --keyword=_ --keyword=N_ --keyword=C_:1c,2 --keyword=T_ --from-code=UTF-8 -COPYRIGHT_HOLDER = Canonical Ltd. -MSGID_BUGS_ADDRESS = ted@canonical.com -EXTRA_LOCALE_CATEGORIES = -- cgit v1.2.3