mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-25 03:49:51 +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
|
||||
LEOL : Integer;
|
||||
|
||||
modir : string;
|
||||
|
||||
resourcestring
|
||||
// Output strings
|
||||
SDocPackageTitle = 'Reference for package ''%s''';
|
||||
@ -132,6 +133,8 @@ resourcestring
|
||||
SUsageOption150 = '--package=name Set the package name for which to create output';
|
||||
SUsageOption160 = '--show-private Show private methods.';
|
||||
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:';
|
||||
SUsageBackendHelp = 'Specify an output format, combined with --help to get more help for this backend.';
|
||||
SUsageFormatSpecific = 'Output format "%s" supports the following options:';
|
||||
@ -1231,13 +1234,26 @@ end;
|
||||
{ Global helpers }
|
||||
|
||||
procedure TranslateDocStrings(const Lang: String);
|
||||
|
||||
Const
|
||||
{$ifdef unix}
|
||||
DefDir = '/usr/local/share/locale';
|
||||
{$else}
|
||||
DefDir = 'intl'
|
||||
{$endif}
|
||||
|
||||
var
|
||||
mo: TMOFile;
|
||||
dir : string;
|
||||
begin
|
||||
dir:=modir;
|
||||
If Dir='' then
|
||||
Dir:=DefDir;
|
||||
Dir:=IncludeTrailingPathDelimiter(Dir);
|
||||
{$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}
|
||||
mo := TMOFile.Create(Format('intl/dglobals.%s.mo', [Lang]));
|
||||
mo := TMOFile.Create(Format(Dir+'dglobals.%s.mo', [Lang]));
|
||||
{$ENDIF}
|
||||
try
|
||||
TranslateResourceStrings(mo);
|
||||
|
@ -84,6 +84,7 @@ type
|
||||
private
|
||||
FOnTest: TNotifyEvent;
|
||||
FPackage: TPasPackage;
|
||||
FCharSet : String;
|
||||
function GetPageCount: Integer;
|
||||
procedure SetOnTest(const AValue: TNotifyEvent);
|
||||
protected
|
||||
@ -244,6 +245,7 @@ type
|
||||
Property IncludeDateInFooter : Boolean Read FIDF Write FIDF;
|
||||
Property DateFormat : String Read FDateFormat Write FDateFormat;
|
||||
property OnTest: TNotifyEvent read FOnTest write SetOnTest;
|
||||
Property CharSet : String Read FCharSet Write FCharSet;
|
||||
Function InterPretOption(Const Cmd,Arg : String) : boolean; override;
|
||||
Procedure WriteDoc; override;
|
||||
class procedure Usage(List: TStrings); override;
|
||||
@ -564,6 +566,7 @@ var
|
||||
i: Integer;
|
||||
begin
|
||||
inherited ;
|
||||
Charset:='iso-8859-1';
|
||||
CreateAllocator;
|
||||
FPackage := APackage;
|
||||
OutputNodeStack := TList.Create;
|
||||
@ -608,7 +611,8 @@ begin
|
||||
El := Doc.CreateElement('meta');
|
||||
HeadEl.AppendChild(El);
|
||||
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');
|
||||
HeadEl.AppendChild(TitleElement);
|
||||
El := Doc.CreateElement('link');
|
||||
@ -2988,6 +2992,8 @@ begin
|
||||
SearchPage := Arg
|
||||
else if Cmd = '--footer' then
|
||||
FooterFile := Arg
|
||||
else if Cmd = '--charset' then
|
||||
CharSet := Arg
|
||||
else if Cmd = '--footer-date' then
|
||||
begin
|
||||
FIDF:=True;
|
||||
|
@ -69,6 +69,7 @@ begin
|
||||
Writeln(SUsageOption150);
|
||||
Writeln(SUsageOption160);
|
||||
Writeln(SUsageOption170);
|
||||
Writeln(SUsageOption180);
|
||||
L:=TStringList.Create;
|
||||
Try
|
||||
If (Backend='') then
|
||||
@ -204,6 +205,8 @@ begin
|
||||
OSTarget := Arg
|
||||
else if Cmd = '--cputarget' then
|
||||
CPUTarget := Arg
|
||||
else if Cmd = '--mo-dir' then
|
||||
modir := Arg
|
||||
else
|
||||
begin
|
||||
BackendOptions.Add(Cmd);
|
||||
|
Loading…
Reference in New Issue
Block a user