MessageDlg String does not apear in siComp

All announcements, questions and issues related to the TsiLang Components Suite.
Post Reply
kkgian
Posts: 7
Joined: Fri May 16, 2003 8:32 am

MessageDlg String does not apear in siComp

Post by kkgian »

Greetings,

Code: Select all

...
if MessageDlg('Are you sure?',
                     mtConfirmation, 
                     [mbOk, mbCancel], 0) = mrOk then
begin
  Label1.Caption:= 'Yes I am';
end
else
begin
  Label1.Caption:= 'NO, I don''t ';
end;
...
  • I can't find the 'Are you sure' in siComp.
    How to do translation for Label1 without predefine constant message string?
TIA

Gian
gaivans
Posts: 71
Joined: Fri Nov 29, 2002 4:10 pm

Post by gaivans »

Hello,

If you use "hard-coded" strings or string constants you need to add them to the Translation Data of corresponding TsiLang component. The easiest way to do it is using TsiLang Expert. Let's suppose you work with "Form1" and this form alredy has a TsiLang component:

1. Launch the TsiLang Expert (Ctrl+L) and select "Form1" in the list view;
2. Click the expert menu "File|Source|With form...". All "hard-coded" strings will be added to the "Strings" property of its TsiLang component. And your code will be modified like this:
if MessageDlg(siLang1.GetTextOrDefault('STR_0' (* 'Are you sure?' *) ),
mtConfirmation,
[mbOK, mbCancel], 0) = mrOk then
begin
Label1.Caption := siLang1.GetTextOrDefault('STR_1' (* 'Yes I am' *) );
end
else
begin
Label1.Caption := siLang1.GetTextOrDefault('STR_2' (* 'NO, I don't ' *) );
end;
3. Open the Translation Editor for the siLang1 and enter translations.
4. You may also wish to translate the button captions (in this case "OK" and "Cancel"). Then replace usual "MessageDlg" with the corresponding method of TsiLang, that is just replace
if MessageDlg(...
with this:
if siLang1.MessageDlg(...
and provide translations for the "Dialogs" property of the TsiLang component.


To learn more about internationalization applications with TsiLang download our "User Manual" from http://www.sicomponents.com/soft/siManual.pdf
Best regards,
Serghei Gaivan
Post Reply