Hi all

attached is my second attempt at patching the source tree so that also 
strings outside of wxWidgets can be translated.

This one should work on Windows (or at least not break anything) within 
the SDK. Please test on OSX too.

If somebody wants to improve FindGettextLibs.cmake to better support 
Windows, that's optional but welcome.

Please test.
Yuv

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"hugin and other free panoramic software" group.
A list of frequently asked questions is available at: 
http://wiki.panotools.org/Hugin_FAQ
To post to this group, send email to hugin-ptx@googlegroups.com
To unsubscribe from this group, send email to 
hugin-ptx-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/hugin-ptx
-~----------~----~----~----~------~----~------~--~---

Index: src/hugin_base/huginapp/ImageCache.cpp
===================================================================
--- src/hugin_base/huginapp/ImageCache.cpp	(revision 4588)
+++ src/hugin_base/huginapp/ImageCache.cpp	(working copy)
@@ -36,6 +36,9 @@
 #include <vigra_ext/Pyramid.h>
 #include <vigra_ext/FunctorAccessor.h>
 
+// gettext for internalization of strings
+#include <libintl.h>
+#define _t(String) gettext(String)
 
 
 namespace HuginBase {
@@ -506,7 +509,7 @@
         return it->second;
     } else {
         if (m_progress) {
-            m_progress->pushTask(AppBase::ProgressTask("Loading image: "+hugin_utils::stripPath(filename), "", 0));
+            m_progress->pushTask(AppBase::ProgressTask(_t("Loading image: ")+hugin_utils::stripPath(filename), "", 0));
         }
 #if 1
         // load images with VIGRA impex, and store either 8 bit or float images
Index: src/CMakeLists.txt
===================================================================
--- src/CMakeLists.txt	(revision 4588)
+++ src/CMakeLists.txt	(working copy)
@@ -5,10 +5,10 @@
     # boost_thread is linked automatically
     # additionally link to our getopt
     set(common_libs huginbase hugingetopt
-        ${PANO_LIBRARIES} ${LAPACK_LIBRARIES} huginlevmar)
+        ${PANO_LIBRARIES} ${GETTEXT_LIBRARIES} ${LAPACK_LIBRARIES} huginlevmar)
   ELSE(LAPACK_FOUND)
     set(common_libs huginbase hugingetopt
-        ${PANO_LIBRARIES} huginlevmar)
+        ${PANO_LIBRARIES} ${GETTEXT_LIBRARIES} huginlevmar)
   ENDIF(LAPACK_FOUND)
   include_directories( ${CMAKE_SOURCE_DIR}/src/foreign/getopt/include )
 ELSE (MSVC)
