When the app is running, I can change to each language by setting the siLangDispatcher.ActiveLanguage appropriately.
I have the following code to set the appropriate active language in the main form's FormCreate method;
Code: Select all
procedure TMainForm.FormCreate(Sender: TObject);
var
vLanguageID: DWORD;
begin
// set language (using only primary language identifier -> last byte)
vLanguageID := GetUserDefaultLangID;
case Byte(vLanguageID and $00FF) of
LANG_ENGLISH: siLangDispatcher.ActiveLanguage := 1;
LANG_ARABIC: siLangDispatcher.ActiveLanguage := 2;
LANG_CHINESE: siLangDispatcher.ActiveLanguage := 3;
LANG_JAPANESE: siLangDispatcher.ActiveLanguage := 4;
LANG_SPANISH: siLangDispatcher.ActiveLanguage := 5;
LANG_GERMAN: siLangDispatcher.ActiveLanguage := 6;
else
siLangDispatcher.ActiveLanguage := 1;
end;
UpdateStrings;
etc;
If the region is set to either Japanese(Japan) or Spanish(Spain) then the siLangDispatcher is nil upon entry to the FormCreate and the app fails.
Any idea why this is happening?
I'm using Delphi Berlin Update 2 and Si components 7.5.6.1.