mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-02 10:20:29 +02:00
IDE: display help (lazarus --help) with language specified in command line, and if it is not specified take it from IDE settings. Based on patch by Ludo Brands, bug #20099.
git-svn-id: trunk@32199 -
This commit is contained in:
parent
1c525dd53a
commit
c14f1d3466
@ -61,6 +61,7 @@ function GetCommandLineParameters(aCmdLineParams : TStrings;
|
|||||||
|
|
||||||
function IsHelpRequested (index : Integer = 1) : Boolean;
|
function IsHelpRequested (index : Integer = 1) : Boolean;
|
||||||
function IsVersionRequested : boolean;
|
function IsVersionRequested : boolean;
|
||||||
|
function GetLanguageSpecified : string;
|
||||||
function ParamIsOption(ParamIndex : integer; const Option : string) : boolean;
|
function ParamIsOption(ParamIndex : integer; const Option : string) : boolean;
|
||||||
function ParamIsOptionPlusValue(ParamIndex : integer;
|
function ParamIsOptionPlusValue(ParamIndex : integer;
|
||||||
const Option : string; out AValue : string) : boolean;
|
const Option : string; out AValue : string) : boolean;
|
||||||
@ -160,6 +161,26 @@ begin
|
|||||||
(SysUtils.CompareText (ParamStrUTF8(1), '-v') = 0));
|
(SysUtils.CompareText (ParamStrUTF8(1), '-v') = 0));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function GetLanguageSpecified : string;
|
||||||
|
var
|
||||||
|
i: integer;
|
||||||
|
AValue: string;
|
||||||
|
begin
|
||||||
|
// return language specified in command line (empty string if no language specified)
|
||||||
|
Result := '';
|
||||||
|
AValue := '';
|
||||||
|
i := 1;
|
||||||
|
while i <= ParamCount do
|
||||||
|
begin
|
||||||
|
if ParamIsOptionPlusValue(i, LanguageOpt, AValue) = true then
|
||||||
|
begin
|
||||||
|
Result := AValue;
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
inc(i);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
function ParamIsOption(ParamIndex : integer; const Option : string) : boolean;
|
function ParamIsOption(ParamIndex : integer; const Option : string) : boolean;
|
||||||
begin
|
begin
|
||||||
Result:=SysUtils.CompareText(ParamStrUTF8(ParamIndex),Option) = 0;
|
Result:=SysUtils.CompareText(ParamStrUTF8(ParamIndex),Option) = 0;
|
||||||
|
14
ide/main.pp
14
ide/main.pp
@ -1141,6 +1141,7 @@ const
|
|||||||
space = ' ';
|
space = ' ';
|
||||||
var
|
var
|
||||||
AHelp: TStringList;
|
AHelp: TStringList;
|
||||||
|
HelpLang: string;
|
||||||
|
|
||||||
procedure AddHelp(Args: array of const);
|
procedure AddHelp(Args: array of const);
|
||||||
var
|
var
|
||||||
@ -1190,7 +1191,17 @@ begin
|
|||||||
EnableRemoteControl:=false;
|
EnableRemoteControl:=false;
|
||||||
if IsHelpRequested then
|
if IsHelpRequested then
|
||||||
begin
|
begin
|
||||||
TranslateResourceStrings(ProgramDirectory(true),'');
|
EnvironmentOptions := nil;
|
||||||
|
HelpLang := GetLanguageSpecified;
|
||||||
|
if HelpLang <> '' then
|
||||||
|
TranslateResourceStrings(ProgramDirectory(true), HelpLang)
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
EnvironmentOptions := TEnvironmentOptions.Create;
|
||||||
|
EnvironmentOptions.CreateConfig;
|
||||||
|
EnvironmentOptions.Load(true);
|
||||||
|
TranslateResourceStrings(ProgramDirectory(true), EnvironmentOptions.LanguageID);
|
||||||
|
end;
|
||||||
|
|
||||||
AHelp := TStringList.Create;
|
AHelp := TStringList.Create;
|
||||||
AddHelp([lislazarusOptionsProjectFilename]);
|
AddHelp([lislazarusOptionsProjectFilename]);
|
||||||
@ -1237,6 +1248,7 @@ begin
|
|||||||
|
|
||||||
WriteHelp(AHelp.Text);
|
WriteHelp(AHelp.Text);
|
||||||
AHelp.Free;
|
AHelp.Free;
|
||||||
|
FreeThenNil(EnvironmentOptions);
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
if IsVersionRequested then
|
if IsVersionRequested then
|
||||||
|
Loading…
Reference in New Issue
Block a user