mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-02 22:18:16 +02:00
IDE: ConvertRSTFiles: made single po file optional
git-svn-id: trunk@34322 -
This commit is contained in:
parent
bf64f7b1f8
commit
b22aa36ab3
@ -73,7 +73,9 @@ function GetLazarusLanguageLocalizedName(const ID: string): String;
|
||||
// collect all available translations
|
||||
procedure CollectTranslations(const LazarusDir: string);
|
||||
|
||||
function ConvertRSTFiles(RSTDirectory, PODirectory, POFilename: string): Boolean;
|
||||
function ConvertRSTFiles(RSTDirectory, PODirectory: string;
|
||||
POFilename: string = '' // set POFilename to gather all rst into one po file
|
||||
): Boolean;
|
||||
|
||||
var
|
||||
LazarusTranslations: TLazarusTranslations = nil;
|
||||
@ -170,8 +172,8 @@ begin
|
||||
FindCloseUTF8(FileInfo);
|
||||
end;
|
||||
|
||||
{.$define SinglePOFile}
|
||||
function ConvertRSTFiles(RSTDirectory, PODirectory, POFilename: string): Boolean;
|
||||
function ConvertRSTFiles(RSTDirectory, PODirectory: string;
|
||||
POFilename: string): Boolean;
|
||||
var
|
||||
FileInfo: TSearchRec;
|
||||
RSTFilename: String;
|
||||
@ -206,10 +208,8 @@ begin
|
||||
// TODO: lrt files...
|
||||
FileList := nil;
|
||||
PODirectory:=AppendPathDelim(PODirectory);
|
||||
{$ifdef SinglePOFile}
|
||||
OutputFilename:=PODirectory+POFilename;
|
||||
{$endif}
|
||||
|
||||
|
||||
if FindFirstUTF8(RSTDirectory+'*.rst',faAnyFile,FileInfo)=0
|
||||
then
|
||||
try
|
||||
@ -221,34 +221,32 @@ begin
|
||||
|
||||
RSTFilename:=RSTDirectory+FileInfo.Name;
|
||||
|
||||
{$ifndef SinglePOFile}
|
||||
OutputFilename:=PODirectory+ChangeFileExt(FileInfo.Name,'.po');
|
||||
FileList.Clear;
|
||||
{$endif}
|
||||
if POFilename='' then begin
|
||||
OutputFilename:=PODirectory+ChangeFileExt(FileInfo.Name,'.po');
|
||||
FileList.Clear;
|
||||
end;
|
||||
|
||||
//DebugLn(['ConvertPackageRSTFiles RSTFilename=',RSTFilename,' OutputFilename=',OutputFilename]);
|
||||
if (not FileExistsUTF8(OutputFilename))
|
||||
or (FileAgeCached(RSTFilename)>FileAgeCached(OutputFilename)) then
|
||||
begin
|
||||
FileList.Add(RSTFilename);
|
||||
{$ifndef SinglePOFile}
|
||||
UpdateList;
|
||||
if not result then
|
||||
exit;
|
||||
{$endif}
|
||||
if POFilename='' then begin
|
||||
UpdateList;
|
||||
if not Result then
|
||||
exit;
|
||||
end;
|
||||
end;
|
||||
until FindNextUTF8(FileInfo)<>0;
|
||||
|
||||
{$ifdef SinglePOFile}
|
||||
UpdateList;
|
||||
{$endif}
|
||||
|
||||
if POFilename<>'' then
|
||||
UpdateList;
|
||||
|
||||
finally
|
||||
if FileList<>nil then
|
||||
FileList.Free;
|
||||
FindCloseUTF8(FileInfo);
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
{-------------------------------------------------------------------------------
|
||||
|
@ -3941,7 +3941,7 @@ begin
|
||||
end;
|
||||
|
||||
PkgOutputDirectory:=AppendPathDelim(APackage.GetOutputDirectory);
|
||||
if not ConvertRSTFiles(PkgOutputDirectory,POOutputDirectory, APackage.Name+'.po') then begin
|
||||
if not ConvertRSTFiles(PkgOutputDirectory,POOutputDirectory) then begin
|
||||
DebugLn(['TLazPackageGraph.ConvertPackageRSTFiles FAILED: PkgOutputDirectory=',PkgOutputDirectory,' RSTOutputDirectory=',POOutputDirectory]);
|
||||
exit(mrCancel);
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user