how to get language of operating system is double byte in delphi?

426 Views Asked by At

I want to detect the language of operating system is double byte or not. to get the language i am using GetLocaleInfo function of windows. But i want to detect is language double byte or not. I can do this with taking name of language and decide is it double byte or not (i.e if language is Japanese then its double byte) but is there any other way to directly get is operating system double byte language or not.

code i am using to get language:

procedure GetLanguage();
    var
    Buffer : PChar; 
     Size : integer;
    begin
      Size := GetLocaleInfo (LOCALE_USER_DEFAULT, LOCALE_SENGLANGUAGE, nil, 0);
      GetMem(Buffer, Size);
      try
        GetLocaleInfo (LOCALE_USER_DEFAULT, LOCALE_SENGLANGUAGE, Buffer, Size);
        Writeln(Buffer);
      finally
        FreeMem(Buffer);
      end;
    end;
1

There are 1 best solutions below

3
On BEST ANSWER

What do you call "double byte"? Do you mean that when using AnsiString, it may have characters encoded with two AnsiChar?

Use the following code:

FarEast := GetSystemMetrics(SM_DBCSENABLED) <> 0;

Edited, since SysLocale.FarEast is forced to true on Unicode Delphi.