Trial with TNT Unicode

All announcements, questions and issues related to the TsiLang Components Suite.
james_screech
Posts: 13
Joined: Thu Jan 20, 2011 10:48 am

Trial with TNT Unicode

Post by james_screech »

Hi,

I'm trying the trial version of TsiLang with the TNT unicode controls, however I have some problems. (I'm using Borland Builder 6)

1) Translation Editor does not appear to support unicode (SIL editor does)

2) If I use the standard classes (TsiLang etc.) unicode characters are not displayed, "?" is used instead (I think this is correct functionality)

3) If I change the types to TsiLang_TNT etc. I get compiler errors indicating that the type (TsiLang_TNT) is not recognised

I assume that I'm doing something silly in 3) but I cannot see what.

Kind regards
James
isiticov
Site Admin
Posts: 2383
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

Hello,

Thank you for your message.

1) Translation Editor is built using only native VCL and as result it is ANSI under C++Builder 6 as well as IDE itself. It supports all characters as well as Unicode supported by your OS. But there is only needed to take care about the proper font and charset configuration for controls and languages.
Please take a look at the following article: http://www.tsilang.com/press/en/adding_ ... uages.html
The main idea is that you need to properly define Font name and Charset for your Unicode language used. Translation Editor as well as TsiLang will later use this data to perform the conversion from Unicode to ANSI and vice versa.

2) No this is not a correct behavior. Even regular TsiLang classes should properly display the Unicode items if you have defined correct settings for the languages. TsiLangxxx_Tnt classes are defined only in order to support TNT specific properties like Unicode TStringList and so on.

3) The most possible reason is that ther is either .HPP file not included for TsiLangxxx_Tnt component or so on. Did you place the TsiLang_Tnt on form and try to compile to get such error?

We're preparing for you a small demo for use of TsiLang, Tnt and C++Builder 6. Will try to send it to you by email.
Best regards,
Igor Siticov.
james_screech
Posts: 13
Joined: Thu Jan 20, 2011 10:48 am

Post by james_screech »

I couldn't place the TsiLang_Tnt directly on the form as it was not in the available controls. I added a TsiLang and then re-named it in the code.

If you could give me a demo app that has all of this work it would be great. I've been asked by my boss to produce a demo to prove that TsiLang and TNT will work together as we need to convert an old application to support Arabic text.
isiticov
Site Admin
Posts: 2383
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

Hello,

TsiLang TNT components are not installed automatically. You would need just manually open and install TsiLangTnt_CB6.bpk package into IDE from TsiLang_Tnt sub-folde. Just open the TsiLangTnt_CB6.bpk file and click Install button. Then you will have TsiLangxxx_Tnt installed into components palette.
Did you receive our small sample project we sent to you by email?
Best regards,
Igor Siticov.
james_screech
Posts: 13
Joined: Thu Jan 20, 2011 10:48 am

Post by james_screech »

Hi Igor,

I cannot install TsiLangTnt_CB6.bpk as the system says that it is unable to find the package import TntLibR.bpi.

I did receive the email, thank you. However the compiled application does displays boxes instead of the Chinese characters.

I'll have a look into the artical you mentioned and check fonts etc.

Kind regards
James
james_screech
Posts: 13
Joined: Thu Jan 20, 2011 10:48 am

Post by james_screech »

Hi Igor,

The font changes fixed the problem, thank you. :D

Now I'm looking at your MessageBox replacment (http://www.sicomponents.com/forum/viewtopic.php?t=518)

I've got this working with Ansi text, however as TsiCutomLang::CreateMessageDialog() uses AnsiString it does not work with UNICODE character sets :(

Is there an alternative method that will allow the setting of message box text and buttons to UNICODE text :?:

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

Post by isiticov »

Hi James,

Please take a look at the following FAQ entry: http://www.tsilang.com/delphiglobalizat ... aq.html#21

Reference to TntLibR.bpi can be replaced by the respective package from TMS. It might be renamed in recent released of TMS Unicode.
Best regards,
Igor Siticov.
james_screech
Posts: 13
Joined: Thu Jan 20, 2011 10:48 am

Post by james_screech »

I have already set the MsgDlg... variables as shown but it makes no difference. I've tried setting them in the main application form constructor and just before the message box replacement is used but the unicode text is always displayed as question marks.

With respect to the Tnt package there are no .bpi files supplied with it so I don't know what file I should change the system to use.

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

