User may create forms at runtime
-
- Posts: 10
- Joined: Fri Aug 05, 2005 6:59 am
User may create forms at runtime
Hello,
I'm new to TsiLanguage and wonder if this is possible.
With our application it's possible the user create a new database table and designs a form around it. Its is possible to include the new string in the sil file at runtime and let the user translate them?
Eric
I'm new to TsiLanguage and wonder if this is possible.
With our application it's possible the user create a new database table and designs a form around it. Its is possible to include the new string in the sil file at runtime and let the user translate them?
Eric
On creating some form at run-time you can also create a TsiLang component on it and assign its dispatcher property to one used in project. After that you can perform the following:
1. Call BuildList method. This will create translations lists in TsiLang.
2. Call SaveAllToFile (SaveAllToBinaryFile) to save lists to file
3. Call LoadAllFromFile (LoadAllFromBinaryFile) to load lists from file.
Hope this helps.
1. Call BuildList method. This will create translations lists in TsiLang.
2. Call SaveAllToFile (SaveAllToBinaryFile) to save lists to file
3. Call LoadAllFromFile (LoadAllFromBinaryFile) to load lists from file.
Hope this helps.
Best regards,
Igor Siticov.
Igor Siticov.
-
- Posts: 10
- Joined: Fri Aug 05, 2005 6:59 am
Hello,
I tried this:
On a buttonclick i runtime create a form with a groupbox on it with the items 'One' , 'Two'.
I also create a TsiLangLinked component on the form and connect it using
the "CommonContainer" and "LangDispatcher" to the "TsiLangDispatcher" and "TsiLangRT" components on the main form.
Now i can call TsiLangLinked method "BuildList" and "SaveAllToFile" but how can i call the sil editor to only edit the list created by "BuildList"
Eric
I tried this:
On a buttonclick i runtime create a form with a groupbox on it with the items 'One' , 'Two'.
I also create a TsiLangLinked component on the form and connect it using
the "CommonContainer" and "LangDispatcher" to the "TsiLangDispatcher" and "TsiLangRT" components on the main form.
Now i can call TsiLangLinked method "BuildList" and "SaveAllToFile" but how can i call the sil editor to only edit the list created by "BuildList"
Eric
Could you please describe what do you mean?Eric ten Westenend wrote: Now i can call TsiLangLinked method "BuildList" and "SaveAllToFile" but how can i call the sil editor to only edit the list created by "BuildList"
In case you need to edit created SIL file then just run SIL Editor with this SIL file in command line. Or you can import SIL Editor type library and use COM interface to manage it.
Best regards,
Igor Siticov.
Igor Siticov.
-
- Posts: 10
- Joined: Fri Aug 05, 2005 6:59 am
The code:
procedure TForm1.Button1Click(Sender: TObject);
var
f : TForm;
gb : TRadioGroup;
b : TButton;
begin
//create the form
f := TForm.Create(self);
f.Caption := 'Test form';
f.Position := poScreenCenter;
// create a rodiogroup on the form
gb := TRadioGroup.Create(f);
gb.Parent := f;
gb.Top := 50;
gb.Left := 50;
gb.Items.Add('Een');
gb.Items.Add('Twee');
gb.Items.Add('Drie');
// create a TsiLangLinked on the form
siLangLinked1:= TsiLangLinked.Create(f);
siLangLinked1.CommonContainer := siLangRT1;
siLangLinked1.LangDispatcher := siLangDispatcher1;
// Create a button to do the translation
b := TButton.Create(f);
b.Caption := 'Translate';
b.OnClick := DoClick;
b.Parent := f;
b.Top := 175;
b.Left := 50;
f.ShowModal;
f.Free;
end;
procedure TForm1.DoClick(Sender: TObject);
begin
siLangLinked1.BuildList;
siLangLinked1.SaveAllToFile('C:\Test.sil','#');
end;
After this i can open "Test.sil" but the sil file only contaings the caption on the form. Not the button neither the radiogroup.
I could mail you the project if you want.
Eric
procedure TForm1.Button1Click(Sender: TObject);
var
f : TForm;
gb : TRadioGroup;
b : TButton;
begin
//create the form
f := TForm.Create(self);
f.Caption := 'Test form';
f.Position := poScreenCenter;
// create a rodiogroup on the form
gb := TRadioGroup.Create(f);
gb.Parent := f;
gb.Top := 50;
gb.Left := 50;
gb.Items.Add('Een');
gb.Items.Add('Twee');
gb.Items.Add('Drie');
// create a TsiLangLinked on the form
siLangLinked1:= TsiLangLinked.Create(f);
siLangLinked1.CommonContainer := siLangRT1;
siLangLinked1.LangDispatcher := siLangDispatcher1;
// Create a button to do the translation
b := TButton.Create(f);
b.Caption := 'Translate';
b.OnClick := DoClick;
b.Parent := f;
b.Top := 175;
b.Left := 50;
f.ShowModal;
f.Free;
end;
procedure TForm1.DoClick(Sender: TObject);
begin
siLangLinked1.BuildList;
siLangLinked1.SaveAllToFile('C:\Test.sil','#');
end;
After this i can open "Test.sil" but the sil file only contaings the caption on the form. Not the button neither the radiogroup.
I could mail you the project if you want.
Eric
-
- Posts: 10
- Joined: Fri Aug 05, 2005 6:59 am