[Initranslator-svncheckins] SF.net SVN: initranslator: [165] translator/trunk
Brought to you by:
peter3
|
From: <pe...@us...> - 2006-12-05 00:27:35
|
Revision: 165
http://svn.sourceforge.net/initranslator/?rev=165&view=rev
Author: peter3
Date: 2006-12-04 16:27:32 -0800 (Mon, 04 Dec 2006)
Log Message:
-----------
- New tool plugin: ToolConsistency. Checks if items are consistently translated, i.e same translation for same original
Modified Paths:
--------------
translator/trunk/Changelog.txt
translator/trunk/setup/translator.fbp5
translator/trunk/translator.bpg
Added Paths:
-----------
translator/trunk/src/ToolConsistency/
translator/trunk/src/ToolConsistency/ToolConsistency.dpr
translator/trunk/src/ToolConsistency/ToolConsistency.res
translator/trunk/src/ToolConsistency/ToolConsistencyFrm.dfm
translator/trunk/src/ToolConsistency/ToolConsistencyFrm.pas
translator/trunk/src/ToolConsistency/ToolConsistencyImpl.pas
Modified: translator/trunk/Changelog.txt
===================================================================
--- translator/trunk/Changelog.txt 2006-12-05 00:22:49 UTC (rev 164)
+++ translator/trunk/Changelog.txt 2006-12-05 00:27:32 UTC (rev 165)
@@ -1,5 +1,9 @@
Ini Translator Changelog
========================
+2006-12-05:
+- Bug Fixed: translation comment wasn't cleared when user clicked "New translation"
+- New tool plugin: ToolConsistency. Checks if items are consistently translated, i.e same translation for same original
+
2006-12-04:
- Released on Sourceforge as 1.9.0.41
- Bug Fixed: translation is now sorted by index before saving (was sorted by section)
Modified: translator/trunk/setup/translator.fbp5
===================================================================
--- translator/trunk/setup/translator.fbp5 2006-12-05 00:22:49 UTC (rev 164)
+++ translator/trunk/setup/translator.fbp5 2006-12-05 00:27:32 UTC (rev 165)
@@ -351,7 +351,7 @@
<Property name="IsBreakPoint" type="WordBool">False</Property>
<Property MultiValue="0" name="LogToVariable" type="string"></Property>
<Property name="MaxRetryAttempts" type="Cardinal">0</Property>
- <Property name="NodeCollapsed" type="Boolean">True</Property>
+ <Property name="NodeCollapsed" type="Boolean">False</Property>
<Property name="PauseInterval" type="Cardinal">0</Property>
<Property name="RetryPauseInterval" type="Cardinal">1000</Property>
<Property name="SuppressStatusMessages" type="Boolean">False</Property>
@@ -2570,6 +2570,141 @@
<Property name="VarStringChecks" type="WordBool">True</Property>
</Object>
</Object>
+ <Object Class="TDelphiCompilerAction" XMLID="{31F16573-3169-4BFC-A056-61CE78F87F89}"><Property MultiValue="0" name="ActionComment" type="string"></Property>
+ <Property name="ActionTextColor" type="Cardinal">0</Property>
+ <Property MultiValue="0" name="ActionTypeID" type="string"></Property>
+ <Property name="AllowImplicitImport" type="Boolean">True</Property>
+ <Property name="AlwaysUseConditionalsFromDOF" type="WordBool">False</Property>
+ <Property name="AutoIncBuild" type="WordBool">False</Property>
+ <Property name="AutoUpdateFileVersion" type="Boolean">True</Property>
+ <Property name="BuildAll" type="WordBool">True</Property>
+ <Property name="BuildVersion" type="Integer">41</Property>
+ <Property name="CodePage" type="Integer">1252</Property>
+ <Property name="CompilerVersion" type="Integer">4</Property>
+ <Property name="DebugVersionNumbers" type="Boolean">False</Property>
+ <Property MultiValue="0" name="Description" type="string">ToolConsistency DLL</Property>
+ <Property name="Enabled" type="WordBool">True</Property>
+ <Property name="ExpandActionLogTitle" type="Boolean">True</Property>
+ <Property MultiValue="0" name="ExtraCommandline" type="WideString"></Property>
+ <Property name="HintsAsError" type="Boolean">False</Property>
+ <Property MultiValue="0" name="IconFile" type="WideString"></Property>
+ <Property name="IgnoreFailure" type="WordBool">False</Property>
+ <Property name="IncludeCompileDate" type="WordBool">True</Property>
+ <Property name="IncludeVerInfo" type="WordBool">True</Property>
+ <Property name="IsAction" type="Boolean">True</Property>
+ <Property name="IsBreakPoint" type="WordBool">False</Property>
+ <Property name="IsDebug" type="WordBool">False</Property>
+ <Property name="IsDLL" type="WordBool">True</Property>
+ <Property name="IsPreRelease" type="WordBool">False</Property>
+ <Property name="IsPrivate" type="WordBool">False</Property>
+ <Property name="IsSpecial" type="WordBool">False</Property>
+ <Property name="KeepCFG" type="Boolean">False</Property>
+ <Property name="LinkProductVersionToFileVersion" type="Boolean">False</Property>
+ <Property name="Locale" type="Integer">1033</Property>
+ <Property MultiValue="0" name="LogToVariable" type="string"></Property>
+ <Property name="MajorVersion" type="Integer">1</Property>
+ <Property name="MaxRetryAttempts" type="Cardinal">0</Property>
+ <Property name="MinorVersion" type="Integer">9</Property>
+ <Property name="NodeCollapsed" type="Boolean">False</Property>
+ <Property name="PauseInterval" type="Cardinal">0</Property>
+ <Property MultiValue="0" name="ProjectFile" type="WideString">%SRCPATH%ToolConsistency\ToolConsistency.dpr</Property>
+ <Property name="RegenerateResource" type="WordBool">True</Property>
+ <Property name="ReleaseVersion" type="Integer">0</Property>
+ <Property MultiValue="0" name="ResourceCompilerOptions" type="string"></Property>
+ <Property MultiValue="0" name="ResourceCompilerPath" type="string"></Property>
+ <Property name="ResourceCompilerType" type="TFBDelphiResourceCompiler">rcBorland</Property>
+ <Property name="RetryPauseInterval" type="Cardinal">1000</Property>
+ <Property MultiValue="0" name="StartingDir" type="WideString">%SRCPATH%ToolConsistency</Property>
+ <Property name="SuppressStatusMessages" type="Boolean">False</Property>
+ <Property name="UpdateDofFile" type="Boolean">False</Property>
+ <Property name="UpdatePackageSource" type="Boolean">False</Property>
+ <Property name="UseEurekaLogCompiler" type="Boolean">False</Property>
+ <Property name="UseProjectSettings" type="TFBUseProjectSettings">[]</Property>
+ <Property name="UsePropertySet" type="Boolean">False</Property>
+ <Property name="UseVersionFromDOF" type="Boolean">False</Property>
+ <Property MultiValue="1" name="VersionInfoKeys" type="WideString"><![CDATA[CompanyName=IniTranslator
+FileDescription=Tool Consistency Checker Plugin for IniTranslator
+FileVersion=1.9.0.41
+InternalName=ToolConsistency.dll
+LegalCopyright=Copyright (c) 2006 by Peter Thörnqvist; all rights reserved
+LegalTrademarks=
+OriginalFilename=ToolConsistency.dll
+ProductName=Tool Consistency Checker Plugin for IniTranslator
+ProductVersion=1.9
+Comments=Latest version available at http://initranslator.sourceforge.net
+]]>
+ </Property>
+ <Property MultiValue="0" name="VersionInfoPropertySetName" type="string"></Property>
+ <Property name="WarningsAsError" type="Boolean">False</Property>
+ <Property name="WorkAroundD5Bug" type="WordBool">False</Property>
+ <Object Class="TBuildScript" XMLID="{C7E4AED8-EB73-436A-A193-CFF3B2CAB371}"><Property MultiValue="0" name="BreakPointsStore" type="string"></Property>
+ <Property MultiValue="0" name="Name" type="string">BeforeAction</Property>
+ <Property MultiValue="1" name="Script" type="string"><![CDATA[Action.MajorVersion = VERSION_MAJOR;
+Action.MinorVersion = VERSION_MINOR;
+Action.ReleaseVersion = VERSION_RELEASE;
+Action.BuildVersion = VERSION_BUILD;
+Action.SetVersionInfoKey("ProductVersion",Action.GetVersionInfoKey("FileVersion"))
+]]>
+ </Property>
+ <Property MultiValue="0" name="ScriptLanguage" type="string">JavaScript</Property>
+ </Object>
+ <Object Class="TDelphiCompilerOptions" XMLID="{92D42BFB-BB3A-4C7F-BEB6-E5AFE8199F87}"><Property name="AlwaysUseConditionalsFromDOF" type="WordBool">False</Property>
+ <Property name="AlwaysUseDelphiLibraryPath" type="WordBool">True</Property>
+ <Property name="AlwaysUseDOFSearchPath" type="WordBool">False</Property>
+ <Property name="Assertions" type="WordBool">True</Property>
+ <Property name="AssignableConst" type="WordBool">False</Property>
+ <Property name="BoolEval" type="WordBool">False</Property>
+ <Property MultiValue="0" name="BPLOutputDir" type="WideString"></Property>
+ <Property name="CompilerWarnings" type="TStrings"><![CDATA[-w-UNSAFE_TYPE=0
+-w-UNSAFE_CODE=0
+-w-UNSAFE_CAST=0
+]]>
+ </Property>
+ <Property MultiValue="0" name="Conditionals" type="WideString"></Property>
+ <Property name="ConsoleApp" type="WordBool">False</Property>
+ <Property MultiValue="0" name="DCPOutputDir" type="WideString"></Property>
+ <Property name="DebugInfo" type="WordBool">True</Property>
+ <Property MultiValue="0" name="DefaultNamespace" type="string"></Property>
+ <Property name="DefinitionsOnly" type="WordBool">True</Property>
+ <Property MultiValue="0" name="ExeDescription" type="WideString"></Property>
+ <Property name="ExportAllSymbols" type="WordBool">False</Property>
+ <Property name="ExtendedSyntax" type="WordBool">True</Property>
+ <Property name="GenerateDocumentation" type="Boolean">False</Property>
+ <Property name="GenerateHPP" type="WordBool">False</Property>
+ <Property name="HugeStrings" type="WordBool">True</Property>
+ <Property name="ImageBase" type="Cardinal">4194304</Property>
+ <Property name="IncludeNamespaces" type="WordBool">False</Property>
+ <Property name="IncludeRemoteSymbols" type="WordBool">False</Property>
+ <Property name="IncludeTD32" type="WordBool">False</Property>
+ <Property name="IOChecking" type="WordBool">True</Property>
+ <Property MultiValue="0" name="LibraryPath" type="WideString">$(DELPHI)\Lib;$(DELPHI)\Bin;$(DELPHI)\Imports;$(DELPHI)\Projects\Bpl;$(DELPHI)\Rave5\Lib;F:\Program\Borland\Add\JEDI\JCL\source;F:\Program\Borland\Add\JEDI\dev\JVCL3\common;F:\Program\Borland\Add\JEDI\dev\JVCL3\run;F:\Program\Borland\Add\dunit\src;F:\Program\Borland\Add\Others;F:\Program\Borland\Add\Utils;f:\program\borland\projects\work\eq plan\eq plan 2.0\eqplan</Property>
+ <Property name="LinkerOutput" type="Integer">3</Property>
+ <Property name="LocalSymbols" type="WordBool">True</Property>
+ <Property name="Mapfile" type="Integer">3</Property>
+ <Property name="MaxStackSize" type="Cardinal">1048576</Property>
+ <Property name="MinStackSize" type="Cardinal">16384</Property>
+ <Property MultiValue="0" name="NamespacePrefixes" type="string"></Property>
+ <Property name="OpenStrings" type="WordBool">True</Property>
+ <Property name="Optimisation" type="WordBool">True</Property>
+ <Property MultiValue="0" name="OutputDir" type="WideString">..\..\bin\plugins</Property>
+ <Property name="OverflowChecking" type="WordBool">False</Property>
+ <Property MultiValue="0" name="Packages" type="WideString"></Property>
+ <Property name="RangeChecking" type="WordBool">False</Property>
+ <Property name="RecordFieldAlign" type="TFieldAlign">fa8</Property>
+ <Property name="ReferenceInfo" type="WordBool">True</Property>
+ <Property name="SafeDivide" type="WordBool">False</Property>
+ <Property MultiValue="0" name="SearchPath" type="WideString"></Property>
+ <Property name="ShowHints" type="WordBool">True</Property>
+ <Property name="ShowWarnings" type="WordBool">True</Property>
+ <Property name="StackFrames" type="WordBool">False</Property>
+ <Property name="TypedPointers" type="WordBool">False</Property>
+ <Property MultiValue="0" name="UnitAliases" type="WideString">WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;</Property>
+ <Property MultiValue="0" name="UnitOutputDir" type="WideString">..\..\dcu</Property>
+ <Property name="UseDebugDCU" type="WordBool">False</Property>
+ <Property name="UsePackages" type="WordBool">False</Property>
+ <Property name="VarStringChecks" type="WordBool">True</Property>
+ </Object>
+ </Object>
<Object Class="TDelphiCompilerAction" XMLID="{4AED673C-240D-4230-B1E7-5326F6436CF3}"><Property MultiValue="0" name="ActionComment" type="string"></Property>
<Property name="ActionTextColor" type="Cardinal">0</Property>
<Property MultiValue="0" name="ActionTypeID" type="string"></Property>
@@ -2853,7 +2988,7 @@
<Property name="IsBreakPoint" type="WordBool">False</Property>
<Property MultiValue="0" name="LogToVariable" type="string"></Property>
<Property name="MaxRetryAttempts" type="Cardinal">0</Property>
- <Property name="NodeCollapsed" type="Boolean">True</Property>
+ <Property name="NodeCollapsed" type="Boolean">False</Property>
<Property name="PauseInterval" type="Cardinal">0</Property>
<Property name="RetryPauseInterval" type="Cardinal">1000</Property>
<Property name="SuppressStatusMessages" type="Boolean">False</Property>
Added: translator/trunk/src/ToolConsistency/ToolConsistency.dpr
===================================================================
--- translator/trunk/src/ToolConsistency/ToolConsistency.dpr (rev 0)
+++ translator/trunk/src/ToolConsistency/ToolConsistency.dpr 2006-12-05 00:27:32 UTC (rev 165)
@@ -0,0 +1,38 @@
+{@abstract(Tool plugin to view inconsistent translations) }
+{
+ Copyright \xA9 2003-2006 by Peter Thornqvist; all rights reserved
+
+ Developer(s):
+ p3 - peter3 att users dott sourceforge dott net
+
+ Status:
+ The contents of this file are subject to the Mozilla Public License Version
+ 1.1 (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at http://www.mozilla.org/MPL/MPL-1.1.html
+
+ Software distributed under the License is distributed on an "AS IS" basis,
+ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+ the specific language governing rights and limitations under the License.
+}
+
+// $Id: $
+library ToolConsistency;
+
+uses
+ SysUtils,
+ Classes,
+ ToolConsistencyImpl in 'ToolConsistencyImpl.pas',
+ TransIntf in '..\TransIntf.pas',
+ ToolConsistencyFrm in 'ToolConsistencyFrm.pas' {frmToolConsistency};
+
+{$R *.res}
+function InstallPlugin(out ToolItems: IToolItems): HResult; stdcall;
+begin
+ ToolItems := TToolConsistencyPlugins.Create;
+ Result := S_OK;
+end;
+
+exports InstallPlugin name cRegisterTransToolItemsFuncName;
+
+begin
+end.
Added: translator/trunk/src/ToolConsistency/ToolConsistency.res
===================================================================
(Binary files differ)
Property changes on: translator/trunk/src/ToolConsistency/ToolConsistency.res
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: translator/trunk/src/ToolConsistency/ToolConsistencyFrm.dfm
===================================================================
--- translator/trunk/src/ToolConsistency/ToolConsistencyFrm.dfm (rev 0)
+++ translator/trunk/src/ToolConsistency/ToolConsistencyFrm.dfm 2006-12-05 00:27:32 UTC (rev 165)
@@ -0,0 +1,90 @@
+object frmToolConsistency: TfrmToolConsistency
+ Left = 436
+ Top = 264
+ Width = 402
+ Height = 237
+ ActiveControl = tvItems
+ Caption = 'Consistency Checker'
+ Color = clBtnFace
+ Font.Charset = DEFAULT_CHARSET
+ Font.Color = clWindowText
+ Font.Height = -11
+ Font.Name = 'MS Shell Dlg 2'
+ Font.Style = []
+ OldCreateOrder = False
+ Position = poMainFormCenter
+ DesignSize = (
+ 394
+ 203)
+ PixelsPerInch = 96
+ TextHeight = 13
+ object lblInfo: TTntLabel
+ Left = 380
+ Top = 8
+ Width = 3
+ Height = 13
+ Alignment = taRightJustify
+ Anchors = [akRight, akBottom]
+ Font.Charset = DEFAULT_CHARSET
+ Font.Color = clWindowText
+ Font.Height = -11
+ Font.Name = 'MS Shell Dlg 2'
+ Font.Style = [fsBold]
+ ParentFont = False
+ ShowAccelChar = False
+ end
+ object TntLabel1: TTntLabel
+ Left = 7
+ Top = 8
+ Width = 91
+ Height = 13
+ Caption = '&Inconsistent items:'
+ FocusControl = tvItems
+ end
+ object chkIgnoreAccelChar: TTntCheckBox
+ Left = 21
+ Top = 172
+ Width = 197
+ Height = 17
+ Anchors = [akLeft, akBottom]
+ Caption = 'Ignore accelerator &key'
+ Checked = True
+ State = cbChecked
+ TabOrder = 1
+ OnClick = chkIgnoreAccelCharClick
+ end
+ object tvItems: TTntTreeView
+ Left = 7
+ Top = 25
+ Width = 378
+ Height = 138
+ Anchors = [akLeft, akTop, akRight, akBottom]
+ Indent = 19
+ ReadOnly = True
+ TabOrder = 0
+ OnChange = tvItemsChange
+ end
+ object btnClose: TTntButton
+ Left = 307
+ Top = 168
+ Width = 75
+ Height = 25
+ Anchors = [akRight, akBottom]
+ Cancel = True
+ Caption = '&Close'
+ ModalResult = 2
+ TabOrder = 3
+ OnClick = btnCloseClick
+ end
+ object btnUpdate: TTntButton
+ Left = 223
+ Top = 168
+ Width = 75
+ Height = 25
+ Anchors = [akRight, akBottom]
+ Caption = '&Update'
+ Default = True
+ TabOrder = 2
+ OnClick = btnUpdateClick
+ end
+end
Added: translator/trunk/src/ToolConsistency/ToolConsistencyFrm.pas
===================================================================
--- translator/trunk/src/ToolConsistency/ToolConsistencyFrm.pas (rev 0)
+++ translator/trunk/src/ToolConsistency/ToolConsistencyFrm.pas 2006-12-05 00:27:32 UTC (rev 165)
@@ -0,0 +1,226 @@
+unit ToolConsistencyFrm;
+
+interface
+
+uses
+ Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, TntForms,
+ Dialogs, TntClasses, TransIntf, TntMenus, StdCtrls, ComCtrls,
+ TntStdCtrls, TntComCtrls;
+
+type
+ TTranslationItems = class
+ private
+ FOriginalItems: TTntStrings;
+ FIgnoreAccelChar: boolean;
+ function GetItems(Index: integer): TTntStrings;
+ function GetCount: integer;
+ function GetName(Index: integer): WideString;
+ function GetRealItem(Index, SubIndex: integer): ITranslationItem;
+ public
+ constructor Create(IgnoreAccelChar: boolean);
+ destructor Destroy; override;
+ procedure Clear;
+ procedure Add(const AItem: ITranslationItem);
+ property Items[Index: integer]: TTntStrings read GetItems;
+ property Name[Index: integer]: WideString read GetName;
+ property RealItem[Index, SubIndex: integer]: ITranslationItem read GetRealItem;
+ property Count: integer read GetCount;
+ end;
+
+ TfrmToolConsistency = class(TTntForm)
+ chkIgnoreAccelChar: TTntCheckBox;
+ tvItems: TTntTreeView;
+ btnClose: TTntButton;
+ lblInfo: TTntLabel;
+ btnUpdate: TTntButton;
+ TntLabel1: TTntLabel;
+ procedure chkIgnoreAccelCharClick(Sender: TObject);
+ procedure tvItemsChange(Sender: TObject; Node: TTreeNode);
+ procedure btnCloseClick(Sender: TObject);
+ procedure btnUpdateClick(Sender: TObject);
+ private
+ { Private declarations }
+ FItems: ITranslationItems;
+ FTItems: TTranslationItems;
+ procedure BuildList(IgnoreAccelChar: boolean);
+ procedure LoadSettings;
+ procedure SaveSettings;
+
+ public
+ { Public declarations }
+ class function Execute(const ApplicationServices: IApplicationServices; const Items, Orphans: ITranslationItems): boolean;
+ destructor Destroy; override;
+ end;
+
+implementation
+
+{$R *.dfm}
+
+{ TfrmToolConsistency }
+
+procedure TfrmToolConsistency.BuildList(IgnoreAccelChar: boolean);
+var
+ i, j: integer;
+ N: TTntTreeNode;
+begin
+ FreeAndNil(FTItems);
+ tvItems.Items.Clear;
+ FTItems := TTranslationItems.Create(IgnoreAccelChar);
+ for i := 0 to FItems.Count - 1 do
+ FTItems.Add(FItems[i]);
+ for i := 0 to FTItems.Count - 1 do
+ if FTItems.Items[i].Count > 1 then
+ begin
+ N := tvItems.Items.Add(nil, FTItems.Name[i]);
+ for j := 0 to FTItems.Items[i].Count - 1 do
+ tvItems.Items.AddChildObject(N, FTItems.Items[i].Strings[j], Pointer(FTItems.RealItem[i, j]));
+ end;
+ if tvItems.Items.Count = 0 then
+ begin
+ tvItems.ShowRoot := false;
+ tvItems.Items.Add(nil, 'Congratulations! - No inconsistent items found!');
+ end
+ else
+ tvItems.ShowRoot := true;
+ tvItems.FullExpand;
+ tvItems.Selected := tvItems.Items.GetFirstNode;
+ tvItems.Selected.MakeVisible;
+end;
+
+class function TfrmToolConsistency.Execute(const ApplicationServices: IApplicationServices; const Items, Orphans: ITranslationItems): boolean;
+var frm: TfrmToolConsistency;
+begin
+ frm := self.Create(Application);
+ try
+ frm.FItems := Items;
+ frm.LoadSettings;
+ frm.btnUpdate.Click;
+ frm.ShowModal;
+ frm.SaveSettings;
+ Result := true;
+ finally
+ frm.Free;
+ end;
+end;
+
+destructor TfrmToolConsistency.Destroy;
+begin
+ FreeAndNil(FTItems);
+ inherited;
+end;
+
+procedure TfrmToolConsistency.LoadSettings;
+begin
+// TODO
+end;
+
+procedure TfrmToolConsistency.SaveSettings;
+begin
+// TODO
+end;
+
+procedure TfrmToolConsistency.tvItemsChange(Sender: TObject;
+ Node: TTreeNode);
+var AItem:ITranslationItem;
+begin
+ if Assigned(Node) and Assigned(Node.Data) then
+ begin
+ AItem := ITranslationItem(Node.Data);
+ lblInfo.Caption := WideFormat('(%s.%s)',[AItem.Section, AItem.Name]);
+ end
+ else
+ lblInfo.Caption := '';
+end;
+
+procedure TfrmToolConsistency.btnCloseClick(Sender: TObject);
+begin
+ Close;
+end;
+
+procedure TfrmToolConsistency.btnUpdateClick(Sender: TObject);
+begin
+ BuildList(chkIgnoreAccelChar.Checked);
+end;
+
+{ TTranslationItems }
+
+procedure TTranslationItems.Add(const AItem: ITranslationItem);
+var
+ AOriginal, ATranslation: WideString;
+ SL: TTntStringlist;
+ i: integer;
+begin
+ if FIgnoreAccelChar then
+ begin
+ AOriginal := WideStripHotkey(AItem.Original);
+ ATranslation := WideStripHotkey(AItem.Translation);
+ end
+ else
+ begin
+ AOriginal := AItem.Original;
+ ATranslation := AItem.Translation;
+ end;
+ i := FOriginalItems.IndexOf(AOriginal);
+ if i < 0 then
+ i := FOriginalItems.Add(AOriginal);
+ if FOriginalItems.Objects[i] = nil then
+ begin
+ SL := TTntStringlist.Create;
+ SL.Sorted := true;
+ FOriginalItems.Objects[i] := SL;
+ end
+ else
+ SL := TTntStringlist(FOriginalItems.Objects[i]);
+ SL.AddObject(ATranslation, TObject(Pointer(AItem)));
+end;
+
+procedure TTranslationItems.Clear;
+var i: integer;
+begin
+ for i := 0 to FOriginalItems.Count - 1 do
+ TTntStringlist(FOriginalItems.Objects[i]).Free;
+ FOriginalItems.Clear;
+end;
+
+constructor TTranslationItems.Create(IgnoreAccelChar: boolean);
+begin
+ inherited Create;
+ FOriginalItems := TTntStringlist.Create;
+ TTntStringlist(FOriginalItems).Sorted := true;
+ FIgnoreAccelChar := IgnoreAccelChar;
+end;
+
+destructor TTranslationItems.Destroy;
+begin
+ Clear;
+ FreeAndNil(FOriginalItems);
+ inherited;
+end;
+
+function TTranslationItems.GetCount: integer;
+begin
+ Result := FOriginalItems.Count;
+end;
+
+function TTranslationItems.GetItems(Index: integer): TTntStrings;
+begin
+ Result := TTntStrings(FOriginalItems.Objects[Index]);
+end;
+
+procedure TfrmToolConsistency.chkIgnoreAccelCharClick(Sender: TObject);
+begin
+ BuildList(chkIgnoreAccelChar.Checked);
+end;
+
+function TTranslationItems.GetName(Index: integer): WideString;
+begin
+ Result := FOriginalItems[Index];
+end;
+
+function TTranslationItems.GetRealItem(Index, SubIndex: integer): ITranslationItem;
+begin
+ Result := ITranslationItem(Pointer(TTntStrings(FOriginalItems.Objects[Index]).Objects[SubIndex]));
+end;
+
+end.
+
Added: translator/trunk/src/ToolConsistency/ToolConsistencyImpl.pas
===================================================================
--- translator/trunk/src/ToolConsistency/ToolConsistencyImpl.pas (rev 0)
+++ translator/trunk/src/ToolConsistency/ToolConsistencyImpl.pas 2006-12-05 00:27:32 UTC (rev 165)
@@ -0,0 +1,103 @@
+{@abstract(Implementation of ToolConsistency) }
+{
+ Copyright \xA9 2003-2006 by Peter Thornqvist; all rights reserved
+
+ Developer(s):
+ p3 - peter3 att users dott sourceforge dott net
+
+ Status:
+ The contents of this file are subject to the Mozilla Public License Version
+ 1.1 (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at http://www.mozilla.org/MPL/MPL-1.1.html
+
+ Software distributed under the License is distributed on an "AS IS" basis,
+ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+ the specific language governing rights and limitations under the License.
+}
+
+// $Id: $
+unit ToolConsistencyImpl;
+
+interface
+uses
+ Classes, TransIntf;
+type
+ TToolConsistencyPlugins = class(TInterfacedObject, IInterface, IToolItems)
+ public
+ function Count: Integer; safecall;
+ function ToolItem(Index: Integer; out ToolItem: IToolItem): HRESULT;
+ safecall;
+ end;
+
+ TToolConsistencyPlugin = class(TInterfacedObject, IInterface, IToolItem)
+ private
+ FAppServices:IApplicationServices;
+ public
+ function About: WideString; safecall;
+ function DisplayName: WideString; safecall;
+ function Execute(const Items: ITranslationItems; const Orphans: ITranslationItems; var SelectedItem: ITranslationItem): HRESULT; safecall;
+ function Icon: Cardinal; safecall;
+ procedure Init(const ApplicationServices: IApplicationServices); safecall;
+ function Status(const Items: ITranslationItems; const Orphans: ITranslationItems; const SelectedItem: ITranslationItem): Integer; safecall;
+ end;
+
+implementation
+
+uses ToolConsistencyFrm;
+
+{ TToolConsistencyPlugins }
+
+function TToolConsistencyPlugins.Count: Integer;
+begin
+ Result := 1;
+end;
+
+function TToolConsistencyPlugins.ToolItem(Index: Integer;
+ out ToolItem: IToolItem): HRESULT;
+begin
+ if Index = 0 then
+ begin
+ ToolItem := TToolConsistencyPlugin.Create;
+ Result := S_OK;
+ end
+ else
+ Result := S_FALSE;
+end;
+
+{ TToolConsistencyPlugin }
+
+function TToolConsistencyPlugin.About: WideString;
+begin
+ Result := 'This plugin checks and displays inconsistent translations';
+end;
+
+function TToolConsistencyPlugin.DisplayName: WideString;
+begin
+ Result := 'Check consistency';
+end;
+
+function TToolConsistencyPlugin.Execute(const Items, Orphans: ITranslationItems; var SelectedItem: ITranslationItem): HRESULT;
+begin
+ TfrmToolConsistency.Execute(FAppServices, Items, Orphans);
+ Result := S_OK;
+end;
+
+function TToolConsistencyPlugin.Icon: Cardinal;
+begin
+ Result := 0;
+end;
+
+procedure TToolConsistencyPlugin.Init(const ApplicationServices: IApplicationServices);
+begin
+ FAppServices := ApplicationServices;
+end;
+
+function TToolConsistencyPlugin.Status(const Items,
+ Orphans: ITranslationItems;
+ const SelectedItem: ITranslationItem): Integer;
+begin
+ Result := TOOL_VISIBLE or TOOL_ENABLED;
+end;
+
+end.
+
Modified: translator/trunk/translator.bpg
===================================================================
--- translator/trunk/translator.bpg 2006-12-05 00:22:49 UTC (rev 164)
+++ translator/trunk/translator.bpg 2006-12-05 00:27:32 UTC (rev 165)
@@ -9,11 +9,12 @@
DCC = $(ROOT)\bin\dcc32.exe $**
BRCC = $(ROOT)\bin\brcc32.exe $**
#------------------------------------------------------------------------------
-PROJECTS = FoxitParser.dll IBForumsParser.dll MozillaDTDParser.dll MozillaPropsParser.dll \
- MSDictBuild.exe MSDictParser.dll MsTermBuild.exe OlegParser.dll OOGSIParser.dll \
- PHPNukeParser.dll PHPParser.dll PolyGlotParser.dll POParser.dll SciTEParser.dll \
- TMXParser.dll ToolTreeView.dll ToolListEdit.dll ToolPropertiesView.dll \
- XLIFFParser.dll XilisoftParser.dll translator.exe
+PROJECTS = FoxitParser.dll IBForumsParser.dll MozillaDTDParser.dll \
+ MozillaPropsParser.dll MSDictBuild.exe MSDictParser.dll MsTermBuild.exe \
+ OlegParser.dll OOGSIParser.dll PHPNukeParser.dll PHPParser.dll \
+ PolyGlotParser.dll POParser.dll SciTEParser.dll TMXParser.dll ToolTreeView.dll \
+ ToolListEdit.dll ToolPropertiesView.dll ToolConsistency.dll XLIFFParser.dll \
+ XilisoftParser.dll translator.exe
#------------------------------------------------------------------------------
default: $(PROJECTS)
#------------------------------------------------------------------------------
@@ -81,4 +82,7 @@
XilisoftParser.dll: src\XilisoftPlugin\XilisoftParser.dpr
$(DCC)
+ToolConsistency.dll: src\ToolConsistency\ToolConsistency.dpr
+ $(DCC)
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|