Fix locale on Linux

This commit is contained in:
Wojtek Figat
2021-07-13 18:28:28 +02:00
parent e0be4e202a
commit caeeae6a32

View File

@@ -2031,10 +2031,14 @@ bool LinuxPlatform::Init()
char buffer[UNIX_APP_BUFF_SIZE];
// Get user locale string
const char* locale = setlocale(LC_ALL, NULL);
setlocale(LC_ALL, "");
const char* locale = setlocale(LC_CTYPE, NULL);
if (strcmp(locale, "C") == 0)
locale = "";
UserLocale = String(locale);
if (UserLocale.FindLast('.') != -1)
UserLocale = UserLocale.Left(UserLocale.Find('.'));
UserLocale.Replace('_', '-');
// Get computer name string
gethostname(buffer, UNIX_APP_BUFF_SIZE);