From f1b152ca5e20f9575c7bfe38d389c08d49eca067 Mon Sep 17 00:00:00 2001
From: Emmanuel Christophe <emmanuel.christophe@orfeo-toolbox.org>
Date: Thu, 15 Oct 2009 13:13:23 +0800
Subject: [PATCH] ENH: language is now chosen from the config file

---
 Code/Common/otbI18n.h | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/Code/Common/otbI18n.h b/Code/Common/otbI18n.h
index 124a406dcb..6131adea7b 100644
--- a/Code/Common/otbI18n.h
+++ b/Code/Common/otbI18n.h
@@ -15,10 +15,12 @@
      PURPOSE.  See the above copyright notices for more information.
 
 =========================================================================*/
+
 #ifndef __otbI18n_h
 #define __otbI18n_h
 
 #include "otbConfigure.h"
+#include "otbConfigurationFile.h"
 
 #if defined(OTB_I18N)
 #include <libintl.h>
@@ -30,10 +32,13 @@
 
 #if defined(OTB_I18N)
 #define otbI18nMacro() \
-  setlocale( LC_ALL, QUOTEME(OTB_LANG) );\
+  typedef otb::ConfigurationFile        ConfigurationType;\
+  ConfigurationType::Pointer conf = ConfigurationType::GetInstance();\
+  std::string lang = conf->GetParameter<std::string>("OTB_LANG");\
+  setlocale( LC_ALL, lang.c_str() );\
   bindtextdomain( "otb", QUOTEME(OTB_LANG_LOCATION) );\
   textdomain( "otb" );\
-  std::cout << "Language: " << QUOTEME(OTB_LANG) << std::endl;\
+  std::cout << "Language: " << lang << std::endl;\
   std::cout << "Language location: " << QUOTEME(OTB_LANG_LOCATION) << std::endl;
 #else
 #define otbI18nMacro()\
-- 
GitLab