PoChecker: fix broken construction of language filename, introduced by me in r46530 #d1a01f5804.

git-svn-id: trunk@46531 -
This commit is contained in:
bart 2014-10-11 22:18:52 +00:00
parent d1a01f5804
commit cb35b5185b
2 changed files with 15 additions and 18 deletions

View File

@ -71,7 +71,7 @@ type
procedure ShowError(const Msg: string);
function TrySelectFile(out Filename: String): Boolean;
procedure ScanDirectory(ADir: String);
function TryCreatepoFamilyList(MasterList: TStrings; const Lang: String): Boolean;
function TryCreatepoFamilyList(MasterList: TStrings; const LangID: TLangID): Boolean;
procedure RunSelectedTests;
procedure ClearStatusBar;
procedure UpdateGUI(HasSelection: Boolean);
@ -212,16 +212,13 @@ procedure TPoCheckerForm.RunBtnClick(Sender: TObject);
var
AMasterList: TStringList;
LangIdx: Integer;
ALang: String;
ALangID: TLangID;
begin
LangIdx := LangFilter.ItemIndex;
if (LangIdx > 0) then
ALang := LangFilter.Items[LangIdx]
else
ALang := langAll;
ALangID := LangFilterIndexToLangID(LangIdx);
AMasterList := GetSelectedMasterFiles;
try
if TryCreatePoFamilyList(AMasterList, ALang) then
if TryCreatePoFamilyList(AMasterList, ALangID) then
RunSelectedTests
else
begin
@ -466,7 +463,7 @@ begin
end;
function TPoCheckerForm.TryCreatepoFamilyList(MasterList: TStrings; const Lang: String): Boolean;
function TPoCheckerForm.TryCreatepoFamilyList(MasterList: TStrings; const LangID: TLangID): Boolean;
var
Fn, Msg: String;
i, Cnt: Integer;
@ -498,7 +495,7 @@ begin
end;
try
if Assigned(PoFamilyList) then PoFamilyList.Free;
PoFamilyList := TPoFamilyList.Create(MasterList, Lang, Msg);
PoFamilyList := TPoFamilyList.Create(MasterList, LangID, Msg);
if (Msg <> '') then
begin
//MessageDlg('PoChecker',Format(sFilesNotFoundAndRemoved,[Msg]), mtInformation, [mbOk], 0);

View File

@ -7,7 +7,7 @@ interface
Uses
Classes, SysUtils, LCLProc, FileUtil, StringHashList, ContNrs,
//{$IFDEF UNIX}{$IFNDEF DisableCWString}, cwstring{$ENDIF}{$ENDIF},
PoFamilies;
PoFamilies, PoCheckerConsts;
const
langAll = '*';
@ -19,7 +19,7 @@ type
TPoFamilyList = class
private
FLang: String;
FLangID: TLangID;
FList: TFPObjectList;
FOnTestEnd: TTestEndEvent;
FOnTestStart: TTestStartEvent;
@ -30,7 +30,7 @@ type
procedure DoTestStart(const ATestName, APoFileName: String);
procedure DoTestEnd(const ATestName: String; const ErrorCount: Integer);
public
constructor Create(AMasterList: TStrings; ALang: String; out Msg: String);
constructor Create(AMasterList: TStrings; ALangID: TLangID; out Msg: String);
destructor Destroy; override;
procedure Add(PoFamily: TPofamily);
function Count: Integer;
@ -62,7 +62,7 @@ begin
if Assigned(FOnTestEnd) then FOnTestEnd(ATestName, ErrorCount);
end;
constructor TPoFamilyList.Create(AMasterList: TStrings; ALang: String; out Msg: String);
constructor TPoFamilyList.Create(AMasterList: TStrings; ALangID: TLangID; out Msg: String);
var
i: Integer;
MasterName, ChildName: String;
@ -71,18 +71,18 @@ begin
FList := TFPObjectList.Create(True);
Msg := '';
FPoFamilyStats := TPoFamilyStats.Create;
FLang := ALang;
FLangID := ALangID;
for i := 0 to AMasterList.Count - 1 do
begin
MasterName := AMasterList[i];
ChildName := '';
if FileExistsUtf8(MasterName) then
begin
if (ALang <> langAll) then
ChildName := ChangeFileExt(MasterName, '.' + ALang + '.po');
if (ALangID <> lang_all) then
ChildName := ChangeFileExt(MasterName, '.' + LanguageAbbr[ALangID] + '.po');
//debugln('TPoFamilyList.Create: i = ',DbgS(i),' Adding TPoFamily.Create(''',ExtractFileName(MasterName),
// ''',',ExtractFileName(ChildName),''')');
if (ALang = langAll) or FileExistsUtf8(ChildName) then
if (ALangID = lang_all) or FileExistsUtf8(ChildName) then
begin
APoFamily := TPoFamily.Create(MasterName, ChildName);
Add(APoFamily);
@ -121,7 +121,7 @@ var
PoFamily: TPoFamily;
//ThisLog: TStringList;
begin
if (FLang = langAll) then
if (FLangID = lang_all) then
Include(TestOptions,ptoFindAllChildren)
else
Exclude(TestOptions,ptoFindAllChildren);