Orpheus components

All announcements, questions and issues related to the TsiLang Components Suite.
Post Reply
Ioan
Posts: 22
Joined: Tue Mar 14, 2006 8:32 pm
Location: Canada
Contact:

Orpheus components

Post by Ioan »

Hi,

I'm using in D7 projects some Orpheus components (former TurboPower).
Right now I have problems retrieving for translation the OvcTabSheet pages of the OvcNotebook. The ovctabsheets are items of TOvsNoteBook.PageCollection (TovcCollection), but this collection is not recognized by the siLangLinker component.

A little help, please.

Thanks,
Ioan
isiticov
Site Admin
Posts: 2383
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

Hi,

Unfortunately, this property is not "pretty well" designed and must be handled manually in source. So you can create some procedure in the source to initialize the captions of TOvsNoteBook. Run TsiLang Expert => Translate Source to translate this code with TsiLang. And after this add call to this procedure in OnChangeLanguage event of TsiLang and OnCreate of form. So your code will look like:

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
begin
  TranslateNotebook;
end;

procedure TForm1.TranslateNotebook;
begin
  OvcNotebook1.Pages[0] := siLang1.GetTextOrDefault('IDS_0' (* 'Page 1' *) );
  OvcNotebook1.Pages[1] := siLang1.GetTextOrDefault('IDS_1' (* 'Page 2' *) );
  OvcNotebook1.Pages[2] := siLang1.GetTextOrDefault('IDS_2' (* 'Page 3' *) );
  OvcNotebook1.Pages[3] := siLang1.GetTextOrDefault('IDS_3' (* 'Page 4' *) );
end;

procedure TForm1.siLang1ChangeLanguage(Sender: TObject);
begin
  TranslateNotebook;
end;
Best regards,
Igor Siticov.
Ioan
Posts: 22
Joined: Tue Mar 14, 2006 8:32 pm
Location: Canada
Contact:

Post by Ioan »

Hello,

I have another problem with another Orpheus componets, the TOvcCheckList. I tried something similar like the OvcNotebook, but I cannot make it work.

A form created at run-time includes a TOvcCheckList with 5 strings in the list. When the form is created with another language than the default (English) or when the language is changed while the form is opened, I get some (one or more) "Index out of bounds" errors.
Also, in design mode, when I switch the language I get the same errors and the TOvcCheckList get the new strings and some extra old strings. It looks that the results differ, the extra strings can be one or more.

Please give me a hint for this too.
Thanks,
Ioan
isiticov
Site Admin
Posts: 2383
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

This TOvcCheckList is "not very good" designed component :(
The fix below will work ONLY if you have same amount of items in this list box for each language.
You will need to do the following:
1. Modify ovccklb unit by adding:

Code: Select all

    procedure LBInsertString(var Msg : TMessage);
      message LB_INSERTSTRING;
to the protected section of TOvcCheckList and as implementation:

Code: Select all

procedure TOvcCheckList.LBInsertString(var Msg: TMessage);
begin
  inherited;
  FStates.Insert(Msg.Result, nil);
  if HorizontalScroll then
    ResetHorizontalScrollBar;
end;
2. Add the code similar to example below to language changing procedure:

Code: Select all

procedure TForm1.FormClick(Sender: TObject);
var
   States: TList;
   I: Integer;
begin
  States := TList.Create;
  try
// saving the states of check marks
    for I := 0 to OvcCheckList1.Count - 1 do
      States.Add(Pointer(OvcCheckList1.States[I]));
// changing language
    siLang1.ActiveLanguage := 2;
// restore the states
    for I := 0 to OvcCheckList1.Count - 1 do
      OvcCheckList1.States[I] := TCheckBoxState(States[I]);
  finally
    States.Free;
  end;
end;
Please let me know if this helps.
Best regards,
Igor Siticov.
Ioan
Posts: 22
Joined: Tue Mar 14, 2006 8:32 pm
Location: Canada
Contact:

Post by Ioan »

Hello,

Actually I needed only the ovccklb change, for the status I take care myself to reset it on language change.

The errors I got were generated by a mistake in my code: the translation of the strings from the OvcCheckList1 were different from the translations for the strings retrieved in the code!!
So, I was trying an OvcCheckList1.Items.IndexOf(siLangLinked.GetTextOrDefault('IDS_xxx')) which failed.

Anyway, without the fix in ovccklb is much worse.

Thanks again,
Ioan
Post Reply