siLangCombo causing multiple errors when changing language

All announcements, questions and issues related to the TsiLang Components Suite.
Post Reply
nickg
Posts: 39
Joined: Tue Apr 05, 2005 9:17 am

siLangCombo causing multiple errors when changing language

Post by nickg »

Using siLang 6.004 with Delphi 7 Pro on WinXP Pro

I'm using a siLangCombo on a dynamically created Options form to change the language for the whole project. When I do so there is a series of error messages each time, with the number of errors differing for some languages i.e changing to German from English causes 5 errors. Changing from German back to English causes 7 errors.

If the Option form is closed and then re-opened no errors occur the second time.

In both cases (Errors and No errors), the translations are being done correctly for all forms in the project.

The code used in the combos onchange event is:

siLangCombo1.siLangDispatcher.Language := siLangCombo1.siLangDispatcher.LangNames[siLangCombo1.ItemIndex];

Any ideas please?

TIA Nick
isiticov
Site Admin
Posts: 2385
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

Could you please let us know what error text do you get?

P.S. The better code would look like:
if Assigned(siLangCombo1.siLangDispatcher) then siLangCombo1.siLangDispatcher.ActiveLanguage :=
siLangCombo1.ItemIndex + 1;
Best regards,
Igor Siticov.
nickg
Posts: 39
Joined: Tue Apr 05, 2005 9:17 am

Error msgs with siLangCombo

Post by nickg »

The code is in a dll COM server used by Word, so the only error message I'm getting is OLE Error 800A01A8.

I tried moving the assignment of the ActiveLanguage property back to the same form the Dispatcher component is on, using an ordinary combobox on the Options form - as shown in the code below, but the problem persists.

siLangDispatcher1.ActiveLanguage := ODlg.cmboLangs.ItemIndex + 1;

I also tried taking the text from the combobox and assigning that to the siLang components Language property, but get errors there too, and no change of language.

Regards Nick
isiticov
Site Admin
Posts: 2385
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

It looks like TsiLang is trying to translate some property of your MS Word COM server object and this property couldn't be translated (changed). Please verify your list of translations and exclude property(ies) related to MS Word COM server from translations if it is not needed to be translated.
Please let us know if this helps.
Best regards,
Igor Siticov.
nickg
Posts: 39
Joined: Tue Apr 05, 2005 9:17 am

Multiple errors on change language

Post by nickg »

Hi Igor,

I've just been through the .sil file, and did find some Office Tags that I'd removed before but had somehow crept back in again. Also excluded anything else that wasn't being used.

However the errors are still happening.

It seems that if I double-click on a siLang component to edit the file for that particular unit, then saving with the save button or the Save option in the file menu overwrites everything in the file for other units. Closing with the X button just saves the modification for that form.

The TLB file hasn't been added to the .sil file at all, at least not as far as I can tell.

Regards Nick
isiticov
Site Admin
Posts: 2385
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

You need to exclude then from translations by adding them to Excluded Properties otherwise TsiLang will always automatically put them back and will try to translate them. Double-click on TsiLang and find these entries in translations; right-click on them and select Exclude from popup-menu; make a choice and exclude them. Additionally you can use Exclude from Translations editor (double-click on DoNotTranslate property in Object Inspector) to exclude components or properties in more comofrtable way.
Hope this helps.
Best regards,
Igor Siticov.
nickg
Posts: 39
Joined: Tue Apr 05, 2005 9:17 am

Error messages on change language

Post by nickg »

Tried that it did exclude the tags, but did'nt fix the problem.

I'm loading the .sil file like this:

if FileExists(fName) then
siLangDispatcher1.Filename := fName
else
showmessage('Language file not found: ' + fname + #13 +
'Cannot use language translation feature');
LangID := GetUserDefaultLangID;
case byte(LangID and $03FF) of
LANG_ENGLISH: siLangDispatcher1.ActiveLanguage := 1;
LANG_GERMAN: siLangDispatcher1.ActiveLanguage := 2;
LANG_FRENCH: siLangDispatcher1.ActiveLanguage := 3;
LANG_DUTCH: siLangDispatcher1.ActiveLanguage := 4;
LANG_CHINESE: siLangDispatcher1.ActiveLanguage := 5;
LANG_ITALIAN: siLangDispatcher1.ActiveLanguage := 6;
LANG_JAPANESE: siLangDispatcher1.ActiveLanguage := 7;
LANG_KOREAN: siLangDispatcher1.ActiveLanguage := 8;
LANG_RUSSIAN: siLangDispatcher1.ActiveLanguage := 9;
LANG_SPANISH: siLangDispatcher1.ActiveLanguage := 10;
LANG_PORTUGUESE: siLangDispatcher1.ActiveLanguage := 11;
LANG_SWEDISH: siLangDispatcher1.ActiveLanguage := 12;
else siLangDispatcher1.ActiveLanguage := 1;
end; //case

