26 #ifndef __TERRALIB_COMMON_INTERNAL_TRANSLATOR_H
27 #define __TERRALIB_COMMON_INTERNAL_TRANSLATOR_H
30 #include "../BuildConfig.h"
33 #ifdef TERRALIB_TRANSLATOR_ENABLED
119 friend class Singleton<Translator>;
141 const char* translate(
const std::string& message,
142 const std::string& textDomain);
157 const char* translate(
const char* message,
158 const char* textDomain);
175 const char* translate(
const std::string& textDomain,
176 const std::string& msg1,
177 const std::string& msg2,
195 const char* translate(
const char* textDomain,
210 const char* addTextDomain(
const std::string& textDomain,
const std::string& textDomainDir);
222 const char* setTextDomainCodeSet(
const std::string& textDomain,
const std::string& codeset);
229 bool exist(
const std::string& textDomain);
240 std::string getTextDomainDir(
const std::string& textDomain);
255 std::map<std::string, std::string> m_textDomainMap;
261 #endif // TERRALIB_TRANSLATOR_ENABLED
272 #ifdef TERRALIB_TRANSLATOR_ENABLED
274 #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!"
283 #define TERRALIB_TEXT_DOMAIN "terralib"
290 #define TERRALIB_TEXT_DOMAIN_DIR "locale"
300 #ifdef TERRALIB_TRANSLATOR_ENABLED
301 #define TE_ADD_TEXT_DOMAIN(domain, domaindir, codeset) \
302 if(!te::common::Translator::getInstance().exist(domain)) \
304 te::common::Translator::getInstance().addTextDomain(domain, domaindir); \
305 te::common::Translator::getInstance().setTextDomainCodeSet(domain, codeset); \
309 #define TE_ADD_TEXT_DOMAIN(domain, domaindir, codeset) ((void)0)
317 #ifdef TERRALIB_TRANSLATOR_ENABLED
318 #define TE_GENERAL_TR(message, domain) te::common::Translator::getInstance().getInstance().translate(message, domain)
320 #define TE_GENERAL_TR(message, domain) message
328 #ifdef TERRALIB_TRANSLATOR_ENABLED
329 #define TE_GENERAL_TR_PLURAL(domain, message1, message2, n) te::common::Translator::getInstance().getInstance().translate(domain, message1, message2, n)
331 #define TE_GENERAL_TR_PLURAL(domain, message1, message2, n) (n > 1 ? message2 : message1)
346 #define TE_TR(message) TE_GENERAL_TR(message, TERRALIB_TEXT_DOMAIN)
369 #define TE_TR_PLURAL(message1, message2, n) TE_GENERAL_TR_PLURAL(TERRALIB_TEXT_DOMAIN, message1, message2, n)
373 #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.