aboutsummaryrefslogtreecommitdiff
path: root/backends
diff options
context:
space:
mode:
authorCameron Cawley2018-05-27 22:14:06 +0100
committerThierry Crozat2018-06-03 17:43:30 +0100
commite1c83f8e8707abb268b3536c2993bcdd9dfee25e (patch)
treed89d8ae0fc4c981679ea073d6b7d63d5c48be9d0 /backends
parent6f60ef55ad3b9a0e6732278221a55121d975192e (diff)
downloadscummvm-rg350-e1c83f8e8707abb268b3536c2993bcdd9dfee25e.tar.gz
scummvm-rg350-e1c83f8e8707abb268b3536c2993bcdd9dfee25e.tar.bz2
scummvm-rg350-e1c83f8e8707abb268b3536c2993bcdd9dfee25e.zip
WIN32: Move Windows-specific implementation of getSystemLanguage out of OSystem_SDL
Diffstat (limited to 'backends')
-rw-r--r--backends/platform/sdl/sdl.cpp23
-rw-r--r--backends/platform/sdl/win32/win32.cpp25
-rw-r--r--backends/platform/sdl/win32/win32.h2
3 files changed, 28 insertions, 22 deletions
diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp
index 72af6d592a..f9affa0a1c 100644
--- a/backends/platform/sdl/sdl.cpp
+++ b/backends/platform/sdl/sdl.cpp
@@ -436,27 +436,7 @@ void OSystem_SDL::logMessage(LogMessageType::Type type, const char *message) {
}
Common::String OSystem_SDL::getSystemLanguage() const {
-#if defined(USE_DETECTLANG) && !defined(_WIN32_WCE)
-#ifdef WIN32
- // We can not use "setlocale" (at least not for MSVC builds), since it
- // will return locales like: "English_USA.1252", thus we need a special
- // way to determine the locale string for Win32.
- char langName[9];
- char ctryName[9];
-
- const LCID languageIdentifier = GetUserDefaultUILanguage();
-
- if (GetLocaleInfo(languageIdentifier, LOCALE_SISO639LANGNAME, langName, sizeof(langName)) != 0 &&
- GetLocaleInfo(languageIdentifier, LOCALE_SISO3166CTRYNAME, ctryName, sizeof(ctryName)) != 0) {
- Common::String localeName = langName;
- localeName += "_";
- localeName += ctryName;
-
- return localeName;
- } else {
- return ModularBackend::getSystemLanguage();
- }
-#else // WIN32
+#if defined(USE_DETECTLANG) && !defined(WIN32)
// Activating current locale settings
const Common::String locale = setlocale(LC_ALL, "");
@@ -484,7 +464,6 @@ Common::String OSystem_SDL::getSystemLanguage() const {
return Common::String(locale.c_str(), length);
}
-#endif // WIN32
#else // USE_DETECTLANG
return ModularBackend::getSystemLanguage();
#endif // USE_DETECTLANG
diff --git a/backends/platform/sdl/win32/win32.cpp b/backends/platform/sdl/win32/win32.cpp
index 073ad741bb..f262ff090b 100644
--- a/backends/platform/sdl/win32/win32.cpp
+++ b/backends/platform/sdl/win32/win32.cpp
@@ -150,6 +150,31 @@ bool OSystem_Win32::openUrl(const Common::String &url) {
return true;
}
+Common::String OSystem_Win32::getSystemLanguage() const {
+#if defined(USE_DETECTLANG) && defined(USE_TRANSLATION)
+ // We can not use "setlocale" (at least not for MSVC builds), since it
+ // will return locales like: "English_USA.1252", thus we need a special
+ // way to determine the locale string for Win32.
+ char langName[9];
+ char ctryName[9];
+
+ const LCID languageIdentifier = GetUserDefaultUILanguage();
+
+ if (GetLocaleInfo(languageIdentifier, LOCALE_SISO639LANGNAME, langName, sizeof(langName)) != 0 &&
+ GetLocaleInfo(languageIdentifier, LOCALE_SISO3166CTRYNAME, ctryName, sizeof(ctryName)) != 0) {
+ Common::String localeName = langName;
+ localeName += "_";
+ localeName += ctryName;
+
+ return localeName;
+ } else {
+ return ModularBackend::getSystemLanguage();
+ }
+#endif // USE_DETECTLANG
+ // Falback to SDL implementation
+ return OSystem_SDL::getSystemLanguage();
+}
+
Common::String OSystem_Win32::getScreenshotsPath() {
Common::String screenshotsPath = ConfMan.get("screenshotpath");
if (!screenshotsPath.empty()) {
diff --git a/backends/platform/sdl/win32/win32.h b/backends/platform/sdl/win32/win32.h
index 6764a7fe49..8523345d3c 100644
--- a/backends/platform/sdl/win32/win32.h
+++ b/backends/platform/sdl/win32/win32.h
@@ -38,6 +38,8 @@ public:
virtual bool openUrl(const Common::String &url);
+ virtual Common::String getSystemLanguage() const;
+
virtual Common::String getScreenshotsPath();
protected: