26 #ifndef __TERRALIB_COMMON_INTERNAL_TRANSLATOR_H
27 #define __TERRALIB_COMMON_INTERNAL_TRANSLATOR_H
32 #include "terralib_config.h"
34 #ifdef TERRALIB_TRANSLATOR_ENABLED
120 friend class Singleton<Translator>;
142 const char* translate(
const std::string& message,
143 const std::string& textDomain);
158 const char* translate(
const char* message,
159 const char* textDomain);
176 const char* translate(
const std::string& textDomain,
177 const std::string& msg1,
178 const std::string& msg2,
196 const char* translate(
const char* textDomain,
211 const char* addTextDomain(
const std::string& textDomain,
const std::string& textDomainDir);
223 const char* setTextDomainCodeSet(
const std::string& textDomain,
const std::string& codeset);
230 bool exist(
const std::string& textDomain);
241 std::string getTextDomainDir(
const std::string& textDomain);
256 std::map<std::string, std::string> m_textDomainMap;
262 #endif // TERRALIB_TRANSLATOR_ENABLED
273 #ifdef TERRALIB_TRANSLATOR_ENABLED
275 #error "The TE_TR macro has been already defined by another application or code. Please, inform TerraLib Development Team <terralib-team@dpi.inpe.br>, we will be glad to help solving this problem!"
284 #define TERRALIB_TEXT_DOMAIN "terralib"
291 #define TERRALIB_TEXT_DOMAIN_DIR "locale"
301 #ifdef TERRALIB_TRANSLATOR_ENABLED
302 #define TE_ADD_TEXT_DOMAIN(domain, domaindir, codeset) \
303 if(!te::common::Translator::getInstance().exist(domain)) \
305 te::common::Translator::getInstance().addTextDomain(domain, domaindir); \
306 te::common::Translator::getInstance().setTextDomainCodeSet(domain, codeset); \
310 #define TE_ADD_TEXT_DOMAIN(domain, domaindir, codeset) ((void)0)
318 #ifdef TERRALIB_TRANSLATOR_ENABLED
319 #define TE_GENERAL_TR(message, domain) te::common::Translator::getInstance().getInstance().translate(message, domain)
321 #define TE_GENERAL_TR(message, domain) message
329 #ifdef TERRALIB_TRANSLATOR_ENABLED
330 #define TE_GENERAL_TR_PLURAL(domain, message1, message2, n) te::common::Translator::getInstance().getInstance().translate(domain, message1, message2, n)
332 #define TE_GENERAL_TR_PLURAL(domain, message1, message2, n) (n > 1 ? message2 : message1)
347 #define TE_TR(message) TE_GENERAL_TR(message, TERRALIB_TEXT_DOMAIN)
370 #define TE_TR_PLURAL(message1, message2, n) TE_GENERAL_TR_PLURAL(TERRALIB_TEXT_DOMAIN, message1, message2, n)
374 #endif // __TERRALIB_COMMON_INTERNAL_TRANSLATOR_H
Configuration flags for the TerraLib Common Runtime module.
Template support for singleton pattern.
#define TECOMMONEXPORT
You can use this macro in order to export/import classes and functions from this module.