There doesn't seem to be any way to tell if the file was loaded correctly, and is not corrupt in some way, but no error messages are raised during this process. Also, using the .sil editor outside of the Delphi environment I can load the file without any problems.

Regards Nick
isiticov
Site Admin
Posts: 2385
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

Please try the following:
1. Add your MS Word component(s) to DoNotTranslate, this will exclude all related to it from translations
2. Be sure to update your SIL file by deleting entries related to the MS Word component(s)

Hope this helps.
Best regards,
Igor Siticov.
nickg
Posts: 39
Joined: Tue Apr 05, 2005 9:17 am

Multiple errors on Change Language

Post by nickg »

Thanks Igor,

That last idea did the trick. I'd excluded all of the properties for Add-in Express Commandbars except the captions. but siLang just doesn't like them at all. Excluding the entire commandbar component and hard coding the captions for assignment at run-time solved the problem.

I also discovered that ELDOS ElPack radiogroups don't have their items property picked up by siLang, presumably because they are sublassed from tCustom Panel and are declared as a class TWidestringList.

At the moment I'm discovering that some forms are doing partial translations, and some none at all, but I've messed about with things so much trying to solve the original problem it might just be best to delete the siLang stuff and start from scratch now that I know how to do it properly.

If I delete the components, the sil file and remove chages to the source for string IDs is that enough, or is there anything else I need to know. I read an earlier post that said there was info stored in the dfm file, is that correct. The same post said there was a pdf file about ignoring and excluding translations, but I couldn't find it on your website.

Thanks for all your help so far

Regards Nick
isiticov
Site Admin
Posts: 2385
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

The User's Guide is available for download from our download page and direct link is:
http://www.sicomponents.com/soft/siManual.pdf

The actions you described are enough to remove TsiLang.
Best regards,
Igor Siticov.
nickg
Posts: 39
Joined: Tue Apr 05, 2005 9:17 am

Post by nickg »

Thanks Igor,

I've got a copy of the manual already, the post made it sound like there was a separate document.

What about hardcoded filenames and filters for example, as well as Registry keys. I'm assuming exclude in these cases.

After all, if the filename for the sib or sil file is wrapped with an ID tag in the code, how would the program be able to open the file if it needed to be opened already in order to interpret the ID tag?

What about Fontnames?

Regards Nick
isiticov
Site Admin
Posts: 2385
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

nickg wrote:What about hardcoded filenames and filters for example, as well as Registry keys. I'm assuming exclude in these cases.
Using ignore tags you can exclude necessary lines of code from expert's source scanning functionality. And these lines will be ignored during scanning.
After all, if the filename for the sib or sil file is wrapped with an ID tag in the code, how would the program be able to open the file if it needed to be opened already in order to interpret the ID tag?
Could you please specify what do you mean here?
What about Fontnames?
Do you mean the Fonts section in TsiLang? It is designed to provide the ability to change font and Charset (Charsets section) for each language and control.
Best regards,
Igor Siticov.
nickg
Posts: 39
Joined: Tue Apr 05, 2005 9:17 am

Multiple errors when changing language

Post by nickg »

Quote:
After all, if the filename for the sib or sil file is wrapped with an ID tag in the code, how would the program be able to open the file if it needed to be opened already in order to interpret the ID tag?

What I meant was that the file would have to be opened before the code tags could be read, so if the hardcoded name was in a siLangGetTextOrDefault statement then it couldn't be opened for reading. Is that correct?

With regard to fonts:

I realise there are sections in the sib and sil file that deal with these, but they also appear as available in the excluded properties dialog for each siLang component.

If I excluded the font property for a particular component would that remove it from the font and charset section. Would that matter if I had kept the forms font and Charset, and had the ParentFont property of each control set to true?

Delphis help file states the the ParentFont property:

"Determines where a control looks for its font information."

If this is so it should be possible to exclude the font property for other controls (on that form), from translation, and just leave the form font to be translated.

The other controls would then use the Forms font by default. This would decrease the size of the .sil and .sib files and speed up translation.

To test this, if you try setting up a form with all the controls having their ParentFont property set to true, and then change the forms Font.Name property to something like Bauhaus from its original (In my case Arial Unicode MS), you can see the change take place in the IDE.

If you just change the Forms Font.Charset property from ANSI_CHARSET to SYMBOL_CHARSET you can also see the change take place. It doesn't seem to work for other charsets but I guess that's because the captions etc are still using English character values.

Regards Nick
isiticov
Site Admin
Posts: 2385
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

Actually, there are really few cases when you need to translate filename. Usually, they are the same for all languages. Of course if you need to load the file before any code executed then you must use it outside TsiLang component.

All components with ParentFont=True won't be listed neither in Fonts nor in Charsets because this would be superfluous as you already stated. So if all your controls will have ParentFont=True then you will see only one entry for form itself in Fonts section.

Hope this helps.
Best regards,
Igor Siticov.
Post Reply