Hi Thomas,

T. Modes wrote:
> it compiles on Windows, but the string does not get translated. (Yes,
> I added the string to the .po-file).

thanks for the feedback. I think now it should be fixed. I found a 
number of issues:
- I forgot to set the bindtextdomain and textdomain in the patch (I am 
still not sure if I am setting them at the right place).
- the folder with the translations was not properly #defined by the 
CMake Build.
- somehow the string already existed in the .po-file, but it had a %s in 
it that should not be there.

rather than working blind, this time I actually installed support for 
multiple language on my Ubuntu box. It's just disk space...

please try again. thank you for your patience.

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 4652)
+++ src/hugin_base/huginapp/ImageCache.cpp	(working copy)
@@ -36,14 +36,18 @@
 #include <vigra_ext/Pyramid.h>
 #include <vigra_ext/FunctorAccessor.h>
 
+// gettext for internalization of strings
+#include <hugin_config.h>
+#include <libintl.h>
+#include <locale.h>
+#define _(String) gettext(String)
 
 
 namespace HuginBase {
-    
+
 using namespace std;
 using namespace vigra::functor;
 
-
 template <class T1>
 class GetRange
 {
@@ -506,7 +510,12 @@
         return it->second;
     } else {
         if (m_progress) {
-            m_progress->pushTask(AppBase::ProgressTask("Loading image: "+hugin_utils::stripPath(filename), "", 0));
+
+    // tell gettext where the translations are and which one to use
+    bindtextdomain( "hugin", INSTALL_LOCALE_DIR );
+    textdomain( "hugin" );
+
+            m_progress->pushTask(AppBase::ProgressTask(_("Loading image: ")+hugin_utils::stripPath(filename), "", 0));
         }
 #if 1
         // load images with VIGRA impex, and store either 8 bit or float images
@@ -686,7 +695,11 @@
     } else {
         if (m_progress)
         {
-            m_progress->pushTask(AppBase::ProgressTask("Scaling image: "+hugin_utils::stripPath(filename), "", 0));
+            // tell gettext where the translations are and which one to use
+            bindtextdomain( "hugin", INSTALL_LOCALE_DIR );
+            textdomain( "hugin" );
+
+            m_progress->pushTask(AppBase::ProgressTask(_("Scaling image: ")+hugin_utils::stripPath(filename), "", 0));
         }
         DEBUG_DEBUG("creating small image " << name );
         EntryPtr entry = getImage(filename);
Index: src/hugin_config.h.in.cmake
===================================================================
--- src/hugin_config.h.in.cmake	(revision 4652)
+++ src/hugin_config.h.in.cmake	(working copy)
@@ -42,7 +42,7 @@
 #cmakedefine HAVE_LOG2 0
 
 /* locate of the xrc files, as defined during configuration */
-#define INSTALL_LOCALE_DIR "${INSTALL_LOCALE_DIR}"
+#define INSTALL_LOCALE_DIR "${INSTALL_LOCALE_DIR}/"
 
 /* Location for data, as defined during configuration*/
 #define INSTALL_DATA_DIR "${INSTALL_DATA_DIR}/"
Index: src/CMakeLists.txt
===================================================================
--- src/CMakeLists.txt	(revision 4652)
+++ 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: CMakeLists.txt
===================================================================
--- CMakeLists.txt	(revision 4652)
+++ 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
 ##
 
@@ -283,6 +305,7 @@
 ENDIF(NOT MANDIR AND NOT $ENV{MANDIR} STREQUAL "")
 
 SET(LOCALEDIR share/locale) 
+SET(INSTALL_LOCALE_DIR ${CMAKE_INSTALL_PREFIX}/${LOCALEDIR})
 SET(ICONDIR share/icons) 
 SET(LINKDIR share/applications)
 SET(LIBDIR  lib${LIB_SUFFIX})

Reply via email to