diff options
author | Cameron Cawley | 2018-05-27 22:14:06 +0100 |
---|---|---|
committer | Thierry Crozat | 2018-06-03 17:43:30 +0100 |
commit | e1c83f8e8707abb268b3536c2993bcdd9dfee25e (patch) | |
tree | d89d8ae0fc4c981679ea073d6b7d63d5c48be9d0 /backends/platform/sdl/win32 | |
parent | 6f60ef55ad3b9a0e6732278221a55121d975192e (diff) | |
download | scummvm-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/platform/sdl/win32')
-rw-r--r-- | backends/platform/sdl/win32/win32.cpp | 25 | ||||
-rw-r--r-- | backends/platform/sdl/win32/win32.h | 2 |
2 files changed, 27 insertions, 0 deletions
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: |