FIX: System language detection under macOS (fixes #1560)

This commit is contained in:
Alexander Koblov 2024-04-08 18:20:05 +03:00
commit cde5faedf4

View file

@ -70,7 +70,7 @@ uses
{$IF DEFINED(UNIX)}
iconvenc_dyn, LazUTF8
{$IF DEFINED(DARWIN)}
, MacOSAll, CocoaAll
, MacOSAll, CocoaAll, StrUtils
{$ELSE}
, UnixCP
{$ENDIF}
@ -379,6 +379,7 @@ begin
begin
// Crop to terminating zero
SystemLanguage:= PAnsiChar(SystemLanguage);
SystemLanguage:= Copy2Symb(SystemLanguage, '-');
// Get system country
CurrentLocale:= NSLocale.currentLocale();
Country:= NSString(CurrentLocale.objectForKey(NSLocaleCountryCode)).UTF8String;