Form Captions

All announcements, questions and issues related to the TsiLang Components Suite.
Post Reply
Kev
Posts: 24
Joined: Fri Apr 01, 2005 5:56 pm

Form Captions

Post by Kev »

I purchased the Language suite back in April. I tried to use it, but there were many issues that I could not seem to resolve. I set it aside and continued on my project. My project is now complete and I managed to get different languages to display by setting up XP with the "set non-Unicode programs" option in the Regional settings to Chinese. This works even for Russian. The problem is now I have been informed that this is not acceptable because if any setup disk is inserted such as an HP driver disk, all the setup dialogs are in Chinese.

So, I am revisiting the component at the last minute. The first problem I have is that I cannot seem to get the Form->Caption to display properly. Labels and other Captions seem to work. What is the problem? Or is it not possible to show the Form->Caption?

I will have other issues I am sure, but lets get this one out of the way first.

Thanks for any assistance. I am in a real bind right now and need all the help I can get.

thanks,
Kev
isiticov
Site Admin
Posts: 2385
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

I suppose you've used Unicode controls for you project but forgot to replace the form itself. If form would be Unicode (like TTntForm) then it caption will be displayed properly.
Please let me know if this helps.
Best regards,
Igor Siticov.
Kev
Posts: 24
Joined: Fri Apr 01, 2005 5:56 pm

Form Captions

Post by Kev »

I guess I misunderstood how SiComponents actually work. I thought I did not need "Unicode" controls such as Tnt. So do I need both? If so, why do other standard captions work such as TLabels? What about my many "QReports" in this project? By the way I am using BCB 6.0.

thanks,
Kev
isiticov
Site Admin
Posts: 2385
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

OK, then may be I've missed the point :)
Non-Unicode VCL, like TLabel and others displayed correctly because they use Charset settings when drawing. TForm caption, TButton and some others which are wrappers of standard Windows controls are drawn using Default Locale settings and this means that if you default locale doesn't support characters that you try to display they will be displayed incorrectly.
To solve this problem with these components you need either set Default Locale or use Unicode replacements for such controls. TsiLang beginning from v6.0 is quite good in handling Unicode properties so you will be able to display any language independent from system locale.
But the choise is up to you which way to use.

Hope this helps.
Best regards,
Igor Siticov.
Kev
Posts: 24
Joined: Fri Apr 01, 2005 5:56 pm

Form Caption

Post by Kev »

OK,

It looks like I got the 6.0 installed into Builder. I am going to reset my computer for total English Locale (Non-Unicode option in Regional Settings set to English) and see what happens. Do I understand correctly that even with Ver. 6.0, I still need some Tnt controls? I do not understand the TTntForm that you mentioned. I do not see such a control on in the Tnt Components list.

Thanks for your patience with my ignorance on this subject. I appreciate your help very much.

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

Post by isiticov »

Yes, you will need Unicode (TNT as particular) controls in order to display properly any characters under any OS. TTntForm is available under File->New in C++Builder's menu.
Best regards,
Igor Siticov.
Kev
Posts: 24
Joined: Fri Apr 01, 2005 5:56 pm

Form Captions

Post by Kev »

Thanks,

I see it now.

Could you give me some advice on how to proceed with this project?

As I said, the project is actually completed and is very large. I handled my translations by putting them all in an "Ini" file with each string to be translated in brackets and the associated translation on an "=" line like this:
[Menu View]
English= &View
Chinese= 看法 (&V)
Spanish= &Ver
Russian= &Взгляд
German= &Ansicht
Other=

I used the TiniFile class to read the translation from the file based on the selected language like this:

File1->Caption = In->ReadString("Menu View",
Options.aProgramLanguage,
"&View");

I do this for every caption on every form which is in the hundreds, but it works quite well. The user just clicks on a language which calls the function that reads the ini file entries for all captions.

The million dollar question is this. Is there a way to utilize in some way all of that code that currently updates all the captions without having to re-enter them in the Lang. Editor. In other words is there some way to use each "ReadString" function (which returns an AnsiString) to populate the forms?

thanks ... Again!

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

Post by isiticov »

The simplest way I can see is the following:
You add for each form in your project the temporary code (which could be placed under some event, for ex. OnClick on TForm) that could be described as:
1. Set TsiLang ActiveLanguage to [X]
2. Use your routine to load form's controls captions
3. Call TsiLang BuildList method
4. Repeat 1.-3. for all languages
5. Save TsiLang to file using SaveAllToFile() or SaveAllToBinaryFile() [binary is preferable]
6. Repeat 1.-5. for every form in project, saving all of them into the same file
7. Exit your project and run TsiLang Expert and use File -> Save/Load ->Load Project and select the file used in 5.


Please let me know if this helps.
Best regards,
Igor Siticov.
Kev
Posts: 24
Joined: Fri Apr 01, 2005 5:56 pm

Caption

Post by Kev »

Hmm,

I was hoping I might be able to read the translated string as is from the ini file and then somehow pass that to SiLang, but I will give it a try and let you know. In either case, I have a huge amount of work to do.

thanks,
Kev
Post Reply