diff options
-rw-r--r-- | base/main.cpp | 2 | ||||
-rw-r--r-- | common/translation.cpp | 55 | ||||
-rw-r--r-- | common/translation.h | 14 | ||||
-rw-r--r-- | gui/ThemeEngine.cpp | 2 | ||||
-rw-r--r-- | gui/gui-manager.cpp | 2 | ||||
-rw-r--r-- | gui/options.cpp | 6 |
6 files changed, 23 insertions, 58 deletions
diff --git a/base/main.cpp b/base/main.cpp index c6fffe5ce3..f4cd2a531e 100644 --- a/base/main.cpp +++ b/base/main.cpp @@ -481,7 +481,9 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) { GUI::GuiManager::destroy(); Common::ConfigManager::destroy(); Common::SearchManager::destroy(); +#ifdef USE_TRANSLATION Common::TranslationManager::destroy(); +#endif return 0; } 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<PoMessageEntry> _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 diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp index 6c2a87a7df..beb17b0c88 100644 --- a/gui/ThemeEngine.cpp +++ b/gui/ThemeEngine.cpp @@ -591,7 +591,9 @@ bool ThemeEngine::addFont(TextData textId, const Common::String &file) { FontMan.assignFontToName(file, _texts[textId]->_fontPtr); } +#ifdef USE_TRANSLATION TransMan.setLanguage("C"); +#endif warning("Failed to load localized font '%s'. Using non-localized font and default GUI language instead", file.c_str()); } } diff --git a/gui/gui-manager.cpp b/gui/gui-manager.cpp index a8883b793b..af567c65d8 100644 --- a/gui/gui-manager.cpp +++ b/gui/gui-manager.cpp @@ -64,8 +64,10 @@ GuiManager::GuiManager() : _redrawStatus(kRedrawDisabled), _stateIsSaved(false), // Clear the cursor memset(_cursor, 0xFF, sizeof(_cursor)); +#ifdef USE_TRANSLATION // Enable translation TransMan.setLanguage(ConfMan.get("gui_language").c_str()); +#endif // USE_TRANSLATION ConfMan.registerDefault("gui_theme", "scummmodern"); Common::String themefile(ConfMan.get("gui_theme")); diff --git a/gui/options.cpp b/gui/options.cpp index b59278a4f1..59346da967 100644 --- a/gui/options.cpp +++ b/gui/options.cpp @@ -1313,9 +1313,12 @@ void GlobalOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint3 Common::String theme = browser.getSelected(); // FIXME: Actually, any changes (including the theme change) should // only become active *after* the options dialog has closed. +#ifdef USE_TRANSLATION Common::String lang = TransMan.getCurrentLanguage(); +#endif Common::String oldTheme = g_gui.theme()->getThemeId(); if (g_gui.loadNewTheme(theme)) { +#ifdef USE_TRANSLATION // If the charset has changed, it means the font were not found for the // new theme. Since for the moment we do not support change of translation // language without restarting, we let the user know about this. @@ -1325,9 +1328,12 @@ void GlobalOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint3 MessageDialog error(_("The theme you selected does not support your current language. If you want to use this theme you need to switch to another language first.")); error.runModal(); } else { +#endif _curTheme->setLabel(g_gui.theme()->getThemeName()); ConfMan.set("gui_theme", theme); +#ifdef USE_TRANSLATION } +#endif } draw(); } |