From 8393bc5b5f2f3e5304cf589c21956676c4bd04c1 Mon Sep 17 00:00:00 2001 From: Jordi Vilalta Prat Date: Tue, 30 Nov 2010 18:50:19 +0000 Subject: I18N: Don't build TranslationManager when translation is disabled. svn-id: r54684 --- common/translation.cpp | 55 +++----------------------------------------------- common/translation.h | 14 +++++++------ 2 files changed, 11 insertions(+), 58 deletions(-) (limited to 'common') diff --git a/common/translation.cpp b/common/translation.cpp index 69824dd299..47671b3a8d 100644 --- a/common/translation.cpp +++ b/common/translation.cpp @@ -38,6 +38,8 @@ #include "common/fs.h" #include "common/system.h" +#ifdef USE_TRANSLATION + DECLARE_SINGLETON(Common::TranslationManager); namespace Common { @@ -46,10 +48,6 @@ bool operator<(const TLanguage &l, const TLanguage &r) { return strcmp(l.name, r.name) < 0; } -#ifdef USE_TRANSLATION - -// Translation enabled - TranslationManager::TranslationManager() : _currentLang(-1) { loadTranslationsInfoDat(); @@ -373,53 +371,6 @@ bool TranslationManager::checkHeader(File &in) { return true; } -#else // USE_TRANSLATION - -// Translation disabled - - -TranslationManager::TranslationManager() {} - -TranslationManager::~TranslationManager() {} - -void TranslationManager::setLanguage(const String &lang) {} - -String TranslationManager::getLangById(int id) const { - return String(); -} - -int TranslationManager::parseLanguage(const String &lang) const { - return kTranslationBuiltinId; -} - -const char *TranslationManager::getTranslation(const char *message) const { - return message; -} - -String TranslationManager::getTranslation(const String &message) const { - return message; -} - -const char *TranslationManager::getTranslation(const char *message, const char *) const { - return message; -} - -String TranslationManager::getTranslation(const String &message, const String &) const { - return message; -} - -const TLangArray TranslationManager::getSupportedLanguageNames() const { - return TLangArray(); -} - -String TranslationManager::getCurrentCharset() const { - return "ASCII"; -} - -String TranslationManager::getCurrentLanguage() const { - return "C"; -} +} // End of namespace Common #endif // USE_TRANSLATION - -} // End of namespace Common diff --git a/common/translation.h b/common/translation.h index 18f55d5696..5587d0eb92 100644 --- a/common/translation.h +++ b/common/translation.h @@ -28,6 +28,8 @@ #include "common/singleton.h" #include "common/str-array.h" +#ifdef USE_TRANSLATION + namespace Common { class File; @@ -158,7 +160,6 @@ public: String getCurrentLanguage() const; private: -#ifdef USE_TRANSLATION /** * Find the translations.dat file. It looks first using the SearchMan and * then if needed using the Themepath. If found it opens the given File @@ -197,23 +198,24 @@ private: Array _currentTranslationMessages; String _currentCharset; int _currentLang; -#endif }; } // End of namespace Common #define TransMan Common::TranslationManager::instance() -#ifdef USE_TRANSLATION #define _(str) TransMan.getTranslation(str) #define _c(str, context) TransMan.getTranslation(str, context) -#else + +#else // !USE_TRANSLATION + #define _(str) str #define _c(str, context) str -#endif + +#endif // USE_TRANSLATION #define _s(str) str #define _sc(str, ctxt) str #define DECLARE_TRANSLATION_ADDITIONAL_CONTEXT(str, ctxt) -#endif +#endif // COMMON_TRANSLATION_H -- cgit v1.2.3