mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-16 20:09:10 +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 IsVersionRequested : boolean;
|
||||
function GetLanguageSpecified : string;
|
||||
function ParamIsOption(ParamIndex : integer; const Option : string) : boolean;
|
||||
function ParamIsOptionPlusValue(ParamIndex : integer;
|
||||
const Option : string; out AValue : string) : boolean;
|
||||
@ -160,6 +161,26 @@ begin
|
||||
(SysUtils.CompareText (ParamStrUTF8(1), '-v') = 0));
|
||||
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;
|
||||
begin
|
||||
Result:=SysUtils.CompareText(ParamStrUTF8(ParamIndex),Option) = 0;
|
||||
|
14
ide/main.pp
14
ide/main.pp
@ -1141,6 +1141,7 @@ const
|
||||
space = ' ';
|
||||
var
|
||||
AHelp: TStringList;
|
||||
HelpLang: string;
|
||||
|
||||
procedure AddHelp(Args: array of const);
|
||||
var
|
||||
@ -1190,7 +1191,17 @@ begin
|
||||
EnableRemoteControl:=false;
|
||||
if IsHelpRequested then
|
||||
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;
|
||||
AddHelp([lislazarusOptionsProjectFilename]);
|
||||
@ -1237,6 +1248,7 @@ begin
|
||||
|
||||
WriteHelp(AHelp.Text);
|
||||
AHelp.Free;
|
||||
FreeThenNil(EnvironmentOptions);
|
||||
exit;
|
||||
end;
|
||||
if IsVersionRequested then
|
||||
|
Loading…
Reference in New Issue
Block a user