[Lazarus] German localization in Lazarus app

Michael Fuchs freepascal at ypa-software.de
Mon Dec 19 14:45:06 CET 2011


Am 19.12.2011 09:38, schrieb fred f:
> Hi guyz,
>
> I have compiled and use Lazarus with German language, but e.g. the
> buttons in message dialogs are still Yes, No, Cancel instead of German
> Ja, Nein, Abbrechen, ...
>
> What should I set up to get everything in German even exceptions, ...


For the dialogs under windows, I have a little (and very ugly) hack:

--------->8--------->8--------->8--------->8--------->8--------->8--
{$IFDEF WINDOWS}
{$R ekgnet.rc}
// HACK: For using german descriptions in Messagebox
procedure HookResourceString(rs: PResStringRec; newStr: PChar);
var
   oldprotect: DWORD;
begin
   VirtualProtect(rs, SizeOf(rs^), PAGE_EXECUTE_READWRITE, @oldProtect);
   rs^ := newStr;
   VirtualProtect(rs, SizeOf(rs^), oldProtect, @oldProtect);
end;
{$ENDIF}


begin
   Application.Title := 'project1';
   Application.Initialize;
   Application.CreateForm(TForm1, Form1);
   {$IFDEF WINDOWS}
   HookResourceString(@rsMbYes, 'Ja');
   HookResourceString(@rsMbNo, 'Nein');
   {$ENDIF}
   Application.Run;
end.

--------->8--------->8--------->8--------->8--------->8--------->8--

hth
Michael




More information about the Lazarus mailing list