[Scummvm-cvs-logs] SF.net SVN: scummvm:[54684] scummvm/trunk
jvprat at users.sourceforge.net
jvprat at users.sourceforge.net
Tue Nov 30 19:50:19 CET 2010
Revision: 54684
http://scummvm.svn.sourceforge.net/scummvm/?rev=54684&view=rev
Author: jvprat
Date: 2010-11-30 18:50:19 +0000 (Tue, 30 Nov 2010)
Log Message:
-----------
I18N: Don't build TranslationManager when translation is disabled.
Modified Paths:
--------------
scummvm/trunk/base/main.cpp
scummvm/trunk/common/translation.cpp
scummvm/trunk/common/translation.h
scummvm/trunk/gui/ThemeEngine.cpp
scummvm/trunk/gui/gui-manager.cpp
scummvm/trunk/gui/options.cpp
Modified: scummvm/trunk/base/main.cpp
===================================================================
--- scummvm/trunk/base/main.cpp 2010-11-30 17:55:41 UTC (rev 54683)
+++ scummvm/trunk/base/main.cpp 2010-11-30 18:50:19 UTC (rev 54684)
@@ -481,7 +481,9 @@
GUI::GuiManager::destroy();
Common::ConfigManager::destroy();
Common::SearchManager::destroy();
+#ifdef USE_TRANSLATION
Common::TranslationManager::destroy();
+#endif
return 0;
}
Modified: scummvm/trunk/common/translation.cpp
===================================================================
--- scummvm/trunk/common/translation.cpp 2010-11-30 17:55:41 UTC (rev 54683)
+++ scummvm/trunk/common/translation.cpp 2010-11-30 18:50:19 UTC (rev 54684)
@@ -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 @@
return strcmp(l.name, r.name) < 0;
}
-#ifdef USE_TRANSLATION
-
-// Translation enabled
-
TranslationManager::TranslationManager() : _currentLang(-1) {
loadTranslationsInfoDat();
@@ -373,53 +371,6 @@
return true;
}
-#else // USE_TRANSLATION
+} // End of namespace Common
-// 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";
-}
-
#endif // USE_TRANSLATION
-
-} // End of namespace Common
Modified: scummvm/trunk/common/translation.h
===================================================================
--- scummvm/trunk/common/translation.h 2010-11-30 17:55:41 UTC (rev 54683)
+++ scummvm/trunk/common/translation.h 2010-11-30 18:50:19 UTC (rev 54684)
@@ -28,6 +28,8 @@
#include "common/singleton.h"
#include "common/str-array.h"
+#ifdef USE_TRANSLATION
+
namespace Common {
class File;
@@ -158,7 +160,6 @@
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 @@
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
Modified: scummvm/trunk/gui/ThemeEngine.cpp
===================================================================
--- scummvm/trunk/gui/ThemeEngine.cpp 2010-11-30 17:55:41 UTC (rev 54683)
+++ scummvm/trunk/gui/ThemeEngine.cpp 2010-11-30 18:50:19 UTC (rev 54684)
@@ -591,7 +591,9 @@
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());
}
}
Modified: scummvm/trunk/gui/gui-manager.cpp
===================================================================
--- scummvm/trunk/gui/gui-manager.cpp 2010-11-30 17:55:41 UTC (rev 54683)
+++ scummvm/trunk/gui/gui-manager.cpp 2010-11-30 18:50:19 UTC (rev 54684)
@@ -64,8 +64,10 @@
// 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"));
Modified: scummvm/trunk/gui/options.cpp
===================================================================
--- scummvm/trunk/gui/options.cpp 2010-11-30 17:55:41 UTC (rev 54683)
+++ scummvm/trunk/gui/options.cpp 2010-11-30 18:50:19 UTC (rev 54684)
@@ -1313,9 +1313,12 @@
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 @@
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();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list