Merging SIB-Files ?

All announcements, questions and issues related to the TsiLang Components Suite.
Post Reply
mediatech
Posts: 23
Joined: Fri Mar 11, 2005 6:02 am

Merging SIB-Files ?

Post by mediatech »

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
isiticov
Site Admin
Posts: 2383
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

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.
Best regards,
Igor Siticov.
mediatech
Posts: 23
Joined: Fri Mar 11, 2005 6:02 am

little steps forward ...

Post by mediatech »

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
isiticov
Site Admin
Posts: 2383
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

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.
Best regards,
Igor Siticov.
mediatech
Posts: 23
Joined: Fri Mar 11, 2005 6:02 am

...next step...

Post by mediatech »

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
isiticov
Site Admin
Posts: 2383
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

You can use OnLinkToDisptacher event of TsiLangDispatcher and place your code there for linking TsiLang.
Does this help?
Best regards,
Igor Siticov.
mediatech
Posts: 23
Joined: Fri Mar 11, 2005 6:02 am

Post by mediatech »

:(
No, also that still takes no effect...

Best Regards

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

Post by isiticov »

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

Code: Select all

procedure TDataModule6.siLangDispatcher1LinkToDispatcher(Sender: TObject;
  ASiLang: TsiCustomLang);
begin
  AsiLang.LoadAllFromBinaryFile('OLD.SIB');
  AsiLang.BuildList;
  bUpdated:= AsiLang.MergeAllFromFile('NEW.SIB');
  AsiLang.SaveAllToBinaryFile('OLD.SIB');
end;
Best regards,
Igor Siticov.
mediatech
Posts: 23
Joined: Fri Mar 11, 2005 6:02 am

Post by mediatech »

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]
mediatech
Posts: 23
Joined: Fri Mar 11, 2005 6:02 am

Commandline...

Post by mediatech »

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
isiticov
Site Admin
Posts: 2383
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

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.
Best regards,
Igor Siticov.
mediatech
Posts: 23
Joined: Fri Mar 11, 2005 6:02 am

Post by mediatech »

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
isiticov
Site Admin
Posts: 2383
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

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
Best regards,
Igor Siticov.
mediatech
Posts: 23
Joined: Fri Mar 11, 2005 6:02 am

Post by mediatech »

Sorry,

i´m ashamed :oops: :oops: :oops:

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

Best regards

Andreas
Post Reply