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 

Translating a form without tsilang component

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



Joined: 30 Nov 2003
Posts: 2

PostPosted: Sun Nov 30, 2003 12:31 am    Post subject: Translating a form without tsilang component Reply with quote

I wonder if it's possible to translate a form which has no tsiLang component on it. In my package I have to translate a dialog which is called from another package, so i cant just put a component on it (this package must be free of tsilang). But i can access the dialog form. So right now i'm using this:
With TFrmFindDlg(Form) Do
Begin
Caption := siLang.GetText('IDS_F_0');
btCancel.Caption := siLang.GetText('IDS_F_1');
...
What i am looking for is a way to load into tsilang component names and values, for example, for captions. Then, at runtime i would assign, let's say, _form_ property of tsilang, tsilang would scan the form for components with specified names and translate their captions. Is this somehow possible?
Back to top
View user's profile Send private message
isiticov
Site Admin


Joined: 21 Nov 2002
Posts: 2102

PostPosted: Sun Nov 30, 2003 5:26 am    Post subject: Reply with quote

No, this is not possible to automatically translate form wihout TsiLang component on it. The only way to fo this is the way you've used, using GetText() or GetTextOrDefault() methods to retrieve strings and assign them to UI elements of such form.
Back to top
View user's profile Send private message
ivanov v k



Joined: 30 Nov 2003
Posts: 2

PostPosted: Sun Nov 30, 2003 12:11 pm    Post subject: Reply with quote

OK, thank you anyway Smile Maybe you will consider creating such a component...
Back to top
View user's profile Send private message
isiticov
Site Admin


Joined: 21 Nov 2002
Posts: 2102

PostPosted: Mon Dec 01, 2003 6:17 am    Post subject: Reply with quote

Btw, I cas suggest you to use the following and you will be able to achieve what is needed (I hope):
1. Create TsiLang manually on the form which needs to be translated:
Code:
var
    SiLangForFindFrm: TsiLang;


-------

Code:
  SiLangForFindFrm := TsiLang.Create(Form); // here Form is your external form component
  SiLangForFindFrm.LangDispatcher := siLangDispatcher1; // here siLangDispatcher1 is some global dispatcher which is used in your project. This could be skipped if no dispatcher is used to switch languages.
  SiLangForFindFrm.BuildList;


2. Save to SIL/SIB file the translations content for your FrmFindDlg form only once at run-time:

Code:
  SiLangForFindFrm.SaveAllToFile('somesilfile.sil', '!@#$%');


And after saving you may comment the line above in order to do not save this info any more since file is created already.

3. Translate created SIL file.

4. Insert code for loading the contant of this SIL file into TsiLang component:
Code:
  SiLangForFindFrm.LoadAllFromFile('somesilfile.sil', True);


5. After that I suppose when switching languages in dispatcher component your external form will be translated as well.

Hope this helps.
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