Delete language by code

All announcements, questions and issues related to the TsiLang Components Suite.
Post Reply
mediatech
Posts: 23
Joined: Fri Mar 11, 2005 6:02 am

Delete language by code

Post by mediatech »

How to delete a language by code ?
i tried "SibFileMAnager.siComponents[0].DeleteLanguage(2)", in debugmode i can see, that ".LangNAmes.Count" decreases, but when i save file with "SibFileMAnager.savetofile..." the changes i made are NOT saved...
isiticov
Site Admin
Posts: 2385
Joined: Thu Nov 21, 2002 3:17 pm

Re: Delete language by code

Post by isiticov »

Hello,

If you need to delete the language from the SIB file ONLY, then here is a sample working code:

Code: Select all

procedure TForm9.Button1Click(Sender: TObject);
var
  SIB: TSIBFileManager;
  I: Integer;
begin
// load file
  SIB := TSIBFileManager.CreateByName('ee.sib');
  try
    for I := 0 to SIB.CompCount - 1 do
    // delete 2nd language for all components
      SIB.siComponents[I].DeleteLanguage(2);
    // save file back to disc
    SIB.SaveToFile('ee_without2nd.sib');
  finally
    SIB.Free;
  end;
end;
Hope this helps.
Best regards,
Igor Siticov.
mediatech
Posts: 23
Joined: Fri Mar 11, 2005 6:02 am

Re: Delete language by code

Post by mediatech »

Hello Igor,

that works perfect !
Thank you !
Best regards
Andreas
Post Reply