diff --git a/ide/idetranslations.pas b/ide/idetranslations.pas index 40858aa5ab..f444c07217 100644 --- a/ide/idetranslations.pas +++ b/ide/idetranslations.pas @@ -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); diff --git a/ide/main.pp b/ide/main.pp index aef88d5d47..f217bad43b 100644 --- a/ide/main.pp +++ b/ide/main.pp @@ -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; diff --git a/lcl/translations.pas b/lcl/translations.pas index 72aa8d0246..f7a328d287 100644 --- a/lcl/translations.pas +++ b/lcl/translations.pas @@ -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