26 #ifndef __TERRALIB_COMMON_INTERNAL_TRANSLATOR_H
27 #define __TERRALIB_COMMON_INTERNAL_TRANSLATOR_H
32 #ifdef TERRALIB_TRANSLATOR_ENABLED
118 friend class Singleton<Translator>;
140 const char* translate(
const std::string& message,
141 const std::string& textDomain);
156 const char* translate(
const char* message,
157 const char* textDomain);
174 const char* translate(
const std::string& textDomain,
175 const std::string& msg1,
176 const std::string& msg2,
194 const char* translate(
const char* textDomain,
209 const char* addTextDomain(
const std::string& textDomain,
const std::string& textDomainDir);
221 const char* setTextDomainCodeSet(
const std::string& textDomain,
const std::string& codeset);
228 bool exist(
const std::string& textDomain);
239 std::string getTextDomainDir(
const std::string& textDomain);
254 std::map<std::string, std::string> m_textDomainMap;
260 #endif // TERRALIB_TRANSLATOR_ENABLED
271 #ifdef TERRALIB_TRANSLATOR_ENABLED
273 #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!"
282 #define TERRALIB_TEXT_DOMAIN "terralib"
289 #define TERRALIB_TEXT_DOMAIN_DIR "locale"
299 #ifdef TERRALIB_TRANSLATOR_ENABLED
300 #define TE_ADD_TEXT_DOMAIN(domain, domaindir, codeset) \
301 if(!te::common::Translator::getInstance().exist(domain)) \
303 te::common::Translator::getInstance().addTextDomain(domain, domaindir); \
304 te::common::Translator::getInstance().setTextDomainCodeSet(domain, codeset); \
308 #define TE_ADD_TEXT_DOMAIN(domain, domaindir, codeset) ((void)0)
316 #ifdef TERRALIB_TRANSLATOR_ENABLED
317 #define TE_GENERAL_TR(message, domain) te::common::Translator::getInstance().getInstance().translate(message, domain)
319 #define TE_GENERAL_TR(message, domain) message
327 #ifdef TERRALIB_TRANSLATOR_ENABLED
328 #define TE_GENERAL_TR_PLURAL(domain, message1, message2, n) te::common::Translator::getInstance().getInstance().translate(domain, message1, message2, n)
330 #define TE_GENERAL_TR_PLURAL(domain, message1, message2, n) (n > 1 ? message2 : message1)
345 #define TE_TR(message) TE_GENERAL_TR(message, TERRALIB_TEXT_DOMAIN)
368 #define TE_TR_PLURAL(message1, message2, n) TE_GENERAL_TR_PLURAL(TERRALIB_TEXT_DOMAIN, message1, message2, n)
372 #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.