Jump to content

Localizable MessageDlg - how change the title of the dialog box?


BobyX

Recommended Posts

Hi.

 

How do I change the title of the dialog box or how to display the dialog box title in the selected language?

 

Setting the "ExtLocale" in ServerModule does not change the title of the dialog box, according to the selected language.

 

It is still displayed the english titles, for exemple "Confirm" for a mtConfirmation dialog type.

 

Thanks for the advice.

Link to comment
Share on other sites

  • Administrators

Hi.

 

How do I change the title of the dialog box or how to display the dialog box title in the selected language?

 

Setting the "ExtLocale" in ServerModule does not change the title of the dialog box, according to the selected language.

 

It is still displayed the english titles, for exemple "Confirm" for a mtConfirmation dialog type.

 

Thanks for the advice.

 

Ext JS doesn't directly implement a default value for title. You must use a translator (like the one integrated in IDE) to translate resourcestring.

Link to comment
Share on other sites

  • 3 months later...

I'll try to do it. Thanks for the explanation.

 

 

try this..

 

unit Funcoes_Traducao_u;

{
Objetivo: Traduzir automaticamente todas as mensagens do inglês
Motivo: O UniGUI da versão atual não tem função de localização das mensagens internas do Delphi
   	No TUniServerModule tem a propriedade ExtLocate que tem que ficar pt_BR para tradução
   	de algumas mensagens para portugues, mas isso será somente para algumas e para Web.
   	Usar o tradutor do delphi vai duplicar o projeto e complicar o processo de desenvolvimento.
Fonte: http://leandropiga.nothus.com.br/?p=38
Forma de utilização: Basta adicionar essa unit no projeto.
Atualizações: Para traduzir outras mensagens, deve-se buscar nos arquivos de constantes
 do delphi (Windows, Consts, DBConsts, VDBConsts) a identificação da mensagem e
 substituir ela conforme abaixo pelo novo nome.
}

interface

uses Windows, Consts, DBConsts, VDBConsts;

 procedure SetResourceString(AResString: PResStringRec; ANewValue: PChar);

const
 SNewMsgDlgConfirm: PChar = 'Confirmação';
 SNewMsgDlgYes: PChar = 'Sim';
 SMewMsgDlgNo: PChar = 'Não';
 SNewMsgDlgOK: PChar = 'Ok';
 SNewMsgDlgCancel: PChar = 'Cancelar';
 SNewDeleteRecordQuestion: PChar = 'Excluir Registro?';
 SNewDeleteRecord: PChar = 'Excluir Registro?';

implementation

procedure SetResourceString(AResString: PResStringRec; ANewValue: PChar);
var
 POldProtect: DWORD;
begin
 VirtualProtect(AResString, SizeOf(AResString^), PAGE_EXECUTE_READWRITE, @POldProtect);
 AResString^.Identifier := Integer(ANewValue);
 VirtualProtect(AResString, SizeOf(AResString^), POldProtect, @POldProtect);
end;

initialization
 SetResourceString(@SMsgDlgConfirm, SNewMsgDlgConfirm);
 SetResourceString(@SMsgDlgYes, SNewMsgDlgYes);
 SetResourceString(@SMsgDlgNo, SMewMsgDlgNo);
 SetResourceString(@SMsgDlgOK, SNewMsgDlgOK);
 SetResourceString(@SMsgDlgCancel, SNewMsgDlgCancel);
 SetResourceString(@SDeleteRecordQuestion, SNewDeleteRecordQuestion);
 SetResourceString(@SDeleteRecord, SNewDeleteRecord);

end.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...