[Initranslator-svncheckins] SF.net SVN: initranslator: [269] translator/trunk/src
Brought to you by:
peter3
|
From: <pe...@us...> - 2007-10-21 15:49:50
|
Revision: 269
http://initranslator.svn.sourceforge.net/initranslator/?rev=269&view=rev
Author: peter3
Date: 2007-10-21 08:49:52 -0700 (Sun, 21 Oct 2007)
Log Message:
-----------
- option to change the font preview text
- localization of plugins implemented where missing and fixed where not working
Modified Paths:
--------------
translator/trunk/src/AppOptions.pas
translator/trunk/src/DCPPPlugin/DCPPParser.res
translator/trunk/src/DCPPPlugin/DCPPParserImpl.pas
translator/trunk/src/FoxitPlugin/FoxitParserImpl.pas
translator/trunk/src/MainFrm.dfm
translator/trunk/src/MainFrm.pas
translator/trunk/src/OptionsFrm.dfm
translator/trunk/src/OptionsFrm.pas
translator/trunk/src/PHPPlugin/PHPParser.dof
translator/trunk/src/PHPPlugin/PHPParser.res
translator/trunk/src/PolyglotPlugin/PolyGlotParser.dof
translator/trunk/src/PolyglotPlugin/PolyGlotParser.res
translator/trunk/src/PolyglotPlugin/PolyGlotParserImpl.pas
translator/trunk/src/ResXPlugin/ResXParserImpl.pas
translator/trunk/src/SDFSplit/MainFrm.pas
translator/trunk/src/SciTEPlugin/SciTEParserImpl.pas
translator/trunk/src/TMXPlugin/TMXParserImpl.pas
translator/trunk/src/ToolKeyCheck/ToolKeyCheck.dof
translator/trunk/src/ToolKeyCheck/ToolKeyCheck.res
translator/trunk/src/WixPlugin/WixParser.res
translator/trunk/src/WixPlugin/WixParserImpl.pas
translator/trunk/src/XLIFFPlugin/XLIFFParserImpl.pas
Modified: translator/trunk/src/AppOptions.pas
===================================================================
--- translator/trunk/src/AppOptions.pas 2007-10-21 15:43:41 UTC (rev 268)
+++ translator/trunk/src/AppOptions.pas 2007-10-21 15:49:52 UTC (rev 269)
@@ -138,6 +138,8 @@
FSectionEnd: WideString;
FSectionStart: WideString;
FSeparatorChars: WideString;
+
+ FPreviewText: WideString;
procedure ReadWindowInfos(ini:TWideCustomIniFile);
procedure WriteWindowInfos(ini:TWideCustomIniFile);
function GetWindowInfo(AForm:TForm):TAppWindowInfo;
@@ -188,6 +190,7 @@
property AppTitle:WideString read FAppTitle write FAppTitle;
property FontName:WideString read FFontName write FFontName;
property FontSize:integer read FFontSize write FFontSize;
+ property PreviewText:WideString read FPreviewText write FPreviewText;
property MonitorFiles:boolean read FMonitorFiles write FMonitorFiles default true;
property Theme:WideString read FTheme write FTheme;
property Header:TTntStrings read FHeader write SetHeader;
@@ -495,6 +498,7 @@
FFilename := AFilename;
FontName := ini.ReadString('Font', 'FontName', FontName);
FontSize := ini.ReadInteger('Font', 'FontSize', FontSize);
+ PreviewText := ini.ReadString('Font', 'PreviewText', PreviewText);
ShowQuotes := ini.ReadBool('General', 'ShowQuotes', ShowQuotes);
InvertDictionary := ini.ReadBool('General', 'InvertDictionary', InvertDictionary);
@@ -601,6 +605,7 @@
FFilename := AFilename;
ini.WriteString('Font', 'FontName', FontName);
ini.WriteInteger('Font', 'FontSize', FontSize);
+ ini.WriteString('Font', 'PreviewText', PreviewText);
ini.WriteBool('General', 'ShowQuotes', ShowQuotes);
ini.WriteBool('General', 'InvertDictionary', InvertDictionary);
Modified: translator/trunk/src/DCPPPlugin/DCPPParser.res
===================================================================
(Binary files differ)
Modified: translator/trunk/src/DCPPPlugin/DCPPParserImpl.pas
===================================================================
--- translator/trunk/src/DCPPPlugin/DCPPParserImpl.pas 2007-10-21 15:43:41 UTC (rev 268)
+++ translator/trunk/src/DCPPPlugin/DCPPParserImpl.pas 2007-10-21 15:49:52 UTC (rev 269)
@@ -109,9 +109,9 @@
begin
case Capability of
CAP_IMPORT:
- Result := cImportTitle;
+ Result := Translate(cImportTitle);
CAP_EXPORT:
- Result := cExportTitle;
+ Result := Translate(cExportTitle);
else
Result := '';
end;
@@ -167,9 +167,9 @@
begin
Result := true;
case FIndex of
- 0:Value := cImportTitle;
- 1:Value := cExportTitle;
- 3:Value := cDCPPFilter;
+ 0: Value := cImportTitle;
+ 1: Value := cExportTitle;
+ 2: Value := cDCPPFilter;
else
Result := false;
end;
Modified: translator/trunk/src/FoxitPlugin/FoxitParserImpl.pas
===================================================================
--- translator/trunk/src/FoxitPlugin/FoxitParserImpl.pas 2007-10-21 15:43:41 UTC (rev 268)
+++ translator/trunk/src/FoxitPlugin/FoxitParserImpl.pas 2007-10-21 15:49:52 UTC (rev 269)
@@ -23,13 +23,18 @@
Classes, Types, TntClasses, TntSysUtils, TransIntf;
type
- TFoxitParser = class(TInterfacedObject, IUnknown, IFileParser)
+ TFoxitParser = class(TInterfacedObject, IUnknown, IFileParser, ILocalizable)
private
FOldAppHandle:Cardinal;
+ FIndex:integer;
+ FApplicationServices:IApplicationServices;
FOrigFile, FTransFile:WideString;
procedure LoadSettings;
procedure SaveSettings;
procedure BuildPreview(Items:ITranslationItems; Strings:TTntStrings);
+ function Translate(Value: WideString): WideString;
+ function GetString(out Section: WideString; out Name: WideString;
+ out Value: WideString): WordBool; safecall;
public
constructor Create;
destructor Destroy; override;
@@ -53,6 +58,7 @@
cFoxitFilter = 'Foxit Files (*.xml)|*.xml|All files (*.*)|*.*';
cFoxitImportTitle = 'Import from Foxit file';
cFoxitExportTitle = 'Export to Foxit file';
+ cSectionName = 'Foxit';
cDialogItem = 'dlgitem';
cPopupItem = 'popup';
cMenuItem = 'menuitem';
@@ -74,6 +80,14 @@
Result := Tnt_WideStringReplace(Result, '>', '>', [rfReplaceAll]);
end;
+function TFoxitParser.Translate(Value:WideString):WideString;
+begin
+ if FApplicationServices <> nil then
+ Result := FApplicationServices.Translate(cSectionName, Value, Value)
+ else
+ Result := Value;
+end;
+
procedure TFoxitParser.BuildPreview(Items:ITranslationItems; Strings:TTntStrings);
var
i:integer;
@@ -118,9 +132,9 @@
begin
case Capability of
CAP_IMPORT:
- Result := cFoxitImportTitle;
+ Result := Translate(cFoxitImportTitle);
CAP_EXPORT:
- Result := cFoxitExportTitle;
+ Result := Translate(cFoxitExportTitle);
else
Result := '';
end;
@@ -139,7 +153,7 @@
S := TTntStringlist.Create;
try
BuildPreview(Items, S);
- if TfrmExport.Execute(FTransFile, cFoxitExportTitle, cFoxitFilter, '.', 'xml', S) then
+ if TfrmExport.Execute(FTransFile, Translate(cFoxitExportTitle), Translate(cFoxitFilter), '.', 'xml', S) then
begin
S.Text := WideStringToUTF8(S.Text);
S.AnsiStrings.SaveToFile(FTransFile);
@@ -155,6 +169,27 @@
end;
end;
+function TFoxitParser.GetString(out Section, Name,
+ Value: WideString): WordBool;
+begin
+ Result := true;
+ case FIndex of
+ 0:Value := cFoxitFilter;
+ 1:Value := cFoxitImportTitle;
+ 2:Value := cFoxitExportTitle;
+ else
+ Result := false;
+ end;
+ if Result then
+ begin
+ Section := cSectionName;
+ Name := Value;
+ Inc(FIndex);
+ end
+ else
+ FIndex := 0;
+end;
+
function TFoxitParser.ImportItems(const Items, Orphans:ITranslationItems):HRESULT;
type
TFoundItem = (fiOriginal, fiTranslation);
@@ -248,7 +283,7 @@
Items.Clear;
Orphans.Clear;
LoadSettings;
- if TfrmDualImport.Execute(FOrigFile, FTransFile, cFoxitImportTitle, cFoxitFilter, '.', 'xml') then
+ if TfrmDualImport.Execute(FOrigFile, FTransFile, Translate(cFoxitImportTitle), Translate(cFoxitFilter), '.', 'xml') then
begin
FXMLImport := TXMLDocument.Create(FOrigFile);
try
@@ -288,6 +323,7 @@
procedure TFoxitParser.Init(const ApplicationServices:IApplicationServices);
begin
Application.Handle := ApplicationServices.AppHandle;
+ FApplicationServices := ApplicationServices;
end;
procedure TFoxitParser.LoadSettings;
Modified: translator/trunk/src/MainFrm.dfm
===================================================================
--- translator/trunk/src/MainFrm.dfm 2007-10-21 15:43:41 UTC (rev 268)
+++ translator/trunk/src/MainFrm.dfm 2007-10-21 15:49:52 UTC (rev 269)
@@ -1,11 +1,11 @@
object frmMain: TfrmMain
Left = 379
Top = 181
+ Width = 573
+ Height = 453
Action = acAbout
ActiveControl = reTranslation
Caption = 'Ini Translator'
- ClientHeight = 421
- ClientWidth = 565
Color = clBtnFace
Constraints.MinHeight = 375
Constraints.MinWidth = 450
@@ -21,7 +21,7 @@
OnCreate = FormCreate
PixelsPerInch = 96
TextHeight = 13
- object StatusBar1: TTBXStatusBar
+ object sbBottom: TTBXStatusBar
Left = 0
Top = 402
Width = 565
@@ -889,7 +889,7 @@
ParentBackground = False
ParentFont = False
TabOrder = 0
- object lblViewDetails: TLabel
+ object lblViewDetails: TTntLabel
Left = 4
Top = 4
Width = 527
Modified: translator/trunk/src/MainFrm.pas
===================================================================
--- translator/trunk/src/MainFrm.pas 2007-10-21 15:43:41 UTC (rev 268)
+++ translator/trunk/src/MainFrm.pas 2007-10-21 15:49:52 UTC (rev 269)
@@ -67,7 +67,7 @@
type
TfrmMain = class(TfrmBase)
- StatusBar1:TTBXStatusBar;
+ sbBottom: TTBXStatusBar;
alMain:TTntActionList;
acOpenOrig:TTntAction;
acOpenTrans:TTntAction;
@@ -302,7 +302,7 @@
lvTranslateStrings:TTntListView;
pnlKeyBack:TTntPanel;
pnlKeyDetails:TTntPanel;
- lblViewDetails:TLabel;
+ lblViewDetails: TTntLabel;
acTestExceptionHandler:TTntAction;
acDictAdd:TTntAction;
TBXItem6:TSpTBXItem;
@@ -728,6 +728,8 @@
finally
reTranslation.Modified := m;
end;
+ lblViewDetails.Font.Name := GlobalAppOptions.FontName;
+
Application.ShowHint := GlobalAppOptions.ShowToolTips;
Application.HintShortCuts := GlobalAppOptions.ShowToolTipShortCuts;
ShowHint := Application.ShowHint;
@@ -1489,44 +1491,44 @@
end;
begin
if Modified then
- StatusBar1.Panels[0].Caption := ' ' + _(ClassName, SModified)
+ sbBottom.Panels[0].Caption := ' ' + _(ClassName, SModified)
else
- StatusBar1.Panels[0].Caption := ' ' + _(ClassName, SReady);
+ sbBottom.Panels[0].Caption := ' ' + _(ClassName, SReady);
if SelectedItem <> nil then
begin
- StatusBar1.Panels[1].Caption := ' ' + SelectedItem.Section;
- StatusBar1.Panels[2].Caption := ' ' + SelectedItem.Name;
+ sbBottom.Panels[1].Caption := ' ' + SelectedItem.Section;
+ sbBottom.Panels[2].Caption := ' ' + SelectedItem.Name;
with SelectedItem do
lblViewDetails.Caption := WideFormat(_(ClassName, SFmtKeyDetails), [Section, Name]);
end
else
begin
- StatusBar1.Panels[1].Caption := '';
- StatusBar1.Panels[2].Caption := '';
+ sbBottom.Panels[1].Caption := '';
+ sbBottom.Panels[2].Caption := '';
lblViewDetails.Caption := Application.Title;
end;
// very simple, but should work *most* of the time...
lblViewDetails.Font.Height := -CalcMaxFontSize(lblViewDetails.Canvas, lblViewDetails.Caption, lblViewDetails.Width,
14, 7);
- StatusBar1.Panels[3].Caption := ' ' + WideFormat(_(ClassName, SFmtItemsCount), [FTranslateFile.Items.Count]);
+ sbBottom.Panels[3].Caption := ' ' + WideFormat(_(ClassName, SFmtItemsCount), [FTranslateFile.Items.Count]);
if SaveDictDlg.FileName <> '' then
- StatusBar1.Panels[4].Caption := ' ' + ExtractFileName(SaveDictDlg.FileName)
+ sbBottom.Panels[4].Caption := ' ' + ExtractFileName(SaveDictDlg.FileName)
else
- StatusBar1.Panels[4].Caption := ' ' + _(ClassName, SNoDictionary);
+ sbBottom.Panels[4].Caption := ' ' + _(ClassName, SNoDictionary);
if acDictInvert.Checked then
- StatusBar1.Panels[4].Caption := StatusBar1.Panels[4].Caption + WideFormat(' (%s)', [_(ClassName,
+ sbBottom.Panels[4].Caption := sbBottom.Panels[4].Caption + WideFormat(' (%s)', [_(ClassName,
SDictInverted)]);
- StatusBar1.Panels[5].Caption := WideFormat(_(ClassName, ' %d | %d | %d | %f%%'),
+ sbBottom.Panels[5].Caption := WideFormat(_(ClassName, ' %d | %d | %d | %f%%'),
[FTranslateFile.Items.Count, FTranslateFile.Items.TranslatedCount, FTranslateFile.Items.Count - FTranslateFile.Items.TranslatedCount, SafeDiv(FTranslateFile.Items.TranslatedCount, FTranslateFile.Items.Count) * 100]);
pbTranslated.Max := FTranslateFile.Items.Count;
pbTranslated.Position := FTranslateFile.Items.TranslatedCount;
pbTranslated.Hint := ' ' + WideFormat(_(ClassName, SFmtCountOfCountTranslated), [FTranslateFile.Items.TranslatedCount,
FTranslateFile.Items.Count]);
- // StatusBar1.Panels[6].Caption := ''; this is the progress bar
- StatusBar1.Panels[7].Caption := WideFormat(_(ClassName, SFmtOrphansCount), [FTranslateFile.Orphans.Count]);
- for i := 0 to StatusBar1.Panels.Count - 1 do
- StatusBar1.Panels[i].Hint := StatusBar1.Panels[i].Caption;
+ // sbBottom.Panels[6].Caption := ''; this is the progress bar
+ sbBottom.Panels[7].Caption := WideFormat(_(ClassName, SFmtOrphansCount), [FTranslateFile.Orphans.Count]);
+ for i := 0 to sbBottom.Panels.Count - 1 do
+ sbBottom.Panels[i].Hint := sbBottom.Panels[i].Caption;
UpdateColumn(0, GlobalAppOptions.OriginalFile);
UpdateColumn(1, GlobalAppOptions.TranslationFile);
@@ -3684,7 +3686,7 @@
// adjust UI
if acFullScreen.Checked then
begin
- StatusBar1.Visible := false;
+ sbBottom.Visible := false;
tbTools.Tag := Ord(tbTools.Visible);
tbTools.Visible := false;
BorderStyle := bsNone;
@@ -3692,7 +3694,7 @@
end
else
begin
- StatusBar1.Visible := true;
+ sbBottom.Visible := true;
tbTools.Visible := tbTools.Visible or (tbTools.Tag = 1);
BorderStyle := bsSizeable;
P.showCmd := SW_RESTORE;
Modified: translator/trunk/src/OptionsFrm.dfm
===================================================================
--- translator/trunk/src/OptionsFrm.dfm 2007-10-21 15:43:41 UTC (rev 268)
+++ translator/trunk/src/OptionsFrm.dfm 2007-10-21 15:49:52 UTC (rev 269)
@@ -237,14 +237,30 @@
OnClick = btnHelpClick
end
object pnlFontPreview: TTntPanel
- Left = 245
- Top = 179
+ Left = 243
+ Top = 178
Width = 202
Height = 21
+ Hint =
+ 'Click to edit, click again to save. To restore default preview,' +
+ ' clear the text.'
Anchors = [akLeft, akRight, akBottom]
BevelKind = bkFlat
BevelOuter = bvNone
TabOrder = 12
+ OnClick = pnlFontPreviewClick
+ object edPreview: TTntEdit
+ Left = 0
+ Top = 0
+ Width = 198
+ Height = 17
+ Align = alClient
+ BorderStyle = bsNone
+ TabOrder = 0
+ Visible = False
+ OnClick = edPreviewClick
+ OnExit = edPreviewExit
+ end
end
object chkUseTranslationEverywhere: TTntCheckBox
Left = 214
Modified: translator/trunk/src/OptionsFrm.pas
===================================================================
--- translator/trunk/src/OptionsFrm.pas 2007-10-21 15:43:41 UTC (rev 268)
+++ translator/trunk/src/OptionsFrm.pas 2007-10-21 15:49:52 UTC (rev 269)
@@ -77,6 +77,7 @@
TntLabel5:TTntLabel;
cbFontSizes:TTntComboBox;
TntLabel6:TTntLabel;
+ edPreview: TTntEdit;
procedure chkShowToolTipsClick(Sender:TObject);
procedure chkReturnToSaveClick(Sender:TObject);
procedure btnLanguageClick(Sender:TObject);
@@ -85,6 +86,9 @@
procedure btnColorsClick(Sender:TObject);
procedure cbFontsChange(Sender:TObject);
procedure cbFontSizesChange(Sender:TObject);
+ procedure pnlFontPreviewClick(Sender: TObject);
+ procedure edPreviewClick(Sender: TObject);
+ procedure edPreviewExit(Sender: TObject);
private
{ Private declarations }
@@ -175,10 +179,14 @@
procedure TfrmOptions.UpdatePreview;
begin
+ edPreview.Visible := false;
pnlFontPreview.Font.Name := cbFonts.Text;
pnlFontPreview.Font.Size := StrToIntDef(cbFontSizes.Text, pnlFontPreview.Font.Size);
with pnlFontPreview do
- Caption := WideFormat('%s, %dpt', [Font.Name, Font.Size]);
+ if edPreview.Text <> '' then
+ Caption := edPreview.Text
+ else
+ Caption := WideFormat('%s, %dpt', [Font.Name, Font.Size]);
end;
procedure TfrmOptions.btnColorsClick(Sender:TObject);
@@ -210,6 +218,7 @@
edHelp.Text := Options.HelpFile;
pnlFontPreview.Font.Name := Options.FontName;
pnlFontPreview.Font.Size := Options.FontSize;
+ edPreview.Text := Options.PreviewText;
reHeader.Lines := Options.Header;
reFooter.Lines := Options.Footer;
@@ -245,7 +254,9 @@
Options.HelpFile := edHelp.Text;
Options.FontName := pnlFontPreview.Font.Name;
Options.FontSize := pnlFontPreview.Font.Size;
+ Options.PreviewText := edPreview.Text;
+
Options.Header := reHeader.Lines;
Options.Footer := reFooter.Lines;
@@ -367,4 +378,21 @@
UpdatePreview;
end;
+procedure TfrmOptions.pnlFontPreviewClick(Sender: TObject);
+begin
+ edPreview.Text := pnlFontPreview.Caption;
+ edPreview.Visible := true;
+ Windows.SetFocus(edPreview.Handle);
+end;
+
+procedure TfrmOptions.edPreviewClick(Sender: TObject);
+begin
+ UpdatePreview;
+end;
+
+procedure TfrmOptions.edPreviewExit(Sender: TObject);
+begin
+ UpdatePreview;
+end;
+
end.
Modified: translator/trunk/src/PHPPlugin/PHPParser.dof
===================================================================
--- translator/trunk/src/PHPPlugin/PHPParser.dof 2007-10-21 15:43:41 UTC (rev 268)
+++ translator/trunk/src/PHPPlugin/PHPParser.dof 2007-10-21 15:49:52 UTC (rev 269)
@@ -20,7 +20,6 @@
PackageDLLOutputDir=
PackageDCPOutputDir=
SearchPath=
-Packages=
Conditionals=
DebugSourceDirs=
UsePackages=0
@@ -53,6 +52,6 @@
LegalTrademarks=
OriginalFilename=PHPParser.dll
ProductName=PHP Plugin for IniTranslator
-ProductVersion=1.9.0.50
+ProductVersion=1.9.0.51
Comments=Latest version at http://initranslator.sourceforge.net
-CompileDate=den 27 december 2006 00:13
+CompileDate=den 18 oktober 2007 19:57
Modified: translator/trunk/src/PHPPlugin/PHPParser.res
===================================================================
(Binary files differ)
Modified: translator/trunk/src/PolyglotPlugin/PolyGlotParser.dof
===================================================================
--- translator/trunk/src/PolyglotPlugin/PolyGlotParser.dof 2007-10-21 15:43:41 UTC (rev 268)
+++ translator/trunk/src/PolyglotPlugin/PolyGlotParser.dof 2007-10-21 15:49:52 UTC (rev 269)
@@ -5,7 +5,7 @@
UnsafeCode=0
UnsafeCast=0
[Linker]
-MapFile=0
+MapFile=3
OutputObjs=0
ConsoleApp=1
DebugInfo=0
@@ -53,6 +53,6 @@
LegalTrademarks=
OriginalFilename=PolyGlotParser.dll
ProductName=PolyGlotTranslator Plugin for IniTranslator
-ProductVersion=1.9.0.50
+ProductVersion=1.9.0.51
Comments=Latest version at http://initranslator.sourceforge.net
-CompileDate=den 27 december 2006 00:13
+CompileDate=den 18 oktober 2007 19:57
Modified: translator/trunk/src/PolyglotPlugin/PolyGlotParser.res
===================================================================
(Binary files differ)
Modified: translator/trunk/src/PolyglotPlugin/PolyGlotParserImpl.pas
===================================================================
--- translator/trunk/src/PolyglotPlugin/PolyGlotParserImpl.pas 2007-10-21 15:43:41 UTC (rev 268)
+++ translator/trunk/src/PolyglotPlugin/PolyGlotParserImpl.pas 2007-10-21 15:49:52 UTC (rev 269)
@@ -32,14 +32,19 @@
Classes, Types, TntClasses, TransIntf;
type
- TPolyGlotParser = class(TInterfacedObject, IUnknown, IFileParser)
+ TPolyGlotParser = class(TInterfacedObject, IUnknown, IFileParser, ILocalizable)
private
FOldAppHandle:Cardinal;
+ FIndex:integer;
+ FApplicationServices:IApplicationServices;
FTransFile, FOrigFile:WideString;
FSection:WideString;
procedure LoadSettings;
procedure SaveSettings;
procedure BuildPreview(Items:ITranslationItems; Strings:TTntStrings);
+ function GetString(out Section: WideString; out Name: WideString;
+ out Value: WideString): WordBool; safecall;
+ function Translate(const Value: WideString): WideString;
public
constructor Create;
destructor Destroy; override;
@@ -52,6 +57,7 @@
function ImportItems(const Items:ITranslationItems;
const Orphans:ITranslationItems):HRESULT; safecall;
procedure Init(const ApplicationServices:IApplicationServices); safecall;
+
end;
implementation
@@ -62,10 +68,18 @@
cPolyGlotFilter = 'PolyGlot Translator Files (*.lng)|*.lng|All files (*.*)|*.*';
cPolyGlotImportTitle = 'Import from PolyGlot Translator file';
cPolyGlotExportTitle = 'Export to PolyGlot Translator file';
- //cSectionName = 'PolyGlot Translator';
+ cSectionName = 'PolyGlot';
{ TPolyGlotParser }
+function TPolyGlotParser.Translate(const Value:WideString):WideString;
+begin
+ if FApplicationServices <> nil then
+ Result := FApplicationServices.Translate(cSectionName, Value, Value)
+ else
+ Result := Value;
+end;
+
procedure TPolyGlotParser.BuildPreview(Items:ITranslationItems; Strings:TTntStrings);
var
i:integer;
@@ -114,9 +128,9 @@
begin
case Capability of
CAP_IMPORT:
- Result := cPolyGlotImportTitle;
+ Result := Translate(cPolyGlotImportTitle);
CAP_EXPORT:
- Result := cPolyGlotExportTitle;
+ Result := Translate(cPolyGlotExportTitle);
else
Result := '';
end;
@@ -137,7 +151,7 @@
S := TTntStringlist.Create;
try
BuildPreview(Items, S);
- if TfrmExport.Execute(FTransFile, cPolyGlotExportTitle, cPolyGlotFilter, '.', 'lng', S) then
+ if TfrmExport.Execute(FTransFile, Translate(cPolyGlotExportTitle), Translate(cPolyGlotFilter), '.', 'lng', S) then
begin
S.AnsiStrings.SaveToFile(FTransFile);
Result := S_OK;
@@ -152,6 +166,27 @@
end;
end;
+function TPolyGlotParser.GetString(out Section, Name,
+ Value: WideString): WordBool;
+begin
+ Result := true;
+ case FIndex of
+ 0: Value := cPolyGlotFilter;
+ 1: Value := cPolyGlotImportTitle;
+ 2: Value := cPolyGlotExportTitle;
+ else
+ Result := false;
+ end;
+ if Result then
+ begin
+ Section := cSectionName;
+ Name := Value;
+ Inc(FIndex);
+ end
+ else
+ FIndex := 0;
+end;
+
function TPolyGlotParser.ImportItems(const Items, Orphans:ITranslationItems):HRESULT;
var
S:TTntStringlist;
@@ -164,7 +199,7 @@
Orphans.Clear;
TI := nil;
LoadSettings;
- if TfrmDualImport.Execute(FOrigFile, FTransFile, cPolyGlotImportTitle, cPolyGlotFilter, '.', 'lng', True) then
+ if TfrmDualImport.Execute(FOrigFile, FTransFile, Translate(cPolyGlotImportTitle), Translate(cPolyGlotFilter), '.', 'lng', True) then
begin
Items.Sort := stNone;
S := TTntStringlist.Create;
@@ -233,6 +268,7 @@
procedure TPolyGlotParser.Init(const ApplicationServices:IApplicationServices);
begin
Application.Handle := ApplicationServices.AppHandle;
+ FApplicationServices := ApplicationServices;
end;
procedure TPolyGlotParser.LoadSettings;
Modified: translator/trunk/src/ResXPlugin/ResXParserImpl.pas
===================================================================
--- translator/trunk/src/ResXPlugin/ResXParserImpl.pas 2007-10-21 15:43:41 UTC (rev 268)
+++ translator/trunk/src/ResXPlugin/ResXParserImpl.pas 2007-10-21 15:49:52 UTC (rev 269)
@@ -23,9 +23,10 @@
SysUtils, TransIntf;
type
- TResXParser = class(TInterfacedObject, IInterface, IFileParser)
+ TResXParser = class(TInterfacedObject, IInterface, IFileParser, ILocalizable)
private
FOldAppHandle:Cardinal;
+ Findex:integer;
FApplicationServices:IApplicationServices;
FOrigFilename, FTransFilename, FMimeTypes:WideString;
FMetaData:boolean;
@@ -41,6 +42,8 @@
function ImportItems(const Items:ITranslationItems;
const Orphans:ITranslationItems):HRESULT; safecall;
procedure Init(const ApplicationServices:IApplicationServices); safecall;
+ function GetString(out Section: WideString; out Name: WideString;
+ out Value: WideString): WordBool; safecall;
public
constructor Create;
destructor Destroy; override;
@@ -52,8 +55,8 @@
* orphans in the translation are added to the orphans list but there is no way to add them back into
the original or translation
}
-
+
implementation
uses
Forms, Dialogs, xmldoc, xmldom, xmlintf,
@@ -64,7 +67,7 @@
cResXImportTitle = 'Import from ResX file';
cResXExportTitle = 'Export to ResX file';
cResXFilter = 'ResX files (*.resx)|*.resx|All files (*.*)|*.*';
- cSection = 'ResX';
+ cSectionName = 'ResX';
var
XML:WideString = '';
@@ -157,7 +160,7 @@
if Encoding = '' then
Encoding := 'UTF-8';
XmlDoc.Encoding := Encoding;
- XmlDoc.StandAlone := 'yes';
+
XmlDoc.SaveToFile(FTransFilename);
Result := S_OK;
end;
@@ -169,6 +172,27 @@
end;
end;
+function TResXParser.GetString(out Section, Name,
+ Value: WideString): WordBool;
+begin
+ Result := true;
+ case FIndex of
+ 0: Value := cResXFilter;
+ 1: Value := cResXImportTitle;
+ 2: Value := cResXExportTitle;
+ else
+ Result := false;
+ end;
+ if Result then
+ begin
+ Section := cSectionName;
+ Name := Value;
+ Inc(FIndex);
+ end
+ else
+ FIndex := 0;
+end;
+
function TResXParser.ImportItems(const Items, Orphans:ITranslationItems):HRESULT;
var
@@ -275,7 +299,7 @@
if IsMatchingNode(ParentNode, TargetNode, CommentNode, Name) then
begin
TI := Items.Add;
- TI.Section := cSection;
+ TI.Section := cSectionName;
TI.Name := Name;
if CommentNode <> nil then
TI.OrigComments := StripTags((CommentNode as IDOMNodeEx).xml);
@@ -295,7 +319,7 @@
ParentNode := NodeList[i];
if IsMatchingNode(ParentNode, TargetNode, CommentNode, Name) then
begin
- j := Items.IndexOf(cSection,Name);
+ j := Items.IndexOf(cSectionName,Name);
if j >= 0 then
begin
TI := Items[j];
@@ -309,7 +333,7 @@
else // not found in original, add to orphans
begin
TI := Orphans.Add;
- TI.Section := cSection;
+ TI.Section := cSectionName;
TI.Name := Name;
if CommentNode <> nil then
TI.OrigComments := StripTags((CommentNode as IDOMNodeEx).xml);
@@ -400,7 +424,7 @@
function TResXParser.Translate(const Value:WideString):WideString;
begin
if FApplicationServices <> nil then
- Result := FApplicationServices.Translate(ClassName, Value, Value)
+ Result := FApplicationServices.Translate(cSectionName, Value, Value)
else
Result := Value;
end;
Modified: translator/trunk/src/SDFSplit/MainFrm.pas
===================================================================
--- translator/trunk/src/SDFSplit/MainFrm.pas 2007-10-21 15:43:41 UTC (rev 268)
+++ translator/trunk/src/SDFSplit/MainFrm.pas 2007-10-21 15:49:52 UTC (rev 269)
@@ -102,6 +102,7 @@
S := 'File does not exist';
edSDFFile.SetFocus;
end;
+ ForceDirectories(edSaveFolder.Text);
if not DirectoryExists(edSaveFolder.Text) then
begin
S := 'Output folder does not exist';
@@ -172,6 +173,7 @@
end;
begin
aBaseFolder := IncludeTrailingPathDelimiter(OutputFolder);
+ ForceDirectories(aBaseFolder);
aFileNameTemplate := ExtractFileName(Filename);
S := TStringlist.Create;
FLanguages := TStringlist.Create;
Modified: translator/trunk/src/SciTEPlugin/SciTEParserImpl.pas
===================================================================
--- translator/trunk/src/SciTEPlugin/SciTEParserImpl.pas 2007-10-21 15:43:41 UTC (rev 268)
+++ translator/trunk/src/SciTEPlugin/SciTEParserImpl.pas 2007-10-21 15:49:52 UTC (rev 269)
@@ -29,15 +29,20 @@
type
- TSciTEParser = class(TInterfacedObject, IUnknown, IFileParser)
+ TSciTEParser = class(TInterfacedObject, IUnknown, IFileParser, ILocalizable)
private
FOldHandle:LongWord;
FTransFile:WideString;
FExportRect:TRect;
+ FIndex:integer;
+ FApplicationServices:IApplicationServices;
procedure BuildPreview(const Items:ITranslationItems; Strings:TTntStrings);
function DoSciTEImport(const Items, Orphans:ITranslationItems; const TransFile:WideString):boolean;
procedure LoadSettings;
procedure SaveSettings;
+ function GetString(out Section: WideString; out Name: WideString;
+ out Value: WideString): WordBool; safecall;
+ function Translate(const Value: WideString): WideString;
public
constructor Create;
destructor Destroy; override;
@@ -51,7 +56,8 @@
implementation
uses
- Windows, Forms, IniFiles, CommonUtils, PreviewExportFrm, SingleImportFrm;
+ Windows, Forms, IniFiles,
+ CommonUtils, PreviewExportFrm, SingleImportFrm;
const
cSciTEFilter = 'SciTE files (locale.properties)|*.properties|All files (*.*)|*.*';
@@ -73,6 +79,14 @@
{ TSciTEParser }
+function TSciTEParser.Translate(const Value:WideString):WideString;
+begin
+ if FApplicationServices <> nil then
+ Result := FApplicationServices.Translate(cSectionName, Value, Value)
+ else
+ Result := Value;
+end;
+
function TSciTEParser.Capabilities:Integer;
begin
Result := CAP_IMPORT or CAP_EXPORT;
@@ -122,8 +136,8 @@
function TSciTEParser.DisplayName(Capability:Integer):WideString;
begin
case Capability of
- CAP_IMPORT:Result := cSciTEImportTitle;
- CAP_EXPORT:Result := cSciTEExportTitle;
+ CAP_IMPORT:Result := Translate(cSciTEImportTitle);
+ CAP_EXPORT:Result := Translate(cSciTEExportTitle);
// CAP_CONFIGURE : Result := 'Configure';
else
Result := '';
@@ -214,7 +228,7 @@
S := TTntStringlist.Create;
try
BuildPreview(Items, S);
- if TfrmExport.Execute(FTransFile, cSciTEExportTitle, cSciTEFilter, '.', 'properties', S) then
+ if TfrmExport.Execute(FTransFile, Translate(cSciTEExportTitle), Translate(cSciTEFilter), '.', 'properties', S) then
begin
S.AnsiStrings.SaveToFile(FTransFile);
SaveSettings;
@@ -233,7 +247,7 @@
try
Result := S_FALSE;
LoadSettings;
- if TfrmSingleImport.Execute(FTransFile, cSciTEImportTitle, cSciTEFilter, '.', 'properties') then
+ if TfrmSingleImport.Execute(FTransFile, Translate(cSciTEImportTitle), Translate(cSciTEFilter), '.', 'properties') then
begin
if DoSciTEImport(Items, Orphans, FTransFile) then
begin
@@ -243,7 +257,7 @@
Result := S_OK;
end
else
- Application.MessageBox(PChar(SImportError), PChar(SError), MB_OK or MB_ICONERROR);
+ WideMessageBox(GetActiveWindow, PWideChar(Translate(SImportError)), PWideChar(Translate(SError)), MB_OK or MB_ICONERROR);
end;
except
Application.HandleException(Self);
@@ -253,6 +267,7 @@
procedure TSciTEParser.Init(const ApplicationServices:IApplicationServices);
begin
Application.Handle := ApplicationServices.AppHandle;
+ FApplicationServices := ApplicationServices;
end;
procedure TSciTEParser.LoadSettings;
@@ -306,4 +321,27 @@
end;
+function TSciTEParser.GetString(out Section, Name,
+ Value: WideString): WordBool;
+begin
+ Result := true;
+ case FIndex of
+ 0: Value := cSciTEFilter;
+ 1: Value := cSciTEImportTitle;
+ 2: Value := cSciTEExportTitle;
+ 3: Value := SImportError;
+ 4: Value := SError;
+ else
+ Result := false;
+ end;
+ if Result then
+ begin
+ Section := cSectionName;
+ Name := Value;
+ Inc(FIndex);
+ end
+ else
+ FIndex := 0;
+end;
+
end.
Modified: translator/trunk/src/TMXPlugin/TMXParserImpl.pas
===================================================================
--- translator/trunk/src/TMXPlugin/TMXParserImpl.pas 2007-10-21 15:43:41 UTC (rev 268)
+++ translator/trunk/src/TMXPlugin/TMXParserImpl.pas 2007-10-21 15:49:52 UTC (rev 269)
@@ -23,13 +23,18 @@
Classes, Types, TntClasses, TntSysUtils, TransIntf;
type
- TTMXParser = class(TInterfacedObject, IUnknown, IFileParser)
+ TTMXParser = class(TInterfacedObject, IUnknown, IFileParser, ILocalizable)
private
FOldAppHandle:Cardinal;
+ FIndex:integer;
+ FApplicationServices:IApplicationServices;
FOrigFile, FOrigLang, FTransLang:WideString;
procedure LoadSettings;
procedure SaveSettings;
procedure BuildPreview(Items:ITranslationItems; Strings:TTntStrings);
+ function GetString(out Section: WideString; out Name: WideString;
+ out Value: WideString): WordBool; safecall;
+ function Translate(const Value: WideString): WideString;
public
constructor Create;
destructor Destroy; override;
@@ -53,6 +58,7 @@
cTMXFilter = 'TMX Files (*.tmx)|*.tmx|All files (*.*)|*.*';
cTMXImportTitle = 'Import from TMX file';
cTMXExportTitle = 'Export to TMX file';
+ cSectionName = 'TMX';
cOriginalItem:WideString = '!!!!Original%d!!!!';
cTranslationItem:WideString = '!!!!Translation%d!!!!';
@@ -61,6 +67,14 @@
{ TTMXParser }
+function TTMXParser.Translate(const Value:WideString):WideString;
+begin
+ if FApplicationServices <> nil then
+ Result := FApplicationServices.Translate(cSectionName, Value, Value)
+ else
+ Result := Value;
+end;
+
procedure TTMXParser.BuildPreview(Items:ITranslationItems; Strings:TTntStrings);
var
i:integer;
@@ -105,9 +119,9 @@
begin
case Capability of
CAP_IMPORT:
- Result := cTMXImportTitle;
+ Result := Translate(cTMXImportTitle);
CAP_EXPORT:
- Result := cTMXExportTitle;
+ Result := Translate(cTMXExportTitle);
else
Result := '';
end;
@@ -126,7 +140,7 @@
S := TTntStringlist.Create;
try
BuildPreview(Items, S);
- if TfrmExport.Execute(FOrigFile, cTMXExportTitle, cTMXFilter, '.', 'tmx', S) then
+ if TfrmExport.Execute(FOrigFile, Translate(cTMXExportTitle), Translate(cTMXFilter), '.', 'tmx', S) then
begin
S.SaveToFile(FOrigFile);
Result := S_OK;
@@ -141,6 +155,27 @@
end;
end;
+function TTMXParser.GetString(out Section, Name,
+ Value: WideString): WordBool;
+begin
+ Result := true;
+ case FIndex of
+ 0: Value := cTMXFilter;
+ 1: Value := cTMXImportTitle;
+ 2: Value := cTMXExportTitle;
+ else
+ Result := false;
+ end;
+ if Result then
+ begin
+ Section := cSectionName;
+ Name := Value;
+ Inc(FIndex);
+ end
+ else
+ FIndex := 0;
+end;
+
function TTMXParser.ImportItems(const Items, Orphans:ITranslationItems):HRESULT;
type
TFoundItem = (fiOriginal, fiTranslation);
@@ -178,7 +213,7 @@
Items.Clear;
Orphans.Clear;
LoadSettings;
- if TfrmTMXImport.Execute(FOrigFile, FOrigLang, FTransLang, cTMXImportTitle, cTMXFilter, '.', 'tmx') then
+ if TfrmTMXImport.Execute(FOrigFile, FOrigLang, FTransLang, Translate(cTMXImportTitle), Translate(cTMXFilter), '.', 'tmx') then
begin
FXMLImport := TXMLDocument.Create(nil);
try
@@ -247,6 +282,7 @@
procedure TTMXParser.Init(const ApplicationServices:IApplicationServices);
begin
Application.Handle := ApplicationServices.AppHandle;
+ FApplicationServices := ApplicationServices;
end;
procedure TTMXParser.LoadSettings;
Modified: translator/trunk/src/ToolKeyCheck/ToolKeyCheck.dof
===================================================================
--- translator/trunk/src/ToolKeyCheck/ToolKeyCheck.dof 2007-10-21 15:43:41 UTC (rev 268)
+++ translator/trunk/src/ToolKeyCheck/ToolKeyCheck.dof 2007-10-21 15:49:52 UTC (rev 269)
@@ -1,81 +1,6 @@
[FileVersion]
Version=7.0
[Compiler]
-A=8
-B=0
-C=1
-D=1
-E=0
-F=0
-G=1
-H=1
-I=1
-J=0
-K=0
-L=1
-M=0
-N=1
-O=1
-P=1
-Q=0
-R=0
-S=0
-T=0
-U=0
-V=1
-W=0
-X=1
-Y=1
-Z=1
-ShowHints=1
-ShowWarnings=1
-UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
-NamespacePrefix=
-SymbolDeprecated=1
-SymbolLibrary=1
-SymbolPlatform=1
-UnitLibrary=1
-UnitPlatform=1
-UnitDeprecated=1
-HResultCompat=1
-HidingMember=1
-HiddenVirtual=1
-Garbage=1
-BoundsError=1
-ZeroNilCompat=1
-StringConstTruncated=1
-ForLoopVarVarPar=1
-TypedConstVarPar=1
-AsgToTypedConst=1
-CaseLabelRange=1
-ForVariable=1
-ConstructingAbstract=1
-ComparisonFalse=1
-ComparisonTrue=1
-ComparingSignedUnsigned=1
-CombiningSignedUnsigned=1
-UnsupportedConstruct=1
-FileOpen=1
-FileOpenUnitSrc=1
-BadGlobalSymbol=1
-DuplicateConstructorDestructor=1
-InvalidDirective=1
-PackageNoLink=1
-PackageThreadVar=1
-ImplicitImport=1
-HPPEMITIgnored=1
-NoRetVal=1
-UseBeforeDef=1
-ForLoopVarUndef=1
-UnitNameMismatch=1
-NoCFGFileFound=1
-MessageDirective=1
-ImplicitVariants=1
-UnicodeToLocale=1
-LocaleToUnicode=1
-ImagebaseMultiple=1
-SuspiciousTypecast=1
-PrivatePropAccessor=1
UnsafeType=0
UnsafeCode=0
UnsafeCast=0
@@ -101,7 +26,7 @@
UsePackages=0
[Parameters]
RunParams=
-HostApplication=C:\Program Files\Borland\projects\Private\translator\trunk\bin\translator.exe
+HostApplication=
Launcher=
UseLauncher=0
DebugCWD=
@@ -128,6 +53,6 @@
LegalTrademarks=
OriginalFilename=ToolKeyCheck.dll
ProductName=IniTranslator
-ProductVersion=1.9.0.50
+ProductVersion=1.9.0.51
Comments=Latest version from http://initranslator.sourceforge.net
CompileDate=den 27 december 2006 00:13
Modified: translator/trunk/src/ToolKeyCheck/ToolKeyCheck.res
===================================================================
(Binary files differ)
Modified: translator/trunk/src/WixPlugin/WixParser.res
===================================================================
(Binary files differ)
Modified: translator/trunk/src/WixPlugin/WixParserImpl.pas
===================================================================
--- translator/trunk/src/WixPlugin/WixParserImpl.pas 2007-10-21 15:43:41 UTC (rev 268)
+++ translator/trunk/src/WixPlugin/WixParserImpl.pas 2007-10-21 15:49:52 UTC (rev 269)
@@ -31,6 +31,8 @@
procedure LoadSettings;
procedure SaveSettings;
procedure BuildPreview(Items:ITranslationItems; Strings:TTntStrings);
+ function GetString(out Section:WideString; out Name:WideString;
+ out Value:WideString):WordBool; safecall;
public
function Capabilities:Integer; safecall;
function Configure(Capability:Integer):HRESULT; safecall;
@@ -38,8 +40,6 @@
function ExportItems(const Items:ITranslationItems; const Orphans:ITranslationItems):HRESULT; safecall;
function ImportItems(const Items:ITranslationItems; const Orphans:ITranslationItems):HRESULT; safecall;
procedure Init(const ApplicationServices:IApplicationServices); safecall;
- function GetString(out Section:WideString; out Name:WideString;
- out Value:WideString):WordBool; safecall;
end;
implementation
@@ -102,9 +102,9 @@
begin
case Capability of
CAP_IMPORT:
- Result := cImportTitle;
+ Result := Translate(cImportTitle);
CAP_EXPORT:
- Result := cExportTitle;
+ Result := Translate(cExportTitle);
else
Result := '';
end;
Modified: translator/trunk/src/XLIFFPlugin/XLIFFParserImpl.pas
===================================================================
--- translator/trunk/src/XLIFFPlugin/XLIFFParserImpl.pas 2007-10-21 15:43:41 UTC (rev 268)
+++ translator/trunk/src/XLIFFPlugin/XLIFFParserImpl.pas 2007-10-21 15:49:52 UTC (rev 269)
@@ -23,15 +23,17 @@
SysUtils, TransIntf;
type
- TXLIFFParser = class(TInterfacedObject, IInterface, IFileParser)
+ TXLIFFParser = class(TInterfacedObject, IInterface, IFileParser, ILocalizable)
private
FOldAppHandle:Cardinal;
+ FIndex:integer;
FApplicationServices:IApplicationServices;
FFilename:WideString;
procedure LoadSettings;
procedure SaveSettings;
function Translate(const Value:WideString):WideString;
-
+ function GetString(out Section: WideString; out Name: WideString;
+ out Value: WideString): WordBool; safecall;
protected
function Capabilities:Integer; safecall;
function Configure(Capability:Integer):HRESULT; safecall;
@@ -41,6 +43,7 @@
function ImportItems(const Items:ITranslationItems;
const Orphans:ITranslationItems):HRESULT; safecall;
procedure Init(const ApplicationServices:IApplicationServices); safecall;
+
public
constructor Create;
destructor Destroy; override;
@@ -62,6 +65,7 @@
cXLIFFImportTitle = 'Import from XLIFF file';
cXLIFFExportTitle = 'Export to XLIFF file';
cXLIFFFilter = 'XLIFF files (*.xlf)|*.xlf|All files (*.*)|*.*';
+ cSectionName = 'XLIFF';
var
XML:WideString = '';
@@ -152,6 +156,27 @@
end;
end;
+function TXLIFFParser.GetString(out Section, Name,
+ Value: WideString): WordBool;
+begin
+ Result := true;
+ case FIndex of
+ 0:Value := cXLIFFFilter;
+ 1:Value := cXLIFFImportTitle;
+ 2:Value := cXLIFFExportTitle;
+ else
+ Result := false;
+ end;
+ if Result then
+ begin
+ Section := cSectionName;
+ Name := Value;
+ Inc(FIndex);
+ end
+ else
+ FIndex := 0;
+end;
+
function TXLIFFParser.ImportItems(const Items, Orphans:ITranslationItems):HRESULT;
type
TFoundItem = (fiOriginal, fiTranslation);
@@ -241,7 +266,7 @@
TargetNode := nil;
TI := Items.Add;
- TI.Section := 'XLIFF';
+ TI.Section := cSectionName;
if Assigned(SourceNode) then
begin
@@ -314,7 +339,7 @@
function TXLIFFParser.Translate(const Value:WideString):WideString;
begin
if FApplicationServices <> nil then
- Result := FApplicationServices.Translate(ClassName, Value, Value)
+ Result := FApplicationServices.Translate(cSectionName, Value, Value)
else
Result := Value;
end;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|