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 

Merging SIB-Files ?

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



Joined: 11 Mar 2005
Posts: 20

PostPosted: Tue Mar 13, 2007 7:06 am    Post subject: Merging SIB-Files ? Reply with quote

I tried to merge SIB-Files via "MergeAllFormFile"-Function. The function returns "true", the SIB-File thereafter is damaged (unrecognized Stream format).
Also, i tried to use "Sileditor" with Commandline-Parameters (-mlang... -morig... -mnew), but it takes no effects...

thus; How to merge SIB-FIles ??


Best regards


Andreas
Back to top
View user's profile Send private message
isiticov
Site Admin


Joined: 21 Nov 2002
Posts: 2097

PostPosted: Tue Mar 13, 2007 8:47 am    Post subject: Reply with quote

Method MergeAllFromFile() merges translations from SIL/SIB file into component itself and can't damage the file. File will be updated only if you call SaveToBinaryFile() method.
Below is sample command line which works just fine:
sileditor.exe -morig ORIGINAL.sib -mnew NEW.sib -mlang French

Please be sure you pass filenames correctly.
Back to top
View user's profile Send private message
mediatech



Joined: 11 Mar 2005
Posts: 20

PostPosted: Tue Mar 13, 2007 9:14 am    Post subject: little steps forward ... Reply with quote

Ok, with the "SaveToBinary()" function the SIB file isīnt damaged any longer, but it still takes no effort...
Iīm using "TsiLangRTSE", with following code

...
siLang1.LoadAllFromBinaryFile('C:\Test\CDM.SIB');
bUpdated:= siLang1.MergeAllFromFile('C:\TEST\Update.SIB');
siLang1.SaveAllToBinaryFile('C:\Test\CDM.SIB');
siLang1.LoadAllFromBinaryFile('C:\Test\CDM.SIB');
stest:= siLang1.GetTextOrDefault('sTestCaption');
...

where "CDM.SIB" is the "original" SIB-File and "Update.SIB" is the SIB-File containing only Items that are new or have to be updated. One of these Items (new one) is "sTestCaption"; bUpdated is true after calling "MergeAllFormFile", but none of the new items are found in CDM.SIB, even after reload/restart.

Where am i failing ?


Best regards


Andreas
Back to top
View user's profile Send private message
isiticov
Site Admin


Joined: 21 Nov 2002
Posts: 2097

PostPosted: Tue Mar 13, 2007 12:28 pm    Post subject: Reply with quote

MergeAllFromFile loads all from file and add items that were presented in "old" list and not found in newer one. After that it deletes all elements that don't exist on the form.
So if your UPDATE.SIB contains any controls that are not on the form they will be deleted. If this is not a case then please create sample application for your test case and send it to us to debug.
Back to top
View user's profile Send private message
mediatech



Joined: 11 Mar 2005
Posts: 20

PostPosted: Wed Mar 14, 2007 8:33 am    Post subject: ...next step... Reply with quote

so far i checked it out;
the following code
...
siLang.LoadAllFromBinaryFile('OLD.SIB');
siLang.BuildList;
bUpdated:= siLang.MergeAllFromFile('NEW.SIB');
siLang.SaveAllToBinaryFile('OLD.SIB');
siLang.LoadAllFromBinaryFile('NEW.SIB');
...
works fine if i place it on a form. The Items in the "OLD.SIB" are updated with those from the "NEW.SIB".
But just the items refrenced to the actual form where the silang is located !!

But...
I have just one SIB-File for a whole project (30 or more forms), and iīm using a separate unit to "manage" everything belonging to "Language" like choosing another language or editing SIB-Files direct from Application and more, and so if a place the above code in this unit so that itīs accessed by all forms, the code fails, none of the entries are modified...probably while thereīs no form assigned ?
I could place the above code in every form, but i think thatīs not very comfortable...

Any idea how to solve this ?

Best regards

Andreas
Back to top
View user's profile Send private message
isiticov
Site Admin


Joined: 21 Nov 2002
Posts: 2097

PostPosted: Wed Mar 14, 2007 9:17 am    Post subject: Reply with quote

You can use OnLinkToDisptacher event of TsiLangDispatcher and place your code there for linking TsiLang.
Does this help?
Back to top
View user's profile Send private message
mediatech



Joined: 11 Mar 2005
Posts: 20

PostPosted: Mon Mar 19, 2007 6:25 am    Post subject: Reply with quote

Sad
No, also that still takes no effect...

Best Regards

Andreas
Back to top
View user's profile Send private message
isiticov
Site Admin


Joined: 21 Nov 2002
Posts: 2097

