Recent

Author Topic: dialog why no display Chinese  (Read 340 times)

luckrill

  • Newbie
  • Posts: 4
dialog why no display Chinese
« on: June 23, 2022, 12:22:40 pm »
 my env is windows 10 Chinese

 call ShowMessage() or  Application.MessageBox()

 display is english button.

 how to change to display Chinese button?

luckrill

  • Newbie
  • Posts: 4
Re: dialog why no display Chinese
« Reply #1 on: June 23, 2022, 12:26:28 pm »
I try Chinese win10 or win7, english button

my lazarus env

I learn dialog from this:
https://wiki.freepascal.org/Dialog_Examples/zh_CN
« Last Edit: June 23, 2022, 12:29:19 pm by luckrill »

korba812

  • Sr. Member
  • ****
  • Posts: 276
Re: dialog why no display Chinese
« Reply #2 on: June 23, 2022, 12:40:24 pm »
The default built-in language is English. To use a different one, you need to load the appropriate language in your application. Read these topics:

https://wiki.freepascal.org/Translations_/_i18n_/_localizations_for_programs

https://wiki.freepascal.org/Everything_else_about_translations

gucao

  • New Member
  • *
  • Posts: 29
Re: dialog why no display Chinese
« Reply #3 on: June 23, 2022, 01:55:51 pm »
Code: Pascal  [Select][+][-]
  1.   if QuestionDlg('提示','这里提示信息的按钮会显示中文',mtCustom,[100,'是中文',101,'不是中文'],'')=100 then
  2.     ShowMessage('是中文');
  3.  

CN:我更喜欢下面这种方式,因为对话框的关闭按钮返回值也是"mrCancel"
TR:I prefer the following way, because the dialog's close button return value is also "mrCancel"
Code: Pascal  [Select][+][-]
  1.   if QuestionDlg('提示','确定要继续嘛?',mtCustom,[mrOK,'确定',mrCancel,'取消'],'')=mrCancel then
  2.     ShowMessage('你点了取消或者X按钮');
  3.  
« Last Edit: June 23, 2022, 02:18:35 pm by gucao »

Handoko

  • Hero Member
  • *****
  • Posts: 4595
  • My goal: build my own game engine using Lazarus
Re: dialog why no display Chinese
« Reply #4 on: June 23, 2022, 02:30:15 pm »
Tested gucao's suggestion, it works on Linux GTK2:

luckrill

  • Newbie
  • Posts: 4
Re: dialog why no display Chinese
« Reply #5 on: June 23, 2022, 03:31:02 pm »
default is english?

I run test with Chinese version linux, same code. Default is Chinese now

With linux env, if english env: display english button, if Chinese env: display Chinese button.

hope follow function all support chinese display with Chinese win10 env.

ShowMessage()
MessageBox()
MessageDlg()
InputBox()
InputQuery()
PasswordBox()

luckrill

  • Newbie
  • Posts: 4
Re: dialog why no display Chinese
« Reply #6 on: June 23, 2022, 03:39:06 pm »
yes QuestionDlg

Question dialog allows changing button captions and setting default and cancel buttons. The 3rd argument in the QuestionDlg() call determines the icon shown in the dialog. In some widgetsets, the icon can be suppressed by selecting message type mtCustom.

QuestionDlg('Caption', 'Message', mtInformation, [mrYes, 'Positive', mrNo, 'Negative', 'IsDefault'], '') of
        mrYes: QuestionDlg('Caption', 'So you mean „Yes“', mtCustom, [mrOK, 'That is right'],'');
        mrNo: QuestionDlg('Caption', 'Oh, you mean „No“', mtCustom, [mrOK, 'Exactly'], '');
        mrCancel: QuestionDlg('Caption', 'You cancelled the dialog with ESC or close button.', mtCustom, [mrOK, 'Exactly'], '');

this dialog support!

 

TinyPortal © 2005-2018