SiComponents Home Page SiComponents Forums
Here you will be able to get help and share your experience
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

strings need translation before form is created

 
Post new topic   Reply to topic    SiComponents Forums Forum Index -> TsiLang Components Suite
View previous topic :: View next topic  
Author Message
DavidD



Joined: 07 Mar 2007
Posts: 17
Location: United States

PostPosted: Thu Apr 12, 2007 3:42 pm    Post subject: strings need translation before form is created Reply with quote

Hoo boy, we have gotten too tricky. The situation is this:
unit
interface
type
TfrmViewer = class(ancestor viewer with TsiLang component)
public
class function ShowItems (formCaption: String): Boolean;
end;

function ShowItems1: boolean;
function ShowItems2: boolean;

implementation

function ShowItems1: boolean;
begin
result := TfrmViewer.ShowItems('Widgets');
end;

function ShowItems2: boolean;
begin
result ;= TfrmViewer.ShowItems('Stuff');
end;

I need to access my global TsiLang component for the GetTextorDefault, not the inherited one on the form since it does not exist yet. Is that possible?

For the moment, I have changed this to pass in an integer value parameter instead of the string title and use it to assign the Form.Caption string after the form is created.

Note, There are other strings in the TfrmViewer procedures that will be translated by the inherited component.
Back to top
View user's profile Send private message
isiticov
Site Admin


Joined: 21 Nov 2002
Posts: 2095

PostPosted: Thu Apr 12, 2007 4:34 pm    Post subject: Reply with quote

just use:
YOUR_ALREADY_CREATED_FORM.siLang.GetTextOrDefault() to get strings from another form which is created at this time.
Back to top
View user's profile Send private message
DavidD



Joined: 07 Mar 2007
Posts: 17
Location: United States

PostPosted: Thu Apr 12, 2007 4:38 pm    Post subject: Reply with quote

When would I make the change to specify the already created form?
Back to top
View user's profile Send private message
isiticov
Site Admin


Joined: 21 Nov 2002
Posts: 2095

PostPosted: Thu Apr 12, 2007 5:07 pm    Post subject: Reply with quote

Where you need them.
The idea is:
1. Move your strings from inherited form to the base one or one which is already created in that moment.
2. In code of TfrmViewer class function use strings from TsiLang on created form not from TsiLang on this form because no any object created in class function.

Because this is not a TsiLang but global design problem. You won't be able to use anything related to classes (objects) of TfrmViewer before creting it or creating these objects manually in class function.
Back to top
View user's profile Send private message
DavidD



Joined: 07 Mar 2007
Posts: 17
Location: United States

PostPosted: Thu Apr 12, 2007 5:21 pm    Post subject: Reply with quote

Yah, I know it's not a TsiLang problem. Let me just confirm a couple of things. My already created form is dmInternational.
I will need to manually copy the strings from the TfrmViewer siLang component properties to the dmInternational.siLang component properties and assign it an IDS_xxx ID unique within dmInternational. Then make sure the dmInternational.siLang.GetText(IDS_xxx) references the new unique ID. Correct?

I notice theTsiLang Files Editor will not allow me to edit the String ID column. Is there a way to allow this so I could just change the StringID there without having to copy?
Back to top
View user's profile Send private message
isiticov
Site Admin


Joined: 21 Nov 2002
Posts: 2095

PostPosted: Fri Apr 13, 2007 2:10 am    Post subject: Reply with quote

Yes, you're correct.
You can easily select and copy strings using TsiLang Translation Editor (double-click on TsiLang). It allows to select and edit StringID column.
SIL Editor prevents this in order to protect your IDs from "bad" translators.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    SiComponents Forums Forum Index -> TsiLang Components Suite All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by p h p B B  © 2001, 2005 p h p B B  Group