Index: CMakeModules/FindGettextLibs.cmake
===================================================================
--- CMakeModules/FindGettextLibs.cmake	(revision 0)
+++ CMakeModules/FindGettextLibs.cmake	(revision 0)
@@ -0,0 +1,77 @@
+# Try to find Gettext functionality
+# Once done this will define
+#
+#  GETTEXTLIBS_FOUND - system has Gettext
+#  GETTEXT_INCLUDE_DIR - Gettext include directory
+#  GETTEXT_LIBRARIES - Libraries needed to use Gettext
+
+# TODO: This will enable translations only if Gettext functionality is
+# present in libc. Must have more robust system for release, where Gettext
+# functionality can also reside in standalone Gettext library, or the one
+# embedded within kdelibs (cf. gettext.m4 from Gettext source).
+#
+# Copyright (c) 2006, Chusslove Illich, <caslav.i...@gmx.net>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+
+if (LIBC_HAS_DGETTEXT OR LIBINTL_HAS_DGETTEXT)
+
+    # in cache already
+    set(GETTEXTLIBS_FOUND TRUE CACHE INTERNAL "")
+
+else (LIBC_HAS_DGETTEXT OR LIBINTL_HAS_DGETTEXT)
+
+  include(CheckIncludeFiles)
+  include(CheckLibraryExists)
+  include(CheckFunctionExists)
+  
+  find_path(GETTEXT_INCLUDE_DIR libintl.h
+        /usr/local/include
+        /usr/local/include/postgresql 
+        /usr/local/postgresql/include
+        /usr/local/postgresql/include/postgresql
+        /usr/include 
+        /usr/include/postgresql
+        ${PG_TMP}
+  )
+  list(APPEND CMAKE_REQUIRED_INCLUDES ${GETTEXT_INCLUDE_DIR})
+      check_include_files(libintl.h HAVE_LIBINTL_H)
+  set(CMAKE_REQUIRED_INCLUDES)
+  
+  set(GETTEXT_LIBRARIES)
+  
+  if (HAVE_LIBINTL_H)
+     check_function_exists(dgettext LIBC_HAS_DGETTEXT)
+     if (LIBC_HAS_DGETTEXT)
+        set(GETTEXT_SOURCE "built in libc")
+        set(GETTEXTLIBS_FOUND TRUE CACHE INTERNAL "")
+     else (LIBC_HAS_DGETTEXT)
+        FIND_LIBRARY(LIBINTL_LIBRARY NAMES intl libintl c
+           PATHS
+           /usr/lib
+           /usr/local/lib
+        )
+        CHECK_LIBRARY_EXISTS(${LIBINTL_LIBRARY} "dgettext" "" LIBINTL_HAS_DGETTEXT)
+        if (LIBINTL_HAS_DGETTEXT)
+           set(GETTEXT_SOURCE "in ${LIBINTL_LIBRARY}")
+           set(GETTEXT_LIBRARIES ${LIBINTL_LIBRARY} CACHE FILEPATH "path to libintl library, used for gettext")
+           set(GETTEXTLIBS_FOUND TRUE CACHE INTERNAL "")
+        endif (LIBINTL_HAS_DGETTEXT)
+     endif (LIBC_HAS_DGETTEXT)
+  endif (HAVE_LIBINTL_H)
+  
+  if (GETTEXTLIBS_FOUND)
+     if (NOT Gettext_FIND_QUIETLY)
+        message(STATUS "Found Gettext: ${GETTEXT_SOURCE}")
+     endif (NOT Gettext_FIND_QUIETLY)
+  else (GETTEXTLIBS_FOUND)
+     if (Gettext_FIND_REQUIRED)
+        message(STATUS "Could NOT find Gettext")
+     endif (Gettext_FIND_REQUIRED)
+  endif (GETTEXTLIBS_FOUND)
+  
+  MARK_AS_ADVANCED(GETTEXT_INCLUDE_DIR GETTEXT_LIBRARIES)
+
+endif (LIBC_HAS_DGETTEXT OR LIBINTL_HAS_DGETTEXT)
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt	(revision 4588)
+++ CMakeLists.txt	(working copy)
@@ -219,6 +219,28 @@
 ENDIF(MSGFMT_FOUND)
 
 ##
+## Gettext for the internationalization of CLI tools
+##
+if (WIN32)
+  set (GETTEXT_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/../gettext/include/")
+  set (GETTEXT_LIBRARIES "${CMAKE_SOURCE_DIR}/../gettext/lib/intl.lib")
+else (WIN32)
+  find_package (GettextLibs)
+  if (GETTEXTLIBS_FOUND)
+#      if (NOT "${GETTEXT_LIBRARIES}" STREQUAL ""
+#              AND NOT "${GETTEXT_LIBRARIES}" STREQUAL "/usr/lib/libc.so"
+#              AND NOT "${GETTEXT_LIBRARIES}" STREQUAL "/usr/lib64/libc.so")
+#          set (GAMMU_LIBS "${GAMMU_LIBS} -l${GETTEXT_LIBRARIES}")
+#      endif (NOT "${GETTEXT_LIBRARIES}" STREQUAL ""
+#              AND NOT "${GETTEXT_LIBRARIES}" STREQUAL "/usr/lib/libc.so"
+#              AND NOT "${GETTEXT_LIBRARIES}" STREQUAL "/usr/lib64/libc.so")
+  else (GETTEXTLIBS_FOUND)
+    MESSAGE(SEND_ERROR "gettextlibs missing")
+  endif (GETTEXTLIBS_FOUND)
+endif (WIN32)
+INCLUDE_DIRECTORIES(${GETTEXT_INCLUDE_DIR})
+
+##
 ## LAPACK (optional, enable by -DENABLE_LAPACK=YES
 ##
 

Reply via email to