Hi there,
simple question;
How to add language at runtime ?
simple answer
?
Thanks for your help
Andreas
Add LAnguage at runtime
isiticov wrote:Delphi:
siLangDispatcher.NumOfLanguages := siLangDispatcher.NumOfLanguages + 1;
C++Builder:
siLangDispatcher.NumOfLanguages = siLangDispatcher.NumOfLanguages + 1;
Is this enough?
So far it works fine, another language is added, but next question; How to rename the new language, if i´m using the following code, nothing happens, the new language appears as "Language N...", even if i´m saving the file, see following code;
...
...
...
LangDispatcher.NumOfLanguages:= LangDispatcher.NumOfLanguages+1;
LangDispatcher.LangNames[LangDispatcher.NumOfLanguages-1]:= 'Test';
LangDispatcher.SaveAllToFile(LangDispatcher.FileName, sLangDelimiter);...
...
...
You can try the following:
Code: Select all
var
Lst: TStringList;
begin
siLangDispatcher1.NumOfLanguages := siLangDispatcher1.NumOfLanguages + 1;
Lst := TStringList.Create;
try
Lst.Assign(siLangDispatcher1.LangNames);
Lst[Lst.Count - 1] := 'New Language Name';
siLangDispatcher1.LangNames := Lst;
finally
Lst.Free;
end;
end;
Best regards,
Igor Siticov.
Igor Siticov.
Hey,isiticov wrote:You can try the following:Code: Select all
var Lst: TStringList; begin siLangDispatcher1.NumOfLanguages := siLangDispatcher1.NumOfLanguages + 1; Lst := TStringList.Create; try Lst.Assign(siLangDispatcher1.LangNames); Lst[Lst.Count - 1] := 'New Language Name'; siLangDispatcher1.LangNames := Lst; finally Lst.Free; end; end;
that works fine !!!
Thank you
Andreas