Commit 7c2708ea authored by Emmanuel Christophe's avatar Emmanuel Christophe

ENH: internationalization working with macro

parent 5af34a88
......@@ -556,6 +556,7 @@ FIND_PACKAGE(Gettext)
IF(GETTEXT_FOUND)
SET(OTB_I18N 1)
SET(OTB_LANG "en" CACHE STRING "OTB internationalization (Experimental)")#might want to get the Locale from the system here
SET(OTB_LANG_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/Locale)
#TODO compile the po into mo
ELSE(GETTEXT_FOUND)
SET(OTB_I18N 0)
......
/*=========================================================================
Program: ORFEO Toolbox
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
See OTBCopyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef __otbI18n_h
#define __otbI18n_h
#include "otbConfigure.h"
#if defined(OTB_I18N)
#include <libintl.h>
#endif
//To enable stringization after macro replacement
#define _QUOTEME(x) #x
#define QUOTEME(x) _QUOTEME(x)
#if defined(OTB_I18N)
#define otbI18nMacro() \
setlocale( LC_ALL, QUOTEME(OTB_LANG) );\
bindtextdomain( "otb", QUOTEME(OTB_LANG_LOCATION) );\
textdomain( "otb" );\
std::cout << "Language: " << QUOTEME(OTB_LANG) << std::endl;\
std::cout << "Language location: " << QUOTEME(OTB_LANG_LOCATION) << std::endl;
#else
#define otbI18nMacro()\
std::cout << "No internationalization" << std::endl;
#endif
#if defined(OTB_I18N)
#define otbGetTextMacro(msgString)\
gettext(msgString)
#else
#define otbGetTextMacro(msgString)\
msgString
#endif
#endif
\ No newline at end of file
......@@ -135,3 +135,5 @@ SET(OTB_USE_EXTERNAL_BOOST "@OTB_USE_EXTERNAL_BOOST@")
# Internationalization
SET(OTB_I18N "@OTB_I18N@")
SET(OTB_LANG "@OTB_LANG@")
SET(OTB_LANG_LOCATION "@OTB_LANG_LOCATION@")
......@@ -66,4 +66,6 @@
/* Use Visu/Gui configurations */
#cmakedefine OTB_USE_VISU_GUI
#cmakedefine OTB_I18N
\ No newline at end of file
#cmakedefine OTB_I18N
#define OTB_LANG @OTB_LANG@
#define OTB_LANG_LOCATION @OTB_LANG_LOCATION@
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment