[Scummvm-cvs-logs] SF.net SVN: scummvm:[54516] scummvm/trunk

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Sun Nov 28 03:12:34 CET 2010


Revision: 54516
          http://scummvm.svn.sourceforge.net/scummvm/?rev=54516&view=rev
Author:   lordhoto
Date:     2010-11-28 02:12:33 +0000 (Sun, 28 Nov 2010)

Log Message:
-----------
BACKEND: Switch OSystem::getSystemLanguage return type to Common::String.

This is done as discussed on -devel.

Modified Paths:
--------------
    scummvm/trunk/backends/platform/sdl/sdl.cpp
    scummvm/trunk/backends/platform/sdl/sdl.h
    scummvm/trunk/common/system.cpp
    scummvm/trunk/common/system.h
    scummvm/trunk/common/translation.cpp

Modified: scummvm/trunk/backends/platform/sdl/sdl.cpp
===================================================================
--- scummvm/trunk/backends/platform/sdl/sdl.cpp	2010-11-27 23:09:19 UTC (rev 54515)
+++ scummvm/trunk/backends/platform/sdl/sdl.cpp	2010-11-28 02:12:33 UTC (rev 54516)
@@ -699,7 +699,7 @@
 #endif
 }
 
-Common::Language OSystem_SDL::getSystemLanguage() const {
+Common::String OSystem_SDL::getSystemLanguage() const {
 #ifdef USE_DETECTLANG
 #ifdef WIN32
 	// We can not use "setlocale" (at least not for MSVC builds), since it
@@ -727,9 +727,9 @@
 		localeName += "_";
 		localeName += ctryName;
 
-		return Common::parseLanguageFromLocale(localeName.c_str());
+		return localeName;
 	} else {
-		return Common::UNK_LANG;
+		return BaseBackend::getSystemLanguage();
 	}
 #else // WIN32
 	// Activating current locale settings
@@ -737,7 +737,7 @@
 
 	// Detect the language from the locale
 	if (!locale) {
-		return Common::UNK_LANG;
+		return BaseBackend::getSystemLanguage();
 	} else {
 		int length = 0;
 
@@ -752,11 +752,11 @@
 				break;
 		}
 
-		return Common::parseLanguageFromLocale(Common::String(locale, length).c_str());
+		return Common::String(locale, length);
 	}
 #endif // WIN32
 #else // USE_DETECTLANG
-	return Common::UNK_LANG;
+	return BaseBackend::getSystemLanguage();
 #endif // USE_DETECTLANG
 }
 

Modified: scummvm/trunk/backends/platform/sdl/sdl.h
===================================================================
--- scummvm/trunk/backends/platform/sdl/sdl.h	2010-11-27 23:09:19 UTC (rev 54515)
+++ scummvm/trunk/backends/platform/sdl/sdl.h	2010-11-28 02:12:33 UTC (rev 54516)
@@ -195,7 +195,7 @@
 	// Logging
 	virtual void logMessage(LogMessageType::Type type, const char *message);
 
-	virtual Common::Language getSystemLanguage() const;
+	virtual Common::String getSystemLanguage() const;
 
 	void deinit();
 

Modified: scummvm/trunk/common/system.cpp
===================================================================
--- scummvm/trunk/common/system.cpp	2010-11-27 23:09:19 UTC (rev 54515)
+++ scummvm/trunk/common/system.cpp	2010-11-28 02:12:33 UTC (rev 54516)
@@ -90,7 +90,7 @@
 	fflush(output);
 }
 
-Common::Language OSystem::getSystemLanguage() const {
-	return Common::UNK_LANG;
+Common::String OSystem::getSystemLanguage() const {
+	return "en_US";
 }
 

Modified: scummvm/trunk/common/system.h
===================================================================
--- scummvm/trunk/common/system.h	2010-11-27 23:09:19 UTC (rev 54515)
+++ scummvm/trunk/common/system.h	2010-11-28 02:12:33 UTC (rev 54516)
@@ -30,7 +30,6 @@
 #include "common/noncopyable.h"
 #include "common/rect.h"
 #include "common/list.h" // For OSystem::getSupportedFormats()
-#include "common/util.h" // For Common::Language
 
 #include "graphics/pixelformat.h"
 
@@ -1057,18 +1056,17 @@
 	 * This returns the currently set up locale of the system, on which
 	 * ScummVM is run.
 	 *
-	 * In case the locale can not be prepresented by Common::Language the
-	 * backend should return Common::UNK_LANG.
+	 * The format of the locale is language_country. These should match
+	 * the POSIX locale values.
 	 *
-	 * @see Common::Language
-	 * @see Common::UNK_LANG
+	 * For information about POSIX locales read here:
+	 * http://en.wikipedia.org/wiki/Locale#POSIX-type_platforms
+	 * 
+	 * The default implementation returns "en_US".
 	 *
-	 * The default implementation returns Common::UNK_LANG.
-	 *
-	 *
 	 * @return locale of the system
 	 */
-	virtual Common::Language getSystemLanguage() const;
+	virtual Common::String getSystemLanguage() const;
 
 	//@}
 };

Modified: scummvm/trunk/common/translation.cpp
===================================================================
--- scummvm/trunk/common/translation.cpp	2010-11-27 23:09:19 UTC (rev 54515)
+++ scummvm/trunk/common/translation.cpp	2010-11-28 02:12:33 UTC (rev 54516)
@@ -53,11 +53,7 @@
 TranslationManager::TranslationManager() : _currentLang(-1) {
 	loadTranslationsInfoDat();
 
-	const char *locale = getLanguageLocale(g_system->getSystemLanguage());
-	if (!locale)
-		_syslang = "C";
-	else
-		_syslang = locale;
+	_syslang = g_system->getSystemLanguage();
 
 	// Set the default language
 	setLanguage("");


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