30#ifndef __TERRALIB_CORE_TRANSLATOR_TRANSLATOR_H__
31#define __TERRALIB_CORE_TRANSLATOR_TRANSLATOR_H__
144 const std::string& msg2,
189 bool exist(
const std::string& textDomain);
230#ifdef TERRALIB_TRANSLATOR_ENABLED
232#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!"
244#ifdef TERRALIB_TRANSLATOR_ENABLED
245 #define TE_ADD_TEXT_DOMAIN(domain, dir) te::core::Translator::instance().addTextDomain(domain, dir)
247 #define TE_ADD_TEXT_DOMAIN(domain, dir) ((void)0)
264#define TE_TR(message) te::core::Translator::instance().translate(message).c_str()
291#define TE_TR_PLURAL(message1, message2, n) te::core::Translator::instance().translate(message1, message2, n).c_str()
300#define TE_TR_LANGUAGE(locale) te::core::Translator::instance().setLocale(locale)
This singleton is designed to deal with multi-language text translation in TerraLib.
std::string translate(const char *message)
It tries to translate the specified text string.
std::string translate(const std::string &message)
It tries to translate the specified text string.
bool m_loadTranslationFiles
void setLocale(const std::string &locale)
It sets the locale for the Translator.
boost::locale::generator * m_localeGenerator
Translator(Translator const &)
Singleton copy constructor must be private or protected.
std::string translate(const std::string &msg1, const std::string &msg2, unsigned int n)
It tries to translate the specified text string accounting for plural forms.
std::map< std::string, std::vector< std::string > > m_textDomainMap
A vector from text domains to base directory for the message catalog.
std::string m_locale
If not empty, it is the current locale.
bool exist(const std::string &textDomain)
It returns true if the text domain (text catalog) exists and false otherwise.
~Translator()
Singleton destructor must be private or protected.
void loadAllTranslations(const std::string &translationsDir)
It loads all translations on the translation share folder.
Translator & operator=(Translator const &)
Singleton copy assignment operator must be private or protected.
static Translator & instance()
std::locale m_translationLocale
Translator()
Singleton constructor must be private or protected.
void addTextDomain(const std::string &textDomain, const std::string &dir)
It adds a new text domain (text catalog).
void updateTranslationFiles()
Initializes the translation files, loading it into memory. It will overwrite the pior loaded list.
std::string translate(const char *msg1, const char *msg2, unsigned int n)
It tries to translate the specified text string accounting for plural forms.