mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-29 20:59:24 +02:00
* Added support for a directory with .mo files, and support for HTML specification of charset
git-svn-id: trunk@11112 -
This commit is contained in:
parent
aaf1606cea
commit
0632e0d8df
@ -27,7 +27,8 @@ uses Classes, DOM, PasTree, PParser;
|
|||||||
|
|
||||||
Var
|
Var
|
||||||
LEOL : Integer;
|
LEOL : Integer;
|
||||||
|
modir : string;
|
||||||
|
|
||||||
resourcestring
|
resourcestring
|
||||||
// Output strings
|
// Output strings
|
||||||
SDocPackageTitle = 'Reference for package ''%s''';
|
SDocPackageTitle = 'Reference for package ''%s''';
|
||||||
@ -132,6 +133,8 @@ resourcestring
|
|||||||
SUsageOption150 = '--package=name Set the package name for which to create output';
|
SUsageOption150 = '--package=name Set the package name for which to create output';
|
||||||
SUsageOption160 = '--show-private Show private methods.';
|
SUsageOption160 = '--show-private Show private methods.';
|
||||||
SUsageOption170 = '--warn-no-node Warn if no documentation node was found.';
|
SUsageOption170 = '--warn-no-node Warn if no documentation node was found.';
|
||||||
|
SUsageOption180 = '--mo-dir=dir Set directory where language files reside to dir';
|
||||||
|
|
||||||
SUsageFormats = 'The following output formats are supported by this fpdoc:';
|
SUsageFormats = 'The following output formats are supported by this fpdoc:';
|
||||||
SUsageBackendHelp = 'Specify an output format, combined with --help to get more help for this backend.';
|
SUsageBackendHelp = 'Specify an output format, combined with --help to get more help for this backend.';
|
||||||
SUsageFormatSpecific = 'Output format "%s" supports the following options:';
|
SUsageFormatSpecific = 'Output format "%s" supports the following options:';
|
||||||
@ -1231,13 +1234,26 @@ end;
|
|||||||
{ Global helpers }
|
{ Global helpers }
|
||||||
|
|
||||||
procedure TranslateDocStrings(const Lang: String);
|
procedure TranslateDocStrings(const Lang: String);
|
||||||
|
|
||||||
|
Const
|
||||||
|
{$ifdef unix}
|
||||||
|
DefDir = '/usr/local/share/locale';
|
||||||
|
{$else}
|
||||||
|
DefDir = 'intl'
|
||||||
|
{$endif}
|
||||||
|
|
||||||
var
|
var
|
||||||
mo: TMOFile;
|
mo: TMOFile;
|
||||||
|
dir : string;
|
||||||
begin
|
begin
|
||||||
|
dir:=modir;
|
||||||
|
If Dir='' then
|
||||||
|
Dir:=DefDir;
|
||||||
|
Dir:=IncludeTrailingPathDelimiter(Dir);
|
||||||
{$IFDEF Unix}
|
{$IFDEF Unix}
|
||||||
mo := TMOFile.Create(Format('/usr/local/share/locale/%s/LC_MESSAGES/dglobals.mo', [Lang]));
|
mo := TMOFile.Create(Format(Dir+'%s/LC_MESSAGES/dglobals.mo', [Lang]));
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
mo := TMOFile.Create(Format('intl/dglobals.%s.mo', [Lang]));
|
mo := TMOFile.Create(Format(Dir+'dglobals.%s.mo', [Lang]));
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
try
|
try
|
||||||
TranslateResourceStrings(mo);
|
TranslateResourceStrings(mo);
|
||||||
|
@ -84,6 +84,7 @@ type
|
|||||||
private
|
private
|
||||||
FOnTest: TNotifyEvent;
|
FOnTest: TNotifyEvent;
|
||||||
FPackage: TPasPackage;
|
FPackage: TPasPackage;
|
||||||
|
FCharSet : String;
|
||||||
function GetPageCount: Integer;
|
function GetPageCount: Integer;
|
||||||
procedure SetOnTest(const AValue: TNotifyEvent);
|
procedure SetOnTest(const AValue: TNotifyEvent);
|
||||||
protected
|
protected
|
||||||
@ -244,6 +245,7 @@ type
|
|||||||
Property IncludeDateInFooter : Boolean Read FIDF Write FIDF;
|
Property IncludeDateInFooter : Boolean Read FIDF Write FIDF;
|
||||||
Property DateFormat : String Read FDateFormat Write FDateFormat;
|
Property DateFormat : String Read FDateFormat Write FDateFormat;
|
||||||
property OnTest: TNotifyEvent read FOnTest write SetOnTest;
|
property OnTest: TNotifyEvent read FOnTest write SetOnTest;
|
||||||
|
Property CharSet : String Read FCharSet Write FCharSet;
|
||||||
Function InterPretOption(Const Cmd,Arg : String) : boolean; override;
|
Function InterPretOption(Const Cmd,Arg : String) : boolean; override;
|
||||||
Procedure WriteDoc; override;
|
Procedure WriteDoc; override;
|
||||||
class procedure Usage(List: TStrings); override;
|
class procedure Usage(List: TStrings); override;
|
||||||
@ -564,6 +566,7 @@ var
|
|||||||
i: Integer;
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
inherited ;
|
inherited ;
|
||||||
|
Charset:='iso-8859-1';
|
||||||
CreateAllocator;
|
CreateAllocator;
|
||||||
FPackage := APackage;
|
FPackage := APackage;
|
||||||
OutputNodeStack := TList.Create;
|
OutputNodeStack := TList.Create;
|
||||||
@ -608,7 +611,8 @@ begin
|
|||||||
El := Doc.CreateElement('meta');
|
El := Doc.CreateElement('meta');
|
||||||
HeadEl.AppendChild(El);
|
HeadEl.AppendChild(El);
|
||||||
El['http-equiv'] := 'Content-Type';
|
El['http-equiv'] := 'Content-Type';
|
||||||
El['content'] := 'text/html; charset=iso-8859-1';
|
|
||||||
|
El['content'] := Format('text/html; charset=%s',[charset]);
|
||||||
TitleElement := Doc.CreateElement('title');
|
TitleElement := Doc.CreateElement('title');
|
||||||
HeadEl.AppendChild(TitleElement);
|
HeadEl.AppendChild(TitleElement);
|
||||||
El := Doc.CreateElement('link');
|
El := Doc.CreateElement('link');
|
||||||
@ -2988,6 +2992,8 @@ begin
|
|||||||
SearchPage := Arg
|
SearchPage := Arg
|
||||||
else if Cmd = '--footer' then
|
else if Cmd = '--footer' then
|
||||||
FooterFile := Arg
|
FooterFile := Arg
|
||||||
|
else if Cmd = '--charset' then
|
||||||
|
CharSet := Arg
|
||||||
else if Cmd = '--footer-date' then
|
else if Cmd = '--footer-date' then
|
||||||
begin
|
begin
|
||||||
FIDF:=True;
|
FIDF:=True;
|
||||||
|
@ -69,6 +69,7 @@ begin
|
|||||||
Writeln(SUsageOption150);
|
Writeln(SUsageOption150);
|
||||||
Writeln(SUsageOption160);
|
Writeln(SUsageOption160);
|
||||||
Writeln(SUsageOption170);
|
Writeln(SUsageOption170);
|
||||||
|
Writeln(SUsageOption180);
|
||||||
L:=TStringList.Create;
|
L:=TStringList.Create;
|
||||||
Try
|
Try
|
||||||
If (Backend='') then
|
If (Backend='') then
|
||||||
@ -204,6 +205,8 @@ begin
|
|||||||
OSTarget := Arg
|
OSTarget := Arg
|
||||||
else if Cmd = '--cputarget' then
|
else if Cmd = '--cputarget' then
|
||||||
CPUTarget := Arg
|
CPUTarget := Arg
|
||||||
|
else if Cmd = '--mo-dir' then
|
||||||
|
modir := Arg
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
BackendOptions.Add(Cmd);
|
BackendOptions.Add(Cmd);
|
||||||
|
Loading…
Reference in New Issue
Block a user