From 0780bb0f8f39adde254401b05cf08a0ff0d865b6 Mon Sep 17 00:00:00 2001 From: Diogo Pereira Date: Thu, 18 Aug 2016 03:38:05 +0100 Subject: make gettext behave correctly Fixes #178 --- cmake/GETTEXT.cmake | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'cmake') diff --git a/cmake/GETTEXT.cmake b/cmake/GETTEXT.cmake index e3056f8cd..ec4987004 100644 --- a/cmake/GETTEXT.cmake +++ b/cmake/GETTEXT.cmake @@ -14,7 +14,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Foundation, Inc., 51 Franklin Street, Fifth Floor, # Boston, MA 02110-1301, USA. find_suggested_package(Gettext) @@ -24,12 +24,13 @@ function(gettext po_dir package_name) file(GLOB po_files ${po_dir}/*.po) foreach(po_file ${po_files}) get_filename_component(lang ${po_file} NAME_WE) - set(mo_file ${CMAKE_CURRENT_BINARY_DIR}/${lang}.mo) - add_custom_command(OUTPUT ${mo_file} COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${mo_file} ${po_file} DEPENDS ${po_file}) - install(FILES ${mo_file} DESTINATION share/locale/${lang}/LC_MESSAGES RENAME ${package_name}.mo) - set(mo_files ${mo_files} ${mo_file}) + if(("$ENV{LINGUAS}" MATCHES "(^| )${lang}( |$)") OR (NOT DEFINED ENV{LINGUAS})) + set(mo_file ${CMAKE_CURRENT_BINARY_DIR}/${lang}.mo) + add_custom_command(OUTPUT ${mo_file} COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${mo_file} ${po_file} DEPENDS ${po_file}) + install(FILES ${mo_file} DESTINATION share/locale/${lang}/LC_MESSAGES RENAME ${package_name}.mo) + set(mo_files ${mo_files} ${mo_file}) + endif() endforeach() set(translations-target "${package_name}-translations") add_custom_target(${translations-target} ALL DEPENDS ${mo_files}) endfunction() - -- cgit v1.2.3