Post by isiticov »

Just sent you by email the modified sample that demonstrates using TNT in CPP projects for MessageDlg(). Please let us know how it works on your side.
Best regards,
Igor Siticov.
james_screech
Posts: 13
Joined: Thu Jan 20, 2011 10:48 am

Post by james_screech »

Hi,

Unfortunatly the text is not displayed correctly on the MessageBox. Email sent will screen image.

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

Post by isiticov »

Thank you for the screenshot. Actually, the Chinese text is displayed incorrectly everywhere on your screenshot and this means that your OS settings don't support Chinese. Did you install the option "Install support for Far-East languages" in your Regional Settings in Control Panel?
Best regards,
Igor Siticov.
james_screech
Posts: 13
Joined: Thu Jan 20, 2011 10:48 am

Post by james_screech »

We appear to be getting some where now.

The button and main messagebox text are converted, however there is no way to set the messagebox's caption to a non-default text string and this is always displayed in English as the translater does does not find the default caption text in the project.

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

Post by isiticov »

If you run the EXE I sent you last time you will notice that the caption of message box form is in Chinese as well.
Best regards,
Igor Siticov.
james_screech
Posts: 13
Joined: Thu Jan 20, 2011 10:48 am

Post by james_screech »

The caption in your example is in Chinese, however the MessageDlg() function dows not have a parameter to set the value of the caption. A standard MessageBox() has parameters to set the main text, caption text and the buttons/icons displayed on the message box. I would have thought that most users would need to be able to set the caption on each message box/dlg. Also the default value used as the caption is not picked up by the translation tools (as far as I can see). In my simple test application it is only displayed in English and I have no way of changing it.

By playing around with your InternalMessageDlg() example (casting the return from CreateMessageDialog() to a TTntForm*) I can get the caption and buttons translated but not the main text displayed.

It would appear that with the current version of TsiLang I can have translations for only two out of the three (caption, main text, buttons) components of a messagebox depending on the method I use, but never full control over all three.

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

Post by isiticov »

Everything is possible to translate with TsiLang. :)
The mentioned sample of InternalMessageDlg() should be just a little bit modified as folowing:

Code: Select all

class PASCALIMPLEMENTATION TAccessLang : public TsiCustomLang
{
   typedef TsiCustomLang inherited;
  public:
    Forms::TForm* __fastcall CreateMessageDialog(const AnsiString Msg, Dialogs::TMsgDlgType DlgType, Dialogs::TMsgDlgButtons Buttons, const Dialogs::TMsgDlgBtn DefaultBtn = (Dialogs::TMsgDlgBtn)(0x2), const Dialogs::TMsgDlgBtn CancelBtn = (Dialogs::TMsgDlgBtn)(0x3)) {
      return (TsiCustomLang::CreateMessageDialog(Msg, DlgType, Buttons, DefaultBtn, CancelBtn));
    }
};


int __fastcall InternalMessageDlg(const TsiCustomLang * siLang, const AnsiString MsgCaption, const AnsiString Msg, Dialogs::TMsgDlgType DlgType, Dialogs::TMsgDlgButtons Buttons, int HelpCtx, const Dialogs::TMsgDlgBtn DefaultBtn = (Dialogs::TMsgDlgBtn)(0x2), const Dialogs::TMsgDlgBtn CancelBtn = (Dialogs::TMsgDlgBtn)(0x3)){
  TAccessLang * ALang = (TAccessLang *)siLang; 
  TTntForm * MsgForm = (TTntForm *) ALang->CreateMessageDialog(Msg, DlgType, Buttons, DefaultBtn, CancelBtn);
  int I; 
  try 
  { 
    MsgForm->HelpContext = HelpCtx; 
    MsgForm->HelpFile = Application->HelpFile; 
    MsgForm->Caption = AnsiStringToWideStringCP(MsgCaption, MsgForm->Font->Charset);
    I = MsgForm->ShowModal();
    return (I); 
  }
  __finally 
  { 
    MsgForm->Release(); 
  } 
  return (I); 
}
I've sent you the modified sample project by email.
Hope this helps.

P.S. Although on my opinion having custom message box captions shouldn't be used. Because customers usually expect the standard message to be displayen in a title box and very rare read it in case there is something customized.
Last edited by isiticov on Tue Feb 01, 2011 1:05 pm, edited 1 time in total.
Best regards,
Igor Siticov.
Post Reply