How to translate 3rd party dialogs?
How to translate 3rd party dialogs?
Hi @all!
Today I gibe TsiLang a try. I´m searching for a good solution to translate our application.
The most things work really fine with TsiLang. But we have special Dialogs from another component (wpTools). There are screen preview dialogs for example.
Is there a way to translate these dialogs with TsiLang, too?
The main problem is the following: I don´t want to change anything within the wpTools code / forms. This would result in frequently changes if there are updates from wpTools.
Hopefully you can help me.
Today I gibe TsiLang a try. I´m searching for a good solution to translate our application.
The most things work really fine with TsiLang. But we have special Dialogs from another component (wpTools). There are screen preview dialogs for example.
Is there a way to translate these dialogs with TsiLang, too?
The main problem is the following: I don´t want to change anything within the wpTools code / forms. This would result in frequently changes if there are updates from wpTools.
Hopefully you can help me.
Greetz Moelski
Hi,
If these dialogs use resourcestrings to initialize the UI element then you can easily translate them using Resource Strings Wizard from TsiLang Expert menu Tools->Wizards. You will need just to open your project's EXE in Wizard and select strings related to these dialogs.
Please let me know if this helps. Otherwise there is another "hack" for such situation but I hope it won't be needed.
If these dialogs use resourcestrings to initialize the UI element then you can easily translate them using Resource Strings Wizard from TsiLang Expert menu Tools->Wizards. You will need just to open your project's EXE in Wizard and select strings related to these dialogs.
Please let me know if this helps. Otherwise there is another "hack" for such situation but I hope it won't be needed.
Best regards,
Igor Siticov.
Igor Siticov.
In such case we will need to use some "hacking". The procedure is as the following:
1. Create SIL/SIB file for these dialogs.
2. Translate this file .
3. Load it at run-time.
To create such SIL/SIB file you can use the following:
1. Create procedure MyScreenActiveFormChange
2.Assign the code like this:
3. Assign the procedure from 1. to Screen.OnActiveFormChange event in your code.
4. Run your application and display such dialog to execute the code above
To load and translate dialogs you will need the similar code. Something like the following:
To load SIL/SIB file above you will need either:
1. Disctribute it with your application. Fits the best if you use external translation storing for the application as well.
2. You can place it into application's resource and save it to disk from resource into temporary folder. Also you may use LoadAllFromStream() method of TsiLang to load the content directly from TResourceStream. But in this case your will need to use SIL files since Stream functions are SIL oriented.
Hope this helps.
1. Create SIL/SIB file for these dialogs.
2. Translate this file .
3. Load it at run-time.
To create such SIL/SIB file you can use the following:
1. Create procedure MyScreenActiveFormChange
2.Assign the code like this:
Code: Select all
// replace 3rdPartyFormClassName with the class name for the dialog form
if (Screen.ActiveForm <> nil) (and Screen.ActiveForm.ClassName = '3rdPartyFormClassName') then
begin
with TsiLangLinked.Create(Screen.ActiveForm) do
begin
BuildList;
SaveAllToBinaryFile(... insert here the name of your SIB file);
// in order to save into SIL file just use SaveAllToFile()
end;
end;
4. Run your application and display such dialog to execute the code above
To load and translate dialogs you will need the similar code. Something like the following:
Code: Select all
if (Screen.ActiveForm <> nil) (and Screen.ActiveForm.ClassName = '3rdPartyFormClassName') then
begin
with TsiLangLinked.Create(Screen.ActiveForm) do
begin
LoadAllFromBinaryFile(... insert here the name of your SIB file);
// for SIL file use LoadAllFromFile()
LangDispatcher := your_dispatcher_used_in_project;
end;
end;
1. Disctribute it with your application. Fits the best if you use external translation storing for the application as well.
2. You can place it into application's resource and save it to disk from resource into temporary folder. Also you may use LoadAllFromStream() method of TsiLang to load the content directly from TResourceStream. But in this case your will need to use SIL files since Stream functions are SIL oriented.
Hope this helps.
Last edited by isiticov on Thu Aug 03, 2006 5:52 pm, edited 1 time in total.
Best regards,
Igor Siticov.
Igor Siticov.
Yes, of course. The demo version contains just one limitation: Delphi or C++Builder must be running when you execute applications translated with TsiLang.
After upgrating to registered version all your work will be re-used so you won't loose any translation after upgrating.
After upgrating to registered version all your work will be re-used so you won't loose any translation after upgrating.
Best regards,
Igor Siticov.
Igor Siticov.
Hi isiticov!
I use the following code to add 3rd party dialogs to my SIB file ...
Works fine ... so far. In my SIB file I have three languages: German, English and French. But the Dialogs have not the default headline. My headlines are German, English and French for the translation of Forms. The dialogs have the headlines Language N1, ... N2, ... N3.
What should I do to get the normal headlines there.
Code like this don´t works ...
I use the following code to add 3rd party dialogs to my SIB file ...
Code: Select all
procedure TForm1.ActiveFormChange(Sender: TObject);
begin
//Memo2.Lines.Add(Screen.ActiveForm.ClassName);
if (Screen.ActiveForm <> NIL) and
((Screen.ActiveForm.ClassName = 'TWPPageProp') or
(Screen.ActiveForm.ClassName = 'TWPPreviewForm') or
(Screen.ActiveForm.ClassName = 'TWPTableDialog')
) then
begin
with TsiLangLinked.Create(Screen.ActiveForm) do
begin
BuildList;
SaveAllToBinaryFile(siLang1.GetTextOrDefault('LangFile.sib');
end;
end;
end;
What should I do to get the normal headlines there.
Code like this don´t works ...
Code: Select all
procedure TForm1.ActiveFormChange(Sender: TObject);
begin
//Memo2.Lines.Add(Screen.ActiveForm.ClassName);
if (Screen.ActiveForm <> NIL) and
((Screen.ActiveForm.ClassName = 'TWPPageProp') or
(Screen.ActiveForm.ClassName = 'TWPPreviewForm') or
(Screen.ActiveForm.ClassName = 'TWPTableDialog')
) then
begin
with TsiLangLinked.Create(Screen.ActiveForm) do
begin
NumOfLanguages := 3;
LangNames.Add('Deutsch');
LangNames.Add('Englisch');
LangNames.Add('Französisch');
BuildList;
SaveAllToBinaryFile(siLang1.GetTextOrDefault('LangFile.sib');
end;
end;
end;
Greetz Moelski
If you use TsiLangDispatcher then you can just assign LandDispatcher property of run-time created TsiLang-s. Otherwise, to define language names you can use:
Hope this helps.
Code: Select all
NumOfLanguages := 3;
LangNames[0] := 'Deutsch';
LangNames[1] := 'Englisch';
LangNames[2] := 'Französisch';
Best regards,
Igor Siticov.
Igor Siticov.