Bug fix. Translate category names in the tree, reported by Péter Gábor(#31038)

git-svn-id: trunk@53554 -
This commit is contained in:
balazs 2016-12-03 20:24:26 +00:00
parent 41db170ef6
commit d8b8e86cdf
10 changed files with 1008 additions and 921 deletions

2
.gitattributes vendored
View File

@ -3291,7 +3291,7 @@ components/onlinepackagemanager/languages/opkman_VirtualTrees.hu.po svneol=nativ
components/onlinepackagemanager/languages/opkman_VirtualTrees.po svneol=native#text/plain
components/onlinepackagemanager/languages/opkman_const.de.po svneol=native#text/plain
components/onlinepackagemanager/languages/opkman_const.es.po svneol=native#text/plain
components/onlinepackagemanager/languages/opkman_const.fi.po -text svneol=native#text/plain
components/onlinepackagemanager/languages/opkman_const.fi.po svneol=native#text/plain
components/onlinepackagemanager/languages/opkman_const.hu.po svneol=native#text/plain
components/onlinepackagemanager/languages/opkman_const.po svneol=native#text/plain
components/onlinepackagemanager/languages/opkman_httpclient.fi.po -text svneol=native#text/plain

View File

@ -112,6 +112,7 @@ type
function LoadPackageData(const APath: String; AData: PData): Boolean;
procedure ShowHideControls(const AType: Integer);
procedure SaveExtraInfo(const ANode: PVirtualNode);
function TranslateCategories(const AStr: String): String;
public
procedure InitializeFrame;
procedure FinalizeFrame;
@ -727,6 +728,45 @@ begin
pnBrowse.Enabled := True;
end;
function TCreateRepositoryPackagefr.TranslateCategories(const AStr: String): String;
var
SL: TStringList;
I, J: Integer;
Str: String;
begin
if Categories[0] = CategoriesEng[0] then
begin
Result := AStr;
Exit;
end;
Result := '';
SL := TStringList.Create;
try
SL.Delimiter := ',';
SL.StrictDelimiter := True;
SL.DelimitedText := AStr;
for I := 0 to SL.Count - 1 do
begin
Str := Trim(SL.Strings[I]);
for J := 0 to MaxCategories - 1 do
begin
if Str = Categories[J] then
begin
if Result = '' then
Result := CategoriesEng[J]
else
Result := Result + ', ' + CategoriesEng[J];
Break;
end;
end;
end;
finally
SL.Free;
end;
if Result = '' then
Result := AStr;
end;
procedure TCreateRepositoryPackagefr.DoOnZipCompleted(Sender: TObject);
var
SerializablePackages: TSerializablePackages;
@ -748,7 +788,7 @@ begin
begin
RootData := FVSTPackages.GetNodeData(RootNode);
Package := SerializablePackages.AddPackage(RootData^.FName);
Package.Category := RootData^.FCategory;
Package.Category := TranslateCategories(RootData^.FCategory);
Package.RepositoryFileName := ExtractFileName(FPackageFile);
Package.RepositoryFileSize := FileUtil.FileSize(FPackageFile);
Package.RepositoryFileHash := MD5Print(MD5File(FPackageFile));

View File

@ -495,7 +495,7 @@ msgid "Shapes"
msgstr "Formen"
#: opkman_const.rsmainfrm_vsttext_packagecategory23
msgid "Sizers, Scrollers"
msgid "Sizers and Scrollers"
msgstr ""
#: opkman_const.rsmainfrm_vsttext_packagecategory24
@ -519,7 +519,7 @@ msgid "Dialogs"
msgstr "Dialoge"
#: opkman_const.rsmainfrm_vsttext_packagecategory5
msgid "Edit, Memos"
msgid "Edit and Memos"
msgstr ""
#: opkman_const.rsmainfrm_vsttext_packagecategory6

View File

@ -495,8 +495,8 @@ msgid "Shapes"
msgstr "Figuras"
#: opkman_const.rsmainfrm_vsttext_packagecategory23
msgid "Sizers, Scrollers"
msgstr "Redimensionadores, Desplazamientos"
msgid "Sizers and Scrollers"
msgstr "Redimensionadores y Desplazamientos"
#: opkman_const.rsmainfrm_vsttext_packagecategory24
msgid "System"
@ -519,8 +519,8 @@ msgid "Dialogs"
msgstr "Dialogos"
#: opkman_const.rsmainfrm_vsttext_packagecategory5
msgid "Edit, Memos"
msgstr "Editores, Memos"
msgid "Edit and Memos"
msgstr "Editores y Memos"
#: opkman_const.rsmainfrm_vsttext_packagecategory6
msgid "Files and Drives"

File diff suppressed because it is too large Load Diff

View File

@ -439,7 +439,7 @@ msgstr "Titkosítás"
#: opkman_const.rsmainfrm_vsttext_packagecategory10
msgid "Indicators and Gauges"
msgstr "Kijelzők, mérők"
msgstr "Kijelzők és mérők"
#: opkman_const.rsmainfrm_vsttext_packagecategory11
msgid "Labels"
@ -495,8 +495,8 @@ msgid "Shapes"
msgstr "Alakzatok"
#: opkman_const.rsmainfrm_vsttext_packagecategory23
msgid "Sizers, Scrollers"
msgstr "Méretezők, görgetők"
msgid "Sizers and Scrollers"
msgstr "Méretezők és görgetők"
#: opkman_const.rsmainfrm_vsttext_packagecategory24
msgid "System"
@ -519,8 +519,8 @@ msgid "Dialogs"
msgstr "Párbeszédek"
#: opkman_const.rsmainfrm_vsttext_packagecategory5
msgid "Edit, Memos"
msgstr "Szerkesztés, jegyzetelés"
msgid "Edit and Memos"
msgstr "Szerkesztés és jegyzetelés"
#: opkman_const.rsmainfrm_vsttext_packagecategory6
msgid "Files and Drives"

View File

@ -483,7 +483,7 @@ msgid "Shapes"
msgstr ""
#: opkman_const.rsmainfrm_vsttext_packagecategory23
msgid "Sizers, Scrollers"
msgid "Sizers and Scrollers"
msgstr ""
#: opkman_const.rsmainfrm_vsttext_packagecategory24
@ -507,7 +507,7 @@ msgid "Dialogs"
msgstr ""
#: opkman_const.rsmainfrm_vsttext_packagecategory5
msgid "Edit, Memos"
msgid "Edit and Memos"
msgstr ""
#: opkman_const.rsmainfrm_vsttext_packagecategory6

View File

@ -80,7 +80,7 @@ const
'DataControls',
'Date and Time',
'Dialogs',
'Edit, Memos',
'Edit and Memos',
'Files and Drives',
'GUIContainers',
'Graphics',
@ -98,7 +98,7 @@ const
'Science',
'Security',
'Shapes',
'Sizers, Scrollers',
'Sizers and Scrollers',
'System',
'Tabbed Components',
'Other');

