Use SDL locale

This commit is contained in:
2024-12-28 13:31:37 +02:00
committed by Ari Vuollet
parent 9a6c0dd5f4
commit 0d546a82c7
6 changed files with 43 additions and 6 deletions

View File

@@ -2107,6 +2107,7 @@ bool LinuxPlatform::Init()
DeviceId.D = (uint32)UnixCpu.ClockSpeed * UnixCpu.LogicalProcessorCount * UnixCpu.ProcessorCoreCount * UnixCpu.CacheLineSize;
}
#if !PLATFORM_SDL
// Get user locale string
setlocale(LC_ALL, "");
const char* locale = setlocale(LC_CTYPE, NULL);
@@ -2116,6 +2117,7 @@ bool LinuxPlatform::Init()
UserLocale.Replace('_', '-');
if (UserLocale == TEXT("C"))
UserLocale = TEXT("en");
#endif
// Get computer name string
gethostname(buffer, UNIX_APP_BUFF_SIZE);
@@ -2680,6 +2682,7 @@ void LinuxPlatform::Exit()
#endif
}
#if !PLATFORM_SDL
int32 LinuxPlatform::GetDpi()
{
return SystemDpi;
@@ -2689,6 +2692,7 @@ String LinuxPlatform::GetUserLocaleName()
{
return UserLocale;
}
#endif
String LinuxPlatform::GetComputerName()
{
@@ -2896,14 +2900,12 @@ bool LinuxPlatform::SetWorkingDirectory(const String& path)
return chdir(StringAsANSI<>(*path).Get()) != 0;
}
#if !PLATFORM_SDL
Window* LinuxPlatform::CreateWindow(const CreateWindowSettings& settings)
{
#if PLATFORM_SDL
return New<SDLWindow>(settings);
#else
return New<LinuxWindow>(settings);
#endif
}
#endif
extern char **environ;