[Lazarus] Improving IDE Internationalization

Marcelo B de Paula marcbp at terra.com.br
Sun Jan 24 14:50:16 CET 2010


Hello, dmitry

I donĀ“t think that Lazarus is working as this.
http://wiki.lazarus.freepascal.org/IDE_Development#Translated_compiler_messages 
was added recently by Mattias

The purpose of new code is substitute the error string treatments by the 
message numbers
As an example see this excerpt:

  function CheckForNoteMessages(p: integer): boolean;
  begin
    Result:=false;
    if CompStr('Note: ',s,p) or CompStr(FErrorNames[etNote], s, p) then 
begin
      DoAddFilteredLine(copy(s,p,length(s)));
      fLastErrorType:=etNote;
      CurrentMessageParts.Values['Stage']:='FPC';
      CurrentMessageParts.Values['Type']:=FPCErrorTypeNames[fLastErrorType];
      Result:=true;
      exit;
    end;
  end;

The fact that current code is comparing messages with const strings like 
"Note:" prevent the use of
translated compiler messages. Instead, the use of message numbers (compiler 
switch -vq) can be
used in place to detect the type of message. So we could use the message 
number itself or the type.
See example:

    case msg of
       //
       //
       //   Lines compiled
       1008: begin
              if (CompilerOptions.ShowAll or CompilerOptions.ShowSummary) 
then
                  DoAddFilteredLine(copy(s,1,length(s)));
              Result:=true;
       end;

  case CompilerMsgType of
     // Note
     'N' : begin
            //
            fLastMessageType:=omtFPC;
            fLastErrorType:=etNote;
            CurrentMessageParts.Values['Stage']:='FPC';
            CurrentMessageParts.Values['Type']:='Note';//FPCErrorTypeNames[etNote];
            //
            SkipMessage:=not (CompilerOptions.ShowNotes or 
CompilerOptions.ShowAll);

            if not SkipMessage then DoAddFilteredLine(s);
            Result:=true;
     end;


----- Original Message ----- 
From: "dmitry boyarintsev" <skalogryz.lists at gmail.com>
To: "Lazarus mailing list" <lazarus at lists.lazarus.freepascal.org>
Sent: Sunday, January 24, 2010 2:39 AM
Subject: Re: [Lazarus] Improving IDE Internationalization


Hello Marcelo,

The current (svn version) of Lazarus, is working as described. Except
for messages are not loaded from errore.msg file initially.  The
location of errore.msg may vary from platform to platform, depending
on location of FPC.
But IDE's compiler messages can be configured to load the messages
file by default, from a specified location.

On Sun, Jan 24, 2010 at 4:47 AM, Marcelo B de Paula <marcbp at terra.com.br> 
wrote:
> Needed to change CompilerOptions.pp to load 'E' and 'F' types.
It's not necessary to load E/F messages at all. Because it should NOT
be possible to "switch them off", as you say it yourself:
> - The Project Options->Compiler Options->Messages should be tunned to not
> present 'E' and 'F' types.

The only tweak required here was to load translated "error", "fatal
error" strings, so the OutputFilter could detect the type of the error
and shown the proper Icon. It has been implemented a few months ago.

thanks,
dmitry








More information about the Lazarus mailing list