From 1e444d83981c2c087899a879e5dcc5002371c4f6 Mon Sep 17 00:00:00 2001 From: juha Date: Wed, 27 May 2020 10:30:19 +0000 Subject: [PATCH] IDE: Show name and description in "New Item" and "New Project" dialogs. Simplifies GetLocalizedDescription methods. Issue #37134. git-svn-id: trunk@63234 - --- components/fpcunit/ide/fpcunitlazideintf.pas | 23 ++---- components/fpweb/fpwebtoolsunit.pas | 9 +-- components/fpweb/weblazideintf.pp | 73 ++++++++----------- .../instantfpc/instantfpcregisterlaz.pas | 8 +- ide/newdialog.pas | 3 +- ide/newprojectdlg.pp | 15 +++- ide/projectdescriptors.pas | 15 ++-- 7 files changed, 62 insertions(+), 84 deletions(-) diff --git a/components/fpcunit/ide/fpcunitlazideintf.pas b/components/fpcunit/ide/fpcunitlazideintf.pas index 399ecd96f4..0487396ad9 100644 --- a/components/fpcunit/ide/fpcunitlazideintf.pas +++ b/components/fpcunit/ide/fpcunitlazideintf.pas @@ -91,17 +91,12 @@ implementation resourcestring sFPCUnTestApp = 'FPCUnit Test Application'; - sFPCUnTestAppDesc = 'FPCUnit Test Application%sAn application to run ' - +'FPCUnit test cases.%sThe application source is automatically maintained by ' - +'Lazarus.'; + sFPCUnTestAppDesc = 'An application to run FPCUnit test cases.'; sFPCUnTestCase = 'FPCUnit Test Case'; - sFPCUnTestCaseDesc = 'FPCUnit Test Case%sA unit containing a FPCUnit Test ' - +'Case.'; + sFPCUnTestCaseDesc = 'A unit containing a FPCUnit Test Case.'; sWriteYourOwnTest = 'Write your own test'; sFPCUnConsoleTestApp = 'FPCUnit Console Test Application'; - sFPCUnConsoleTestDesc = 'FPCUnit Console Test Application%sAn application ' - +'to run FPCUnit test cases in console mode.%sThe application source is ' - +'automatically maintained by Lazarus.'; + sFPCUnConsoleTestDesc = 'An application to run FPCUnit test cases in console mode.'; procedure Register; begin @@ -127,11 +122,8 @@ begin end; function TFPCUnitApplicationDescriptor.GetLocalizedDescription: string; -var - le: string; begin - le := System.LineEnding; - Result:=Format(sFPCUnTestAppDesc,[le+le,le]); + Result:=sFPCUnTestAppDesc; end; function TFPCUnitApplicationDescriptor.InitProject(AProject: TLazProject): TModalResult; @@ -255,7 +247,7 @@ end; function TFileDescPascalUnitFPCUnitTestCase.GetLocalizedDescription: string; begin - Result:=Format(sFPCUnTestCaseDesc,[#13]); + Result:=sFPCUnTestCaseDesc; end; function TFileDescPascalUnitFPCUnitTestCase.GetInterfaceSource(const Filename, @@ -331,11 +323,8 @@ begin end; function TFPCUnitConsoleApplicationDescriptor.GetLocalizedDescription: string; -var - le: string; begin - le := System.LineEnding; - Result:=Format(sFPCUnConsoleTestDesc,[le+le,le]); + Result:=sFPCUnConsoleTestDesc; end; function TFPCUnitConsoleApplicationDescriptor.InitProject( diff --git a/components/fpweb/fpwebtoolsunit.pas b/components/fpweb/fpwebtoolsunit.pas index 8cb39c7322..09a8602ab4 100644 --- a/components/fpweb/fpwebtoolsunit.pas +++ b/components/fpweb/fpwebtoolsunit.pas @@ -773,8 +773,7 @@ begin Result:=SHtmlFileDesc; end; -function THtmlFileDescriptor.GetResourceSource(const ResourceName: string - ): string; +function THtmlFileDescriptor.GetResourceSource(const ResourceName: string): string; begin Result:=''; end; @@ -819,8 +818,7 @@ begin Result:=SJSFileDesc; end; -function TJSFileDescriptor.GetResourceSource(const ResourceName: string - ): string; +function TJSFileDescriptor.GetResourceSource(const ResourceName: string): string; begin Result:=''; end; @@ -859,8 +857,7 @@ begin Result:=SCSSFileDesc; end; -function TCSSFileDescriptor.GetResourceSource(const ResourceName: string - ): string; +function TCSSFileDescriptor.GetResourceSource(const ResourceName: string): string; begin Result:=''; end; diff --git a/components/fpweb/weblazideintf.pp b/components/fpweb/weblazideintf.pp index 375cc6bf17..357377395b 100644 --- a/components/fpweb/weblazideintf.pp +++ b/components/fpweb/weblazideintf.pp @@ -205,44 +205,32 @@ procedure Register; resourcestring rsCGIApplicati = 'CGI Application'; - rsCGIApplicati2 = 'CGI Application%sA CGI (Common Gateway Interface) ' - +'program in Free Pascal using webmodules. The program source is ' - +'automatically maintained by Lazarus.'; + rsCGIApplicati2 = 'A CGI (Common Gateway Interface) program in Free Pascal using webmodules.'; rsCustomCGIApp = 'Custom CGI Application'; - rsCustomCGIApp2 = 'Custom CGI Application%sA CGI (Common Gateway Interface) ' - +'program in Free Pascal. The program source is automatically maintained ' - +'by Lazarus.'; + rsCustomCGIApp2 = 'A CGI (Common Gateway Interface) program in Free Pascal.'; rsWebModule = 'Web Module'; - rsWEBModuleADa = 'WEB Module%sA datamodule for WEB (HTTP) applications.'; + rsWEBModuleADa = 'A datamodule for WEB (HTTP) applications.'; rsHTMLWebModul = 'HTML Web Module'; - rsHTMLWEBModul2 = 'HTML WEB Module%sA Web datamodule for producing strict ' - +'HTML.'; + rsHTMLWEBModul2 = 'A Web datamodule for producing strict HTML.'; rsApacheModule = 'Apache Module'; - rsApacheModule2 = 'Apache module%sAn Apache loadable module in Free Pascal ' - +'using webmodules. The main library file is automatically maintained by ' - +'Lazarus.'; + rsApacheModule2 = 'An Apache loadable module in Free Pascal using webmodules. ' + +'The main library file is automatically maintained by Lazarus.'; rsCustomFastCG = 'Custom FastCGI Application'; - rsCustomFastCG2 = 'Custom FastCGI Application%sA FastCGI (Common Gateway ' - +'Interface) program in Free Pascal. The program source is automatically ' - +'maintained by Lazarus.'; + rsCustomFastCG2 = 'A FastCGI (Common Gateway Interface) program in Free Pascal.'; rsFastCGIAppli = 'FastCGI Application'; - rsFastCGIAppli2 = 'FastCGI Application%sA FastCGI (Common Gateway ' - +'Interface) program in Free Pascal using webmodules. The program source ' - +'is automatically maintained by Lazarus.'; + rsFastCGIAppli2 = 'FastCGI Application%sA FastCGI (Common Gateway Interface) ' + +'program in Free Pascal using webmodules.'; rsWebDataProvi = 'Web DataProvider Module'; - rsWEBDataProvi2 = 'WEB DataProvider Module%sA datamodule to handle data ' - +'requests for WEB (HTTP) applications using WebDataProvider components.'; + rsWEBDataProvi2 = 'A datamodule to handle data requests for WEB (HTTP) ' + +'applications using WebDataProvider components.'; rsWebJSONRPCMo = 'Web JSON-RPC Module'; - rsWEBJSONRPCMo2 = 'WEB JSON-RPC Module%sA datamodule to dispatch JSON-RPC ' - +'requests in WEB (HTTP) applications using TJSONRPCHandler components.'; + rsWEBJSONRPCMo2 = 'A datamodule to dispatch JSON-RPC requests in WEB (HTTP) ' + +'applications using TJSONRPCHandler components.'; rsWebExtDirect = 'Web Ext.Direct Module'; - rsWEBExtDirect2 = 'WEB Ext.Direct Module%sA datamodule to dispatch Ext.' - +'Direct requests in WEB (HTTP) applications using TJSONRPCHandler ' - +'components.'; + rsWEBExtDirect2 = 'A datamodule to dispatch Ext.Direct requests in WEB (HTTP) ' + +'applications using TJSONRPCHandler components.'; rsHTTPAppli = 'HTTP server Application'; - rsHTTPAppli2 = 'HTTP server Application. Complete HTTP Server ' - +'program in Free Pascal using webmodules. The program source ' - +'is automatically maintained by Lazarus.'; + rsHTTPAppli2 = 'Complete HTTP Server program in Free Pascal using webmodules.'; implementation @@ -366,7 +354,7 @@ end; function TCGIApplicationDescriptor.GetLocalizedDescription: string; begin - Result:=Format(rsCGIApplicati2, [#13#13]); + Result:=rsCGIApplicati2; end; function TCGIApplicationDescriptor.InitProject(AProject: TLazProject): TModalResult; @@ -432,7 +420,7 @@ end; function TCustomCGIApplicationDescriptor.GetLocalizedDescription: string; begin - Result:=Format(rsCustomCGIApp2, [#13#13]); + Result:=rsCustomCGIApp2; end; function TCustomCGIApplicationDescriptor.InitProject(AProject: TLazProject): TModalResult; @@ -531,7 +519,7 @@ end; function TFileDescWebDataModule.GetLocalizedDescription: string; begin - Result:=Format(rsWEBModuleADa, [#13]); + Result:=rsWEBModuleADa; end; function TFileDescWebDataModule.GetImplementationSource(const Filename, SourceName, ResourceName: string): string; @@ -568,7 +556,7 @@ end; function TFileDescHTMLModule.GetLocalizedDescription: string; begin - Result:=Format(rsHTMLWEBModul2, [#13]); + Result:=rsHTMLWEBModul2; end; function TFileDescHTMLModule.GetImplementationSource(const Filename, SourceName, ResourceName: string): string; @@ -595,7 +583,7 @@ end; function TApacheApplicationDescriptor.GetLocalizedDescription: string; begin - Result:=Format(rsApacheModule2, [#13#13]); + Result:=rsApacheModule2; end; function TApacheApplicationDescriptor.InitProject(AProject: TLazProject): TModalResult; @@ -686,11 +674,10 @@ end; function TCustomFCGIApplicationDescriptor.GetLocalizedDescription: string; begin - Result:=Format(rsCustomFastCG2, [#13#13]); + Result:=rsCustomFastCG2; end; -function TCustomFCGIApplicationDescriptor.InitProject(AProject: TLazProject - ): TModalResult; +function TCustomFCGIApplicationDescriptor.InitProject(AProject: TLazProject): TModalResult; var le: string; NewSource: String; @@ -769,11 +756,10 @@ end; function TFCGIApplicationDescriptor.GetLocalizedDescription: string; begin - Result:=Format(rsFastCGIAppli2, [#13#13]); + Result:=rsFastCGIAppli2; end; -function TFCGIApplicationDescriptor.InitProject(AProject: TLazProject - ): TModalResult; +function TFCGIApplicationDescriptor.InitProject(AProject: TLazProject): TModalResult; var le: string; NewSource: String; @@ -956,7 +942,7 @@ end; function TFileDescWebProviderDataModule.GetLocalizedDescription: string; begin - Result:=Format(rsWEBDataProvi2, [#13]); + Result:=rsWEBDataProvi2; end; function TFileDescWebProviderDataModule.GetImplementationSource(const Filename, @@ -993,7 +979,7 @@ end; function TFileDescWebJSONRPCModule.GetLocalizedDescription: string; begin - Result:=Format(rsWEBJSONRPCMo2, [#13]); + Result:=rsWEBJSONRPCMo2; end; function TFileDescWebJSONRPCModule.GetImplementationSource(const Filename, @@ -1052,7 +1038,7 @@ end; function TFileDescExtDirectModule.GetLocalizedDescription: string; begin - Result:=Format(rsWEBExtDirect2, [#13]); + Result:=rsWEBExtDirect2; end; function TFileDescExtDirectModule.GetImplementationSource(const Filename, @@ -1190,8 +1176,7 @@ begin Result:=inherited GetLocalizedDescription; end; -function TJSFileDescriptor.GetResourceSource(const ResourceName: string - ): string; +function TJSFileDescriptor.GetResourceSource(const ResourceName: string): string; begin Result:=inherited GetResourceSource(ResourceName); end; diff --git a/components/instantfpc/instantfpcregisterlaz.pas b/components/instantfpc/instantfpcregisterlaz.pas index cb72edd994..817c44082d 100644 --- a/components/instantfpc/instantfpcregisterlaz.pas +++ b/components/instantfpc/instantfpcregisterlaz.pas @@ -33,9 +33,9 @@ type resourcestring rsInstantFPCPr = 'InstantFPC program'; - rsSingleFileFr = '%s%sSingle file Free Pascal program executed by InstantFPC'; + rsSingleFileFr = 'Single file Free Pascal program executed by InstantFPC'; rsInstantFPCSc = 'InstantFPC script'; - rsSingleFilePr = '%s%sSingle file program using InstantFPC to compile and execute'; + rsSingleFilePr = 'Single file program using InstantFPC to compile and execute'; const FileDescNameInstantFPC : string = rsInstantFPCPr; @@ -68,7 +68,7 @@ end; function TProjectInstantFPCDescriptor.GetLocalizedDescription: string; begin - Result:=Format(rsSingleFileFr, [GetLocalizedName, LineEnding]); + Result:=rsSingleFileFr; end; function TProjectInstantFPCDescriptor.InitProject(AProject: TLazProject): TModalResult; @@ -136,7 +136,7 @@ end; function TFileDescInstantFPCScript.GetLocalizedDescription: string; begin - Result:=Format(rsSingleFilePr, [GetLocalizedName, LineEnding]); + Result:=rsSingleFilePr; end; function TFileDescInstantFPCScript.CreateSource(const Filename, SourceName, diff --git a/ide/newdialog.pas b/ide/newdialog.pas index 9bd77b3357..02e8ad4c53 100644 --- a/ide/newdialog.pas +++ b/ide/newdialog.pas @@ -405,7 +405,8 @@ begin end else begin aNewItemTemplate := TNewIDEItemTemplate(ANode.Data); - Desc := aNewItemTemplate.Description; + Desc := aNewItemTemplate.LocalizedName + LineEnding+LineEnding + +aNewItemTemplate.Description; if aNewItemTemplate is TNewItemProjectFile then begin if TNewItemProjectFile(aNewItemTemplate).Descriptor is TFileDescInheritedComponent diff --git a/ide/newprojectdlg.pp b/ide/newprojectdlg.pp index bd4301ed55..a79edf7e68 100644 --- a/ide/newprojectdlg.pp +++ b/ide/newprojectdlg.pp @@ -31,9 +31,15 @@ unit NewProjectDlg; interface uses - Classes, SysUtils, Forms, Graphics, Controls, Project, Buttons, ButtonPanel, - StdCtrls, ProjectIntf, ExtCtrls, ComCtrls, LazarusIDEStrConsts, - IDEHelpIntf, IDEImagesIntf; + Classes, SysUtils, + // LCL + Forms, Graphics, Controls, Buttons, ButtonPanel, StdCtrls, ExtCtrls, ComCtrls, + // BuildIntf + ProjectIntf, + // IdeIntf + IDEHelpIntf, IDEImagesIntf, + // IDE + LazarusIDEStrConsts, Project; type @@ -97,7 +103,8 @@ begin if Assigned(ANode) and Assigned(ANode.Data) then begin FProjectDescriptor:=TProjectDescriptor(ANode.Data); - HelpLabel.Caption:=FProjectDescriptor.GetLocalizedDescription; + HelpLabel.Caption:=FProjectDescriptor.GetLocalizedName + LineEnding+LineEnding + +FProjectDescriptor.GetLocalizedDescription; ButtonPanel.OKButton.Enabled:=true; end else diff --git a/ide/projectdescriptors.pas b/ide/projectdescriptors.pas index 7fa8245523..53e9e3ff87 100644 --- a/ide/projectdescriptors.pas +++ b/ide/projectdescriptors.pas @@ -116,7 +116,7 @@ end; function TProjectApplicationDescriptor.GetLocalizedDescription: string; begin - Result := GetLocalizedName + LineEnding+LineEnding + lisApplicationProgramDescriptor; + Result:=lisApplicationProgramDescriptor; end; function TProjectApplicationDescriptor.InitProject(AProject: TLazProject): TModalResult; @@ -192,7 +192,7 @@ end; function TProjectSimpleProgramDescriptor.GetLocalizedDescription: string; begin - Result := GetLocalizedName + LineEnding+LineEnding + lisSimpleProgramProgramDescriptor; + Result:=lisSimpleProgramProgramDescriptor; end; function TProjectSimpleProgramDescriptor.InitProject(AProject: TLazProject): TModalResult; @@ -242,7 +242,7 @@ end; function TProjectProgramDescriptor.GetLocalizedDescription: string; begin - Result := GetLocalizedName + LineEnding+LineEnding + lisProgramProgramDescriptor; + Result:=lisProgramProgramDescriptor; end; function TProjectProgramDescriptor.InitProject(AProject: TLazProject): TModalResult; @@ -306,11 +306,10 @@ end; function TProjectManualProgramDescriptor.GetLocalizedDescription: string; begin - Result := GetLocalizedName + LineEnding+LineEnding + lisCustomProgramProgramDescriptor; + Result:=lisCustomProgramProgramDescriptor; end; -function TProjectManualProgramDescriptor.InitProject(AProject: TLazProject - ): TModalResult; +function TProjectManualProgramDescriptor.InitProject(AProject: TLazProject): TModalResult; var NewSource: String; MainFile: TLazProjectFile; @@ -375,7 +374,7 @@ end; function TProjectConsoleApplicationDescriptor.GetLocalizedDescription: string; begin - Result := GetLocalizedName + LineEnding+LineEnding + lisConsoleApplicationProgramDescriptor; + Result:=lisConsoleApplicationProgramDescriptor; end; function TProjectConsoleApplicationDescriptor.InitProject(AProject: TLazProject @@ -545,7 +544,7 @@ end; function TProjectLibraryDescriptor.GetLocalizedDescription: string; begin - Result := GetLocalizedName + LineEnding+LineEnding + lisLibraryProgramDescriptor; + Result:=lisLibraryProgramDescriptor; end; function TProjectLibraryDescriptor.InitProject(AProject: TLazProject): TModalResult;