From 852df1e2fd8a0e220065b0eb1443b3e834101531 Mon Sep 17 00:00:00 2001 From: Vadim Dashevskiy Date: Mon, 24 Jun 2013 12:14:21 +0000 Subject: - langpackmgr tool source code (by Jebifor) git-svn-id: http://svn.miranda-ng.org/main/trunk@5116 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- tools/langpackmgr/Unit1.dfm | 120 +++++++++++++ tools/langpackmgr/Unit1.pas | 340 ++++++++++++++++++++++++++++++++++++ tools/langpackmgr/langpackmgr.dpr | 21 +++ tools/langpackmgr/langpackmgr.dproj | 185 ++++++++++++++++++++ tools/langpackmgr/langpackmgr.ico | Bin 0 -> 5430 bytes 5 files changed, 666 insertions(+) create mode 100644 tools/langpackmgr/Unit1.dfm create mode 100644 tools/langpackmgr/Unit1.pas create mode 100644 tools/langpackmgr/langpackmgr.dpr create mode 100644 tools/langpackmgr/langpackmgr.dproj create mode 100644 tools/langpackmgr/langpackmgr.ico (limited to 'tools') diff --git a/tools/langpackmgr/Unit1.dfm b/tools/langpackmgr/Unit1.dfm new file mode 100644 index 0000000000..7edf9ac297 --- /dev/null +++ b/tools/langpackmgr/Unit1.dfm @@ -0,0 +1,120 @@ +object Form1: TForm1 + Left = 0 + Top = 0 + BorderIcons = [biSystemMenu] + Caption = 'Miranda NG Langpack Manager' + ClientHeight = 219 + ClientWidth = 684 + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Tahoma' + Font.Style = [] + OldCreateOrder = False + OnCreate = FormCreate + OnKeyDown = enter + PixelsPerInch = 96 + TextHeight = 13 + object Label1: TLabel + Left = 8 + Top = 8 + Width = 20 + Height = 13 + Caption = 'File:' + end + object Label2: TLabel + Left = 455 + Top = 8 + Width = 6 + Height = 13 + Caption = '1' + end + object Label3: TLabel + Left = 8 + Top = 188 + Width = 3 + Height = 13 + end + object ListBox1: TListBox + Left = 488 + Top = 3 + Width = 193 + Height = 214 + ItemHeight = 13 + TabOrder = 0 + OnClick = ListBox1Click + end + object Edit1: TEdit + Left = 45 + Top = 5 + Width = 316 + Height = 21 + Enabled = False + TabOrder = 1 + end + object Button1: TButton + Left = 374 + Top = 3 + Width = 75 + Height = 25 + Caption = 'OPEN' + TabOrder = 2 + OnClick = Button1Click + end + object Button2: TButton + Left = 336 + Top = 176 + Width = 146 + Height = 25 + Caption = 'SAVE AND REFRESH' + TabOrder = 3 + OnClick = Button2Click + end + object C: TBitBtn + Left = 455 + Top = 64 + Width = 27 + Height = 25 + Caption = 'C' + TabOrder = 4 + OnClick = CClick + end + object X: TBitBtn + Left = 455 + Top = 127 + Width = 27 + Height = 25 + Caption = 'X' + TabOrder = 5 + OnClick = XClick + end + object Edit2: TEdit + Left = 8 + Top = 66 + Width = 441 + Height = 21 + TabOrder = 6 + end + object Edit3: TEdit + Left = 8 + Top = 129 + Width = 441 + Height = 21 + TabOrder = 7 + OnEnter = FormCreate + end + object Button3: TButton + Left = 240 + Top = 176 + Width = 75 + Height = 25 + Caption = 'DUPES ON' + TabOrder = 8 + OnClick = Button3Click + end + object OpenDialog1: TOpenDialog + Left = 192 + Top = 176 + end +end diff --git a/tools/langpackmgr/Unit1.pas b/tools/langpackmgr/Unit1.pas new file mode 100644 index 0000000000..59c76c06b0 --- /dev/null +++ b/tools/langpackmgr/Unit1.pas @@ -0,0 +1,340 @@ +unit Unit1; + +interface + +uses + Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, + Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtDlgs, Vcl.StdCtrls, Vcl.Buttons; + +type + TForm1 = class(TForm) + Label1: TLabel; + ListBox1: TListBox; + OpenDialog1: TOpenDialog; + Edit1: TEdit; + Button1: TButton; + Button2: TButton; + C: TBitBtn; + X: TBitBtn; + Label2: TLabel; + Edit2: TEdit; + Edit3: TEdit; + Label3: TLabel; + Button3: TButton; + procedure Button1Click(Sender: TObject); + procedure FormCreate(Sender: TObject); + procedure ListBox1Click(Sender: TObject); + procedure refresh; + procedure read; + procedure enter(Sender: TObject; var Key: Word; Shift: TShiftState); + procedure CClick(Sender: TObject); + procedure XClick(Sender: TObject); + procedure Button2Click(Sender: TObject); + procedure Button3Click(Sender: TObject); + + private + { Private declarations } + public + { Public declarations } + end; + +var + Form1: TForm1; + openDialog : TOpenDialog; + full: array [1..7000] of string; + notranslate: array [1..7000] of integer; + ustring,tstring: array [1..7000] of string; + fline:array [1..2,1..7000] of string; + english,translate: textfile; + line:string; + ii,i,it,ie:integer; + bom, bomd:string; + dupes: array [1..7000] of string; + idx,idm:integer; + cores:boolean; +implementation + +{$R *.dfm} +procedure tform1.read; +begin + +if extractfilename(opendialog.filename)='=CORE=.txt' +then button3.Visible:=false +else button3.Visible:=true; + + listbox1.Items.Clear; + line:=''; + edit3.Text:=''; + for i:= 1 to 7000 do + begin + full[i]:=''; + dupes[i]:=''; + notranslate[i]:=0; + ustring[i]:=''; + tstring[i]:=''; + end; + + assignfile(translate,opendialog.filename,CP_UTF8); + reset(translate); + it:=0; + while not Eof(translate) do + begin + ReadLn(translate, line); + if (copy(line,1,1)='[') and (not Eof(translate)) then + begin + it:=it+1; + full[it]:=line; + ReadLn(translate, line); + if (copy(line,1,1)<>'')and(copy(line,1,1)<>';')and(copy(line,1,1)<>'[')then + begin + it:=it+1; + full[it]:=line; + end else it:=it-1; + end; + end; +closefile(translate); + + idm:=0; +if FileExists(ExtractFilePath(opendialog.filename)+'=DUPES=.txt')=true then +begin +assignfile(translate,ExtractFilePath(opendialog.filename)+'=DUPES=.txt',CP_UTF8); +reset(translate); + ReadLn(translate, bomd); + while not Eof(translate) do + begin + ReadLn(translate, line); + if (copy(line,1,1)='[') and (not Eof(translate)) then + begin + idm:=idm+1; + dupes[idm]:=line; + ReadLn(translate, line); + if (copy(line,1,1)<>'')and(copy(line,1,1)<>';')and(copy(line,1,1)<>'[')then + begin idm:=idm+1; dupes[idm]:=line; end + else idm:=idm-1; + end; +end; +closefile(translate); +end; + +if FileExists(ExtractFilePath(opendialog.filename)+'\..\=DUPES=.txt')=true then +begin +assignfile(translate,ExtractFilePath(opendialog.filename)+'\..\=DUPES=.txt',CP_UTF8); +reset(translate); + while not Eof(translate) do + begin + ReadLn(translate, line); + if (copy(line,1,1)='[') and (not Eof(translate)) then + begin + idm:=idm+1; + dupes[idm]:=line; + ReadLn(translate, line); + if (copy(line,1,1)<>'')and(copy(line,1,1)<>';')and(copy(line,1,1)<>'[')then + begin idm:=idm+1; dupes[idm]:=line; end + else idm:=idm-1; + end; +end; +closefile(translate); +end; + +if extractfilename(opendialog.filename)='=CORE=.txt' then +begin +assignfile(english,ExtractFilePath(Application.ExeName)+ +'\..\english\'+extractfilename(opendialog.filename),CP_UTF8); +end +else +begin +assignfile(translate,ExtractFilePath(opendialog.filename)+'\..\=CORE=.txt',CP_UTF8); +reset(translate); + while not Eof(translate) do + begin + ReadLn(translate, line); + if (copy(line,1,1)='[') and (not Eof(translate)) then + begin + idm:=idm+1; + dupes[idm]:=line; + ReadLn(translate, line); + if (copy(line,1,1)<>'')and(copy(line,1,1)<>';')and(copy(line,1,1)<>'[')then + begin + idm:=idm+1; + dupes[idm]:=line; + end else idm:=idm-1; + end; + end; +closefile(translate); + +assignfile(english,ExtractFilePath(Application.ExeName)+ +'\..\english\plugins\'+extractfilename(opendialog.filename),CP_UTF8); +end; + reset(english); + ReadLn(english, bom); + ie:=0; +while not Eof(english) do + begin + ReadLn(english, line); + ie:=ie+1; + ustring[ie]:=line; + end; + closefile(english); + +for i := 1 to ie do +begin + for ii:= 1 to it-1 do +if ustring[i]=full[ii] then tstring[i]:=full[ii+1]; +if copy(ustring[i],1,1)=';' then tstring[i]:=ustring[i]; +end; +for i := 1 to ie do +if tstring[i]='' then +begin + +if (extractfilename(opendialog.filename)='=CORE=.txt') and (idm>0) then + for idx := 1 to idm do + if dupes[idx]=ustring[i] then tstring[i]:=dupes[idx+1]; + +if (extractfilename(opendialog.filename)<>'=CORE=.txt') and (idm>0) +and (button3.Caption='DUPES ON') then + for idx := 1 to idm do + if dupes[idx]=ustring[i] then tstring[i]:=dupes[idx+1]; + +if tstring[i]='' then +begin +listbox1.Items.Add(ustring[i]); +notranslate[listbox1.Items.Count]:=i; +end; +end; + +label3.caption:='Untranslate:'+inttostr(listbox1.Items.Count)+' lines.'; +end; + + +procedure tform1.refresh; +var n:integer; +begin +n:=strtoint(label2.caption); +line:=edit3.Text; +if length(line)<>0 then +tstring[notranslate[n]]:=line; +label2.Caption:=inttostr(ListBox1.ItemIndex+1); +n:=strtoint(label2.caption); +edit2.Text:=copy(ustring[notranslate[n]],2,length(ustring[notranslate[n]])-2); +edit2.SelectAll; +edit2.CopyToClipboard; +edit3.Text:=tstring[notranslate[n]]; +edit3.SetFocus; +end; + + + +procedure TForm1.Button1Click(Sender: TObject); + begin + chdir(ExtractFilePath(Application.ExeName)); + chdir('..'); + openDialog := TOpenDialog.Create(self); + openDialog.Filter := 'Text files only|*.txt'; + openDialog.InitialDir :=GetCurrentDir ; + openDialog.Options := [ofFileMustExist]; + if (openDialog.Execute) + and(extractfilename(openDialog.filename)<>'=HEAD=.txt') + and(extractfilename(openDialog.filename)<>'=DUPES=.txt') + and(extractfilename(openDialog.filename)<>'untranslated.txt') +then + begin + edit1.Text:=copy(openDialog.filename, + length(ExtractFilePath(Application.ExeName))-4, + length(openDialog.filename)-length(ExtractFilePath(Application.ExeName))+5); + read; + refresh; + end; +end; + + + +procedure TForm1.Button2Click(Sender: TObject); +begin +refresh; +assignfile(translate,opendialog.filename,CP_UTF8); +rewrite(translate); +writeLn(translate, bom); + for i := 1 to ie do + if tstring[i]<>'' then + begin +cores:=false; + for idx := 1 to idm do +if (copy(dupes[idx],1,1)='[') +and (dupes[idx]=ustring[i]) +and (Button3.caption='DUPES ON') + then cores:=true; + if cores=false then + begin + writeln(translate,ustring[i]); + if copy(ustring[i],1,1)<>';' then + writeln(translate,tstring[i]); + end; + end; +closefile(translate); + + if (extractfilename(openDialog.filename)='=CORE=.txt') + and (FileExists(ExtractFilePath(opendialog.filename)+'=DUPES=.txt')=true) + then + begin +assignfile(translate,ExtractFilePath(opendialog.filename)+'=DUPES=.txt',CP_UTF8); +rewrite(translate); +writeLn(translate, bomd); +for idx := 1 to idm do +if (copy(dupes[idx],1,1)='[') then + begin cores:=false; + for i := 1 to ie do + if dupes[idx]=ustring[i] then cores:=true; + if cores=true then begin + writeLn(translate, dupes[idx]); + writeLn(translate, dupes[idx+1]); + end; + end; +closefile(translate); + end; + read; +end; + +procedure TForm1.Button3Click(Sender: TObject); +begin +if edit1.Text<>'' then +If Button3.Caption='DUPES OFF' +then Button3.Caption:='DUPES ON' +else Button3.Caption:='DUPES OFF'; +refresh;read;refresh; +end; + +procedure TForm1.CClick(Sender: TObject); +begin + Edit3.text:=edit2.text; +end; + +procedure TForm1.XClick(Sender: TObject); +begin + Edit3.text:=''; + tstring[notranslate[strtoint(label2.caption)]]:=''; + refresh; +end; + +procedure TForm1.enter(Sender: TObject; var Key: Word; + Shift: TShiftState); +begin +case key of + vk_return,vk_down: if listbox1.ItemIndex0 then + listbox1.ItemIndex:=listbox1.ItemIndex-1; +end; +refresh; +end; + +procedure TForm1.ListBox1Click(Sender: TObject); +begin + refresh; +end; + +procedure TForm1.FormCreate(Sender: TObject); +begin + KeyPreview := True; +end; + +end. diff --git a/tools/langpackmgr/langpackmgr.dpr b/tools/langpackmgr/langpackmgr.dpr new file mode 100644 index 0000000000..69d75469eb --- /dev/null +++ b/tools/langpackmgr/langpackmgr.dpr @@ -0,0 +1,21 @@ +program langpackmgr; + +uses + Vcl.Forms, + Windows, + Unit1 in 'Unit1.pas' {Form1}; + +{$SETPEFlAGS IMAGE_FILE_RELOCS_STRIPPED or IMAGE_FILE_DEBUG_STRIPPED or + IMAGE_FILE_LINE_NUMS_STRIPPED or IMAGE_FILE_LOCAL_SYMS_STRIPPED or + IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP or IMAGE_FILE_NET_RUN_FROM_SWAP} + {$WEAKLINKRTTI ON} + {$RTTI EXPLICIT METHODS([]) PROPERTIES([]) FIELDS([])} +{$R *.res} + +begin + Application.Initialize; + Application.MainFormOnTaskbar := True; + Application.Title := 'Miranda LangPack Manager'; + Application.CreateForm(TForm1, Form1); + Application.Run; +end. diff --git a/tools/langpackmgr/langpackmgr.dproj b/tools/langpackmgr/langpackmgr.dproj new file mode 100644 index 0000000000..503e29559a --- /dev/null +++ b/tools/langpackmgr/langpackmgr.dproj @@ -0,0 +1,185 @@ + + + {09EFF320-8309-4D4B-A78A-3B3997206B39} + 14.6 + VCL + langpackmgr.dpr + True + Release + Win32 + 1 + Application + + + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + true + Cfg_1 + true + true + + + true + Base + true + + + true + Cfg_2 + true + true + + + langpackmgr.ico + System;Xml;Data;Datasnap;Web;Soap;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace) + .\$(Platform)\$(Config) + .\$(Platform)\$(Config) + false + false + false + false + false + + + true + $(BDS)\bin\default_app.manifest + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) + 1033 + CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= + bindcompfmx;vcldbx;rtl;dbrtl;IndySystem;bindcomp;DataSnapClient;DataSnapCommon;DBXOdbcDriver;DataSnapServer;DataSnapProviderClient;xmlrtl;svnui;DBXSybaseASEDriver;DbxCommonDriver;vclimg;IndyProtocols;dbxcds;MetropolisUILiveTile;bindcompdbx;vclactnband;bindengine;vcldb;soaprtl;vcldsnap;bindcompvcl;vclie;vcltouch;VclSmp;dsnap;IndyIPServer;IndyCore;vcl;dsnapcon;vclx;inetdbxpress;webdsnap;svn;bdertl;adortl + + + true + $(BDS)\bin\default_app.manifest + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) + 1033 + CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= + bindcompfmx;DBXSqliteDriver;rtl;dbrtl;DbxClientDriver;IndySystem;bindcomp;inetdb;DBXInterBaseDriver;DataSnapClient;DataSnapCommon;DBXOdbcDriver;DataSnapServer;DataSnapProviderClient;xmlrtl;DBXSybaseASEDriver;DbxCommonDriver;vclimg;IndyProtocols;dbxcds;DBXMySQLDriver;DatasnapConnectorsFreePascal;MetropolisUILiveTile;bindcompdbx;vclactnband;bindengine;vcldb;soaprtl;vcldsnap;bindcompvcl;vclie;vcltouch;DBXDb2Driver;DBXOracleDriver;CustomIPTransport;VclSmp;dsnap;IndyIPServer;DBXInformixDriver;IndyCore;vcl;DataSnapConnectors;IndyIPCommon;CloudService;DBXMSSQLDriver;dsnapcon;DBXFirebirdDriver;inet;vclx;inetdbxpress;webdsnap;DBXSybaseASADriver;dbexpress;adortl;DataSnapIndy10ServerTransport;IndyIPClient;$(DCC_UsePackage) + + + DEBUG;$(DCC_Define) + true + false + true + true + true + + + D:\Delphi\langpacks\tool\ + true + 1033 + false + + + false + RELEASE;$(DCC_Define) + 0 + false + + + None + .\ + true + 1033 + ..\..\langpacks\tool\ + + + + MainSource + + +
Form1
+
+ + Cfg_2 + Base + + + Base + + + Cfg_1 + Base + +
+ + Delphi.Personality.12 + + + + + False + False + 1 + 0 + 0 + 0 + False + False + False + False + False + 1049 + 1251 + + + + + 1.0.0.0 + + + + + + 1.0.0.0 + + + + + + + + + + + + + + + + + + langpackmgr.dpr + + + Microsoft Office 2000 Sample Automation Server Wrapper Components + Microsoft Office XP Sample Automation Server Wrapper Components + + + + + True + False + + + 12 + + + +
diff --git a/tools/langpackmgr/langpackmgr.ico b/tools/langpackmgr/langpackmgr.ico new file mode 100644 index 0000000000..297ce84a9f Binary files /dev/null and b/tools/langpackmgr/langpackmgr.ico differ -- cgit v1.2.3