View File

@ -91,7 +91,7 @@ resourcestring
rsMainFrm_VSTText_PackageCategory2 = 'DataControls';
rsMainFrm_VSTText_PackageCategory3 = 'Date and Time';
rsMainFrm_VSTText_PackageCategory4 = 'Dialogs';
rsMainFrm_VSTText_PackageCategory5 = 'Edit, Memos';
rsMainFrm_VSTText_PackageCategory5 = 'Edit and Memos';
rsMainFrm_VSTText_PackageCategory6 = 'Files and Drives';
rsMainFrm_VSTText_PackageCategory7 = 'GUIContainers';
rsMainFrm_VSTText_PackageCategory8 = 'Graphics';
@ -109,7 +109,7 @@ resourcestring
rsMainFrm_VSTText_PackageCategory20 = 'Science';
rsMainFrm_VSTText_PackageCategory21 = 'Security';
rsMainFrm_VSTText_PackageCategory22 = 'Shapes';
rsMainFrm_VSTText_PackageCategory23 = 'Sizers, Scrollers';
rsMainFrm_VSTText_PackageCategory23 = 'Sizers and Scrollers';
rsMainFrm_VSTText_PackageCategory24 = 'System';
rsMainFrm_VSTText_PackageCategory25 = 'Tabbed Components';
rsMainFrm_VSTText_PackageCategory26 = 'Other';

View File

@ -46,6 +46,7 @@ type
PackageFileName: String;
Version: String;
InstalledVersion: String;
UpdateVersion: String;
Description: String;
Author: String;
LazCompatibility: String;
@ -119,6 +120,7 @@ type
procedure ButtonClick(Sender: TObject);
procedure ShowButtons;
procedure HideButtons;
function TranslateCategories(const AStr: String): String;
public
constructor Create(const AParent: TWinControl; const AImgList: TImageList;
APopupMenu: TPopupMenu);
@ -294,6 +296,7 @@ begin
ChildData := FVST.GetNodeData(ChildNode);
ChildData^.PackageFileName := PackageFile.Name;
ChildData^.InstalledVersion := PackageFile.InstalledFileVersion;
ChildData^.UpdateVersion := PackageFile.UpdateVersion;
ChildData^.Version := PackageFile.VersionAsString;
ChildData^.PackageState := PackageFile.PackageState;
ChildData^.DataType := 2;
@ -499,6 +502,45 @@ begin
end;
end;
function TVisualTree.TranslateCategories(const AStr: String): String;
var
SL: TStringList;
I, J: Integer;
Str: String;
begin
if Categories[0] = CategoriesEng[0] then
begin
Result := AStr;
Exit;
end;
Result := '';
SL := TStringList.Create;
try
SL.Delimiter := ',';
SL.StrictDelimiter := True;
SL.DelimitedText := AStr;
for I := 0 to SL.Count - 1 do
begin
Str := Trim(SL.Strings[I]);
for J := 0 to MaxCategories - 1 do
begin
if Str = CategoriesEng[J] then
begin
if Result = '' then
Result := Categories[J]
else
Result := Result + ', ' + Categories[J];
Break;
end;
end;
end;
finally
SL.Free;
end;
if Result = '' then
Result := AStr;
end;
procedure TVisualTree.VSTScroll(Sender: TBaseVirtualTree; DeltaX,
DeltaY: Integer);
begin
@ -1167,6 +1209,11 @@ begin
end
else if Column = 3 then
begin
if Data^.UpdateVersion = '' then
Data^.UpdateVersion := '-';
if Data^.DataType = 2 then
CellText := Data^.UpdateVersion
else
CellText := '';
end
else if Column = 4 then
@ -1200,7 +1247,7 @@ begin
9: CellText := GetDisplayString(Data^.License);
10: CellText := Data^.Dependencies;
11: CellText := '';
12: CellText := Data^.Category;
12: CellText := TranslateCategories(Data^.Category);
13: CellText := Data^.RepositoryFileName;
14: CellText := FormatSize(Data^.RepositoryFileSize);
15: CellText := Data^.RepositoryFileHash;