From ddf40a42f5a699086466990f85d86e6c4977524a Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Tue, 9 Aug 2016 11:58:28 +0200 Subject: [PATCH] CMake: Translations: Add a statistics target This is really useful stuff to have. Gbp-Dch: ignore --- CMake/Translations.cmake | 14 ++++++++++++++ po/CMakeLists.txt | 2 ++ 2 files changed, 16 insertions(+) diff --git a/CMake/Translations.cmake b/CMake/Translations.cmake index 6a9862005..8b657c20f 100644 --- a/CMake/Translations.cmake +++ b/CMake/Translations.cmake @@ -142,3 +142,17 @@ function(apt_add_update_po) endforeach() add_dependencies(update-po nls-${master_name}) endfunction() + +function(apt_add_po_statistics) + add_custom_target(statistics) + file(GLOB translations "${PROJECT_SOURCE_DIR}/po/*.po") + foreach(translation ${translations}) + get_filename_component(langcode ${translation} NAME_WE) + add_custom_command( + TARGET statistics PRE_BUILD + COMMAND printf "%-7s" "${langcode}:" + COMMAND msgfmt --statistics -o /dev/null ${translation} + VERBATIM + ) + endforeach() +endfunction() diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt index 4fdac3959..92ff39867 100644 --- a/po/CMakeLists.txt +++ b/po/CMakeLists.txt @@ -36,3 +36,5 @@ apt_add_update_po( apt apt-utils ) + +apt_add_po_statistics() -- 2.45.2