Problems with messagedlgs and exception, again.

All announcements, questions and issues related to the TsiLang Components Suite.
Post Reply
BEQ42
Posts: 1
Joined: Mon Sep 01, 2008 9:00 am

Problems with messagedlgs and exception, again.

Post by BEQ42 »

Hello,

first of all, I read a lot of problems with messagedlgs and exception in this forum but have some more problems.

My SiComponent Suite is 6.2.2
We use delphi for coding.

I have to translate things in English and Japanese

1. if i create messageboxess in Ansi or Widestring the msg text for Japanese was fine but Caption text in silang.messagedlg was corrupt. Insite MessageboxW Caption and msg was ok.

But all translated Japanese buttons a broken in the same way. I don't mean 'question marks'.
What's wrong? It's equal which message function I used.

2. Exception text in Japanese is totally corrupt. I read your posting to write a own exception handler. But however, exception class needs a string for handling. And we got only ansi- or wide strings

Do you have any suggestions ?


Thank You
DK
isiticov
Site Admin
Posts: 2385
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

Hello,

1. TsiLang will use regular (ANSI) controls if you use just MessageDlg() method of TsiLang. In order to be able to display Japanese text in message dialogs you would either need to set Default Locale to Japanese or use Unicode controls to build message boxes. You can find FAQ entry for this at http://www.tsilang.com/delphiglobalizat ... aq.html#21

2. If you need to "display" exceptions to end-user you would need either to use Unicode implementation of Exception class (I think TMS Unicode Controls have one) or to create a "top-level" handler of exceptions, for example Application.OnException and there use Unicode controls to display properly translated message. Something like this:

Code: Select all

procedure TForm1.AppException(Sender: TObject; E: Exception);
begin
  if E is EConvertError then
    siLang_Form1.MessageDlg(siLang_Form1.GetTextOrDefault(...)...)
  ....
end;
In this way if you use Unicode controls in message boxes as described above you would have exception's messages displayed as you need.

Please let us know if this helps.

P.S. Strings in Delphi (prior to Tiburon [Delphi 2009]) are AnsiStrings by default.
Best regards,
Igor Siticov.
Post Reply