diff options
author | Julian Andres Klode <jak@debian.org> | 2016-08-09 18:14:41 +0200 |
---|---|---|
committer | Julian Andres Klode <jak@debian.org> | 2016-08-10 16:11:21 +0200 |
commit | 32a32d7501ace2859ba097ef8fb7ef665ca2f0ed (patch) | |
tree | 317dbb52e0a30d1ed2eafd9ee6ad3566f5b32199 /CMake | |
parent | e164341c20625f62a44be16e6f3fbab66334f130 (diff) |
CMake: Translations: Allow excluding languages from translation
This seems to be needed for the hebrew translations.
Gbp-Dch: ignore
Diffstat (limited to 'CMake')
-rw-r--r-- | CMake/Translations.cmake | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/CMake/Translations.cmake b/CMake/Translations.cmake index 584c5c5af..9880e68c7 100644 --- a/CMake/Translations.cmake +++ b/CMake/Translations.cmake @@ -4,7 +4,7 @@ function(apt_add_translation_domain) set(options) set(oneValueArgs DOMAIN) - set(multiValueArgs TARGETS SCRIPTS) + set(multiValueArgs TARGETS SCRIPTS EXCLUDE_LANGUAGES) cmake_parse_arguments(NLS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) # Build the list of source files of the target set(files "") @@ -106,6 +106,9 @@ function(apt_add_translation_domain) list(SORT translations) foreach(file ${translations}) get_filename_component(langcode ${file} NAME_WE) + if ("${langcode}" IN_LIST NLS_EXCLUDE_LANGUAGES) + continue() + endif() set(outdir ${PROJECT_BINARY_DIR}/locale/${langcode}/LC_MESSAGES) file(MAKE_DIRECTORY ${outdir}) # Command to merge and compile the messages. As explained in the custom @@ -131,7 +134,7 @@ endfunction() function(apt_add_update_po) set(options) set(oneValueArgs TEMPLATE) - set(multiValueArgs DOMAINS) + set(multiValueArgs DOMAINS EXCLUDE_LANGUAGES) cmake_parse_arguments(NLS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) set(output ${CMAKE_CURRENT_SOURCE_DIR}/${NLS_TEMPLATE}.pot) foreach(domain ${NLS_DOMAINS}) @@ -151,6 +154,9 @@ function(apt_add_update_po) endif() foreach(translation ${translations}) get_filename_component(langcode ${translation} NAME_WE) + if ("${langcode}" IN_LIST NLS_EXCLUDE_LANGUAGES) + continue() + endif() add_custom_target(update-po-${langcode} COMMAND msgmerge -q --update --backup=none ${translation} ${output} DEPENDS nls-${master_name} @@ -160,14 +166,23 @@ function(apt_add_update_po) add_dependencies(update-po nls-${master_name}) endfunction() -function(apt_add_po_statistics) +function(apt_add_po_statistics excluded) add_custom_target(statistics) file(GLOB translations "${PROJECT_SOURCE_DIR}/po/*.po") foreach(translation ${translations}) get_filename_component(langcode ${translation} NAME_WE) + if ("${langcode}" IN_LIST excluded) + add_custom_command( + TARGET statistics PRE_BUILD + COMMAND printf "%-6s " "${langcode}:" + COMMAND echo "ignored" + VERBATIM + ) + continue() + endif() add_custom_command( TARGET statistics PRE_BUILD - COMMAND printf "%-7s" "${langcode}:" + COMMAND printf "%-6s " "${langcode}:" COMMAND msgfmt --statistics -o /dev/null ${translation} VERBATIM ) |