diff options
| -rw-r--r-- | backends/text-to-speech/linux/linux-text-to-speech.cpp | 6 | ||||
| -rw-r--r-- | base/main.cpp | 21 | ||||
| -rw-r--r-- | gui/ThemeEngine.cpp | 14 | ||||
| -rw-r--r-- | gui/gui-manager.cpp | 1 | 
4 files changed, 36 insertions, 6 deletions
| diff --git a/backends/text-to-speech/linux/linux-text-to-speech.cpp b/backends/text-to-speech/linux/linux-text-to-speech.cpp index 758996dad8..633c107727 100644 --- a/backends/text-to-speech/linux/linux-text-to-speech.cpp +++ b/backends/text-to-speech/linux/linux-text-to-speech.cpp @@ -91,7 +91,11 @@ void LinuxTextToSpeechManager::init() {  	updateVoices();  	_ttsState->_activeVoice = 0; -	setLanguage(Common::String("en")); +#ifdef USE_TRANSLATION +	setLanguage(TransMan.getCurrentLanguage()); +#else +	setLanguage("en"); +#endif  }  LinuxTextToSpeechManager::~LinuxTextToSpeechManager() { diff --git a/base/main.cpp b/base/main.cpp index 352dbf9ab4..656a24b94b 100644 --- a/base/main.cpp +++ b/base/main.cpp @@ -51,6 +51,7 @@  #include "common/textconsole.h"  #include "common/tokenizer.h"  #include "common/translation.h" +#include "common/text-to-speech.h"  #include "common/osd_message_queue.h"  #include "gui/gui-manager.h" @@ -260,8 +261,16 @@ static Common::Error runGame(const Plugin *plugin, OSystem &system, const Common  	    && ConfMan.getBool("gui_use_game_language")  	    && ConfMan.hasKey("language")) {  		TransMan.setLanguage(ConfMan.get("language")); +#ifdef USE_TTS +		Common::TextToSpeechManager *ttsMan; +		if ((ttsMan = g_system->getTextToSpeechManager()) != nullptr) { +			Common::String language = ConfMan.get("language"); +			language.setChar(2, '\0'); +			ttsMan->setLanguage(language); +		} +#endif // USE_TTS  	} -#endif +#endif // USE_TRANSLATION  	// Initialize any game-specific keymaps  	engine->initKeymap(); @@ -289,7 +298,15 @@ static Common::Error runGame(const Plugin *plugin, OSystem &system, const Common  #ifdef USE_TRANSLATION  	TransMan.setLanguage(previousLanguage); -#endif +#ifdef USE_TTS +		Common::TextToSpeechManager *ttsMan; +		if ((ttsMan = g_system->getTextToSpeechManager()) != nullptr) { +			Common::String language = ConfMan.get("language"); +			language.setChar(2, '\0'); +			ttsMan->setLanguage(language); +		} +#endif // USE_TTS +#endif // USE_TRANSLATION  	// Return result (== 0 means no error)  	return result; diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp index 598d9c2ab8..dd074ccef3 100644 --- a/gui/ThemeEngine.cpp +++ b/gui/ThemeEngine.cpp @@ -530,7 +530,12 @@ bool ThemeEngine::addFont(TextData textId, const Common::String &file, const Com  				error("Couldn't load font '%s'/'%s'", file.c_str(), scalableFile.c_str());  #ifdef USE_TRANSLATION  				TransMan.setLanguage("C"); -#endif +#ifdef USE_TTS +				Common::TextToSpeechManager *ttsMan; +				if ((ttsMan = g_system->getTextToSpeechManager()) != nullptr) +					ttsMan->setLanguage("en"); +#endif // USE_TTS +#endif // USE_TRANSLATION  				return false; // fall-back attempt failed  			}  			// Success in fall-back attempt to standard (non-localized) font. @@ -538,7 +543,12 @@ bool ThemeEngine::addFont(TextData textId, const Common::String &file, const Com  			// FIXME If we return false anyway why would we attempt the fall-back in the first place?  #ifdef USE_TRANSLATION  			TransMan.setLanguage("C"); -#endif +#ifdef USE_TTS +				Common::TextToSpeechManager *ttsMan; +				if ((ttsMan = g_system->getTextToSpeechManager()) != nullptr) +					ttsMan->setLanguage("en"); +#endif // USE_TTS +#endif // USE_TRANSLATION  			// Returning true here, would allow falling back to standard fonts for the missing ones,  			// but that leads to "garbage" glyphs being displayed on screen for non-Latin languages  			return false; diff --git a/gui/gui-manager.cpp b/gui/gui-manager.cpp index c77af7c71f..b149908ffe 100644 --- a/gui/gui-manager.cpp +++ b/gui/gui-manager.cpp @@ -632,7 +632,6 @@ void GuiManager::initTextToSpeech() {  	Common::String currentLanguage = TransMan.getCurrentLanguage();  	if (currentLanguage != "C") {  		currentLanguage.setChar('\0', 2); -		debug("%s", TransMan.getCurrentCharset().c_str());  		ttsMan->setLanguage(currentLanguage);  	}  #endif | 
