ArchHooks modified for Unix

This commit is contained in:
Prcuvu
2020-02-08 16:08:02 +08:00
parent de4dc62846
commit d893c84b7b
+18 -2
View File
@@ -179,13 +179,29 @@ RString ArchHooks::GetPreferredLanguage()
{
RString locale;
if(getenv("LANG"))
if (getenv("LANG"))
{
locale = getenv("LANG");
locale = locale.substr(0,2);
RString region = locale.substr(3, 2);
locale = locale.substr(0, 2);
if (locale == "zh")
{
if (region == "CN" || region == "SG")
{
locale = "zh-Hans";
}
else if (region == "HK" || region == "TW")
{
locale = "zh-Hant";
}
}
}
else
{
LOG->Warn("Unable to determine system language. Using English.");
locale = "en";
}
return locale;
}