lcl: fixed comialtion with fpc 2.6.2

git-svn-id: trunk@43749 -
This commit is contained in:
mattias 2014-01-17 09:47:44 +00:00
parent b7b6c05eac
commit 512afcce68
3 changed files with 30 additions and 2 deletions

View File

@ -27,6 +27,10 @@ unit IDETranslations;
{$mode objfpc}{$H+}
{$IF FPC_FULLVERSION>20602}
{$DEFINE HasRSJ}
{$ENDIF}
interface
uses
@ -333,8 +337,10 @@ begin
FileType:=stLrt
else if CompareFileExt(Filename,'.rst',false)=0 then
FileType:=stRst
{$IFDEF HasRSJ}
else if CompareFileExt(Filename,'.rsj',false)=0 then
FileType:=stRsj
{$ENDIF}
else
continue;
SrcBuf:=CodeToolBoss.LoadFile(Filename,true,false);

View File

@ -12984,6 +12984,8 @@ begin
end
else if CompareFileExt(AnUnitInfo.Filename,'inc',false)=0 then
OkToAdd:=SourceFileMgr.CheckDirIsInSearchPath(AnUnitInfo,False,True);
if OkToAdd then
;
Project1.Modified:=true;
end;

View File

@ -60,14 +60,28 @@ unit Translations;
{$mode objfpc}{$H+}{$INLINE ON}
{$include include/lcl_defines.inc}
{$IF FPC_FULLVERSION>20602}
{$DEFINE HasRSJ}
{$ENDIF}
interface
uses
Classes, SysUtils, LCLProc, FileUtil, StringHashList, AvgLvlTree,
LConvEncoding, jsonparser, fpjson;
LConvEncoding
{$IFDEF HasRSJ}
,jsonparser, fpjson
{$ENDIF}
;
type
TStringsType = (stLrt, stRst, stRsj);
TStringsType = (
stLrt, // Lazarus resource string table
stRst // FPC resource string table
{$IFDEF HasRSJ}
,stRsj // resource string table in JSON format
{$ENDIF}
);
TTranslateUnitResult = (turOK, turNoLang, turNoFBLang, turEmptyParam);
type
@ -335,9 +349,11 @@ begin
if CompareFileExt(Filename,'.lrt')=0 then
BasePOFile.UpdateStrings(InputLines, stLrt)
{$IFDEF HasRSJ}
else
if CompareFileExt(Filename,'.rsj')=0 then
BasePOFile.UpdateStrings(InputLines, stRsj)
{$ENDIF}
else
BasePOFile.UpdateStrings(InputLines, stRst);
@ -856,6 +872,7 @@ var
p := 1;
end;
{$IFDEF HasRSJ}
procedure UpdateFromRsj;
var
Parser: TJSONParser;
@ -877,13 +894,16 @@ var
Parser.Free;
end;
end;
{$ENDIF}
begin
ClearModuleList;
UntagAll;
{$IFDEF HasRSJ}
if SType = stRsj then
UpdateFromRsj
else
{$ENDIF}
begin
// for each string in lrt/rst list check if it's already in PO
// if not add it