How can I get the language under IOS and Android

All announcements, questions and issues related to the TsiLang Components Suite.
Post Reply
hauger
Posts: 5
Joined: Fri Mar 04, 2016 3:07 pm

How can I get the language under IOS and Android

Post by hauger »

Under Windows I can get the LangId:

procedure TForm1.FormCreate(Sender: TObject);
var
LangID: DWORD;
begin
LangID := GetUserDefaultLangID;
case Byte(LangID and $03FF) of
LANG_ENGLISH: siLangDispatcher1.ActiveLanguage := 1;
LANG_GERMAN: siLangDispatcher1.ActiveLanguage := 2;
LANG_FRENCH: siLangDispatcher1.ActiveLanguage := 3;
else
siLangDispatcher1.ActiveLanguage := 1;
end;

Is there a way to get LANG_ENGLISH, LANG_GERMAN under IOS and Android?
isiticov
Site Admin
Posts: 2383
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

Hello,

SysLocale global variable includes this information under any OS.

Code: Select all

{ System Locale information record }
  TSysLocale = packed record
    DefaultLCID: TLocaleID;
    PriLangID: Integer;
    SubLangID: Integer;
    FarEast: Boolean;
    MiddleEast: Boolean;
  end;
so the sample code would be:

Code: Select all

case SysLocale.PriLangID of 
 LANG_ENGLISH: siLangDispatcher1.ActiveLanguage := 1; 
 LANG_GERMAN: siLangDispatcher1.ActiveLanguage := 2; 
 LANG_FRENCH: siLangDispatcher1.ActiveLanguage := 3; 
 else 
 siLangDispatcher1.ActiveLanguage := 1; 

FAQ: http://www.tsilang.com/delphiglobalizat ... aq.html#18
Post Reply