diff --git a/CMakeLists.txt b/CMakeLists.txt index 619083529..ab522b63e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -59,6 +59,7 @@ SET(FBVF "FISH-BUILD-VERSION-FILE") # Set up config.h INCLUDE(cmake/ConfigureChecks.cmake) +INCLUDE(cmake/gettext.cmake) CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config_cmake.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}) diff --git a/cmake/ConfigureChecks.cmake b/cmake/ConfigureChecks.cmake index 8cf208951..1ae8462ba 100644 --- a/cmake/ConfigureChecks.cmake +++ b/cmake/ConfigureChecks.cmake @@ -84,4 +84,3 @@ ENDIF() CHECK_TYPE_SIZE("wchar_t[8]" WCHAR_T_BITS LANGUAGE CXX) # Not checked yet: non-varargs tparm ("Solaris tparm kludge") -# Not checked yet: gettext diff --git a/cmake/gettext.cmake b/cmake/gettext.cmake new file mode 100644 index 000000000..2fa31ca91 --- /dev/null +++ b/cmake/gettext.cmake @@ -0,0 +1,22 @@ +SET(languages de en fr nb nn pl pt_BR sv zh_CN) + +INCLUDE(FeatureSummary) + +OPTION(WITH_GETTEXT "translate messages if gettext is available" ON) +IF(WITH_GETTEXT) + FIND_PACKAGE(Intl) + FIND_PACKAGE(Gettext) + IF(GETTEXT_FOUND) + SET(HAVE_GETTEXT 1) + ENDIF() +ENDIF() +ADD_FEATURE_INFO(gettext GETTEXT_FOUND "translate messages with gettext") + +# Define translations +IF(GETTEXT_FOUND) + FOREACH(lang ${languages}) + GETTEXT_PROCESS_PO_FILES(${lang} ALL + INSTALL_DESTINATION ${CMAKE_INSTALL_FULL_LOCALEDIR} + PO_FILES po/${lang}.po) + ENDFOREACH() +ENDIF() diff --git a/config_cmake.h.in b/config_cmake.h.in index 4ae4fd6b0..008eedeec 100644 --- a/config_cmake.h.in +++ b/config_cmake.h.in @@ -139,9 +139,6 @@ /* Define to 1 if tparm accepts a fixed amount of paramters. */ // #cmakedefine TPARM_SOLARIS_KLUDGE 1 -/* Perform string translations with gettext */ -// #cmakedefine USE_GETTEXT 1 - /* The size of wchar_t in bits. */ #define WCHAR_T_BITS ${WCHAR_T_BITS}