PostPosted: Mon Mar 19, 2007 8:42 am    Post subject: Reply with quote

The following code will update each form linked to dispatcher at run-time upon creation of that form:
Code:

procedure TDataModule6.siLangDispatcher1LinkToDispatcher(Sender: TObject;
  ASiLang: TsiCustomLang);
begin
  AsiLang.LoadAllFromBinaryFile('OLD.SIB');
  AsiLang.BuildList;
  bUpdated:= AsiLang.MergeAllFromFile('NEW.SIB');
  AsiLang.SaveAllToBinaryFile('OLD.SIB');
end;
Back to top
View user's profile Send private message
mediatech



Joined: 11 Mar 2005
Posts: 20

PostPosted: Tue Mar 20, 2007 5:44 am    Post subject: Reply with quote

That code works, but it just works at creation of the form. My project handles about 90 forms !! i donīt create them all at startup, some of them are also rarely opened by the enduser. So the method to update each form at creation is almost inoperative..
But i īll go to write some code that opens each form of the project in my "Language-Update" procedure and that way your code will work. Thatīs not the way i like it, but finally the result is the same...

Thank you so far

Best regards

Andreas[/u]
Back to top
View user's profile Send private message
mediatech



Joined: 11 Mar 2005
Posts: 20

PostPosted: Thu Mar 29, 2007 6:58 am    Post subject: Commandline... Reply with quote

Hi,

i got stuck in the code of my "Update-Procedure", so decided to use Sileditor with commandline. I tried following:

SILEDITOR -morig[ORIGINAL.SIB] -mnew[UPDATE.SIB]

didīnt work, also tried with complete path, with -mlang Parameter, but none of them updated the ORIGINAL.SIB, also i found no documentation about using command-line parameters, just in the "Whatīs new" on your Website, the parameters where listed.

Could you please help me again ?

Best regards

Andreas
Back to top
View user's profile Send private message
isiticov
Site Admin


Joined: 21 Nov 2002
Posts: 2097

PostPosted: Thu Mar 29, 2007 7:08 am    Post subject: Reply with quote

Hi,
Command-line to use:
sileditor.exe -morig [original.sib] -mnew [sibtomerge.sib] -mlang [nameoflanguagetomerge] [-msuperfl]
You need to specify:
1. Original SIB. Be sure to use "" quotes when your SIB's path contains spaces.
2. New SIB to merge ("" applies the same as above).
3. Language name to merge.

If none of the above is specified then it fails.
Back to top
View user's profile Send private message
mediatech



Joined: 11 Mar 2005
Posts: 20

PostPosted: Fri Mar 30, 2007 6:54 am    Post subject: Reply with quote

OK i tried the following;
on commandline entered

D:\SILTEst\SILEDITOR.exe -morig[D:\SILTEst\SILEDITOR.sib] -mnew[D:\SILTEst\SILEDITOR_Update.sib] -mlang[English] [-msuperfl]

where D:\SILTEST is a directory with new version of SilEditor (V 3.3.3.0) the original SIB-File "SILEDITOR.SIB" belonging to the SilEditor. and the SIB-File "Sileditor_Update.SIB". THis "Update_Sileditor.sib" is a copy of the original Sileditor.sib, where i changed the Caption of the StringID "TFrmWidthsTooltip" in the form "TfrmWidthsToolTip" from "Translations Widths" to "Translations Widths-XXXXX-".

Executing the command, Sileditor starts up with "Noname1.sib" loaded, nothing else happens, nothing is updated...

i tried with and without complete path, with and without parameters "-mlang[English] [-msuperfl]", nothing takes effort.

Help !!!!

Best regards

Andreas
Back to top
View user's profile Send private message
isiticov
Site Admin


Joined: 21 Nov 2002
Posts: 2097

PostPosted: Fri Mar 30, 2007 7:27 am    Post subject: Reply with quote

Please don't use [] for parameters (this is common syntax for documentation when describing them) and separate parameters by space! Exactly as I showed you in my post.
So your command must look like:
D:\SILTEst\SILEDITOR.exe -morig SILEDITOR.sib -mnew SILEDITOR_Update.sib -mlang English -msuperfl
Back to top
View user's profile Send private message
mediatech



Joined: 11 Mar 2005
Posts: 20

PostPosted: Fri Mar 30, 2007 7:48 am    Post subject: Reply with quote

Sorry,

iīm ashamed Embarassed Embarassed Embarassed

that works. Nothing left to say, just again; Thank you very much, i'll always recommend you and your components (including support Smile

Best regards

Andreas
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