In my applications I successfully use the following platform-independent function:
function GetOSLanguage: string;
{platform-independent method to read the language of the user interface}
var
l, fbl: string;
{$IFDEF LCLCarbon}
theLocaleRef: CFLocaleRef;
locale: CFStringRef;
buffer: StringPtr;
bufferSize: CFIndex;
encoding: CFStringEncoding;
success: boolean;
{$ENDIF}
begin
{$IFDEF LCLCarbon}
theLocaleRef := CFLocaleCopyCurrent;
locale := CFLocaleGetIdentifier(theLocaleRef);
encoding := 0;
bufferSize := 256;
buffer := new(StringPtr);
success := CFStringGetPascalString(locale, buffer, bufferSize, encoding);
if success then
l := string(buffer^)
else
l := '';
fbl := Copy(l, 1, 2);
dispose(buffer);
{$ELSE}
{$IFDEF LINUX}
fbl := Copy(GetEnvironmentVariable('LC_CTYPE'), 1, 2);
{$ELSE}
GetLanguageIDs(l, fbl);
{$ENDIF}
{$ENDIF}
Result := fbl;
end;
The function delivers the system language as two-byte ISO code. It works on Mac OS X, Linux and Windows.