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 

Trial with TNT Unicode
Goto page 1, 2  Next
 
Post new topic   Reply to topic    SiComponents Forums Forum Index -> TsiLang Components Suite
View previous topic :: View next topic  
Author Message
james_screech



Joined: 20 Jan 2011
Posts: 13

PostPosted: Mon Jan 24, 2011 3:02 pm    Post subject: Trial with TNT Unicode Reply with quote

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
Back to top
View user's profile Send private message
isiticov
Site Admin


Joined: 21 Nov 2002
Posts: 2102

PostPosted: Tue Jan 25, 2011 3:28 pm    Post subject: Reply with quote

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_support_for_far_east_or_other_unicode_languages.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.
Back to top
View user's profile Send private message
james_screech



Joined: 20 Jan 2011
Posts: 13

PostPosted: Tue Jan 25, 2011 3:48 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
isiticov
Site Admin


Joined: 21 Nov 2002
Posts: 2102

PostPosted: Wed Jan 26, 2011 5:18 am    Post subject: Reply with quote

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?
Back to top
View user's profile Send private message
james_screech



Joined: 20 Jan 2011
Posts: 13

PostPosted: Wed Jan 26, 2011 8:28 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
james_screech



Joined: 20 Jan 2011
Posts: 13

PostPosted: Wed Jan 26, 2011 10:52 am    Post subject: Reply with quote

Hi Igor,

The font changes fixed the problem, thank you. Very Happy

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 Sad

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

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


Joined: 21 Nov 2002
Posts: 2102

PostPosted: Thu Jan 27, 2011 3:00 pm    Post subject: Reply with quote

Hi James,

Please take a look at the following FAQ entry: http://www.tsilang.com/delphiglobalizationtool_faq.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.
Back to top
View user's profile Send private message
james_screech



Joined: 20 Jan 2011
Posts: 13

PostPosted: Thu Jan 27, 2011 3:31 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
isiticov
Site Admin


Joined: 21 Nov 2002
Posts: 2102

PostPosted: Mon Jan 31, 2011 8:05 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
james_screech



Joined: 20 Jan 2011
Posts: 13

PostPosted: Mon Jan 31, 2011 8:28 am    Post subject: Reply with quote

Hi,

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

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


Joined: 21 Nov 2002
Posts: 2102

PostPosted: Mon Jan 31, 2011 8:41 am    Post subject: Reply with quote

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?
Back to top
View user's profile Send private message
james_screech



Joined: 20 Jan 2011
Posts: 13

PostPosted: Mon Jan 31, 2011 10:18 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
isiticov
Site Admin


Joined: 21 Nov 2002
Posts: 2102

PostPosted: Mon Jan 31, 2011 1:01 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
james_screech



Joined: 20 Jan 2011
Posts: 13

PostPosted: Mon Jan 31, 2011 1:35 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
isiticov
Site Admin


Joined: 21 Nov 2002
Posts: 2102

PostPosted: Mon Jan 31, 2011 3:22 pm    Post subject: Reply with quote

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

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
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
Goto page 1, 2  Next
Page 1 of 2

 
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