How can I change/translate at runtime the value of resourcestring
const
s like SMsgDlgYes
, SMsgDlgNo
, etc. as used by TDialogService.MessageDialog
?
It's for a FireMonkey app (iOS/Android/Windows) so I can't use Windows API like VirtualProtect
.
I went through the search for how to make the switch to the ButtonCaptions and after giving myself almost up, I found an easy way. That I share. In my case I use the call to TDialogServiceAsync.MessageDialog, to show an asynchronous message in Android, but before making the call I personalize the ButtonCaptions, which is nothing more than a constant defined in FMX.Dialogs that when typed allows to redefine it
ButtonCaptions[TMsgDlgBtn.mbyes] := 'Si';
TDialogServiceAsync.MessageDialog(‘Está seguro de salir sin guardar?’,
TMsgDlgType.mtConfirmation,
[TMsgDlgBtn.mbyes,TMsgDlgBtn.mbNo],
TMsgDlgBtn.mbNo,
0,
procedure(const AResult:TModalResult)
begin
if AResult = mrYes then
begin
//put our code
end
else begin
//put our code
end;
end
);