diff options
Diffstat (limited to 'tools/langpackmgr')
-rw-r--r-- | tools/langpackmgr/Unit1.dfm | 194 | ||||
-rw-r--r-- | tools/langpackmgr/Unit1.pas | 558 | ||||
-rw-r--r-- | tools/langpackmgr/langpackmgr.dpr | 2 | ||||
-rw-r--r-- | tools/langpackmgr/langpackmgr.dproj | 54 |
4 files changed, 450 insertions, 358 deletions
diff --git a/tools/langpackmgr/Unit1.dfm b/tools/langpackmgr/Unit1.dfm index a854b4bd2d..81f4a341d7 100644 --- a/tools/langpackmgr/Unit1.dfm +++ b/tools/langpackmgr/Unit1.dfm @@ -1,144 +1,134 @@ object Form1: TForm1
Left = 0
Top = 0
- BiDiMode = bdLeftToRight
- BorderIcons = [biSystemMenu, biMinimize]
- Caption = 'Miranda NG Langpack Manager'
- ClientHeight = 323
- ClientWidth = 679
+ Caption = 'LangPackMgr'
+ ClientHeight = 342
+ ClientWidth = 785
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
+ Menu = MainMenu1
OldCreateOrder = False
- ParentBiDiMode = False
OnCreate = FormCreate
- OnKeyDown = enter
PixelsPerInch = 96
TextHeight = 13
object Label1: TLabel
- Left = 8
- Top = 19
- Width = 20
- Height = 13
- Caption = 'File:'
- end
- object Label2: TLabel
- Left = 328
- Top = 19
+ Left = 514
+ Top = 320
Width = 6
Height = 13
- Caption = '1'
+ Caption = '0'
end
- object Label3: TLabel
- Left = 356
- Top = 19
- Width = 3
- Height = 13
- end
- object ListBox1: TListBox
- Left = 478
- Top = 38
- Width = 193
- Height = 277
- ItemHeight = 13
+ object Button1: TButton
+ Left = 631
+ Top = 308
+ Width = 146
+ Height = 25
+ Caption = 'Save and refresh'
TabOrder = 0
- OnClick = ListBox1Click
+ TabStop = False
+ OnClick = Button1Click
end
- object Edit1: TEdit
- Left = 37
- Top = 11
- Width = 204
- Height = 21
- Enabled = False
+ object Button2: TButton
+ Left = 8
+ Top = 308
+ Width = 146
+ Height = 25
+ Caption = 'Custom Plugins'
TabOrder = 1
+ TabStop = False
+ OnClick = Button2Click
end
- object Button1: TButton
- Left = 247
- Top = 7
- Width = 75
+ object BitBtn1: TBitBtn
+ Left = 160
+ Top = 308
+ Width = 41
Height = 25
- Caption = 'OPEN'
+ Caption = 'Copy'
TabOrder = 2
- OnClick = Button1Click
+ TabStop = False
+ OnClick = BitBtn1Click
end
- object Button2: TButton
- Left = 480
- Top = 7
- Width = 193
+ object BitBtn2: TBitBtn
+ Left = 207
+ Top = 308
+ Width = 42
Height = 25
- Caption = 'SAVE AND REFRESH'
+ Caption = 'Google:'
TabOrder = 3
- OnClick = Button2Click
+ TabStop = False
+ OnClick = BitBtn2Click
end
- object C: TBitBtn
- Left = 8
- Top = 290
- Width = 27
+ object BitBtn3: TBitBtn
+ Left = 279
+ Top = 308
+ Width = 50
Height = 25
- Hint = 'Copy Original'
- Caption = 'C'
- ParentShowHint = False
- ShowHint = True
+ Caption = 'Clear'
TabOrder = 4
- OnClick = CClick
+ TabStop = False
+ OnClick = BitBtn3Click
end
- object X: TBitBtn
- Left = 74
- Top = 290
- Width = 27
- Height = 25
- Hint = 'Clear Translate'
- Caption = 'X'
- ParentShowHint = False
- ShowHint = True
+ object ListBox1: TListBox
+ Left = 8
+ Top = 8
+ Width = 146
+ Height = 294
+ TabStop = False
+ Enabled = False
+ ItemHeight = 13
TabOrder = 5
- OnClick = XClick
+ OnClick = ListBox1Click
end
- object G: TBitBtn
- Left = 41
- Top = 290
- Width = 27
- Height = 25
- Hint = 'Google Translator'
- Caption = 'G'
- ParentShowHint = False
- ShowHint = True
+ object ListBox2: TListBox
+ Left = 631
+ Top = 8
+ Width = 146
+ Height = 294
+ ItemHeight = 13
TabOrder = 6
- OnClick = GClick
+ OnClick = ListBox2Click
end
- object Memo1: TMemo
- Left = 8
- Top = 38
- Width = 466
- Height = 120
- ScrollBars = ssBoth
+ object Edit1: TEdit
+ Left = 255
+ Top = 312
+ Width = 18
+ Height = 21
TabOrder = 7
+ Text = 'be'
end
- object Memo2: TMemo
- Left = 8
- Top = 156
- Width = 466
- Height = 120
- ScrollBars = ssBoth
+ object Memo1: TMemo
+ Left = 160
+ Top = 8
+ Width = 465
+ Height = 144
+ ScrollBars = ssHorizontal
TabOrder = 8
end
- object T: TBitBtn
- Left = 447
- Top = 290
- Width = 27
- Height = 25
- Hint = 'Enable On Top'
- Caption = 'T'
- ParentShowHint = False
- ShowHint = True
+ object Memo2: TMemo
+ Left = 160
+ Top = 158
+ Width = 465
+ Height = 144
+ ScrollBars = ssHorizontal
TabOrder = 9
- OnClick = TClick
end
- object OpenDialog1: TOpenDialog
- Left = 448
- Top = 7
+ object MainMenu1: TMainMenu
+ Left = 512
+ Top = 309
+ object File1: TMenuItem
+ Caption = 'File'
+ object Open1: TMenuItem
+ Caption = 'Open'
+ OnClick = Open1Click
+ end
+ end
+ end
+ object SaveTextFileDialog1: TSaveTextFileDialog
+ Left = 480
+ Top = 309
end
end
diff --git a/tools/langpackmgr/Unit1.pas b/tools/langpackmgr/Unit1.pas index eea9890b32..a0083263d2 100644 --- a/tools/langpackmgr/Unit1.pas +++ b/tools/langpackmgr/Unit1.pas @@ -3,40 +3,50 @@ 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, ShellApi;
+ Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
+ System.Classes, Vcl.Graphics,
+ Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.Menus, Vcl.ExtDlgs, Vcl.StdCtrls,
+ Vcl.CheckLst, Vcl.ComCtrls, Vcl.Buttons, ShellApi;
type
TForm1 = class(TForm)
- Label1: TLabel;
- Label2: TLabel;
- Label3: TLabel;
- Edit1: TEdit;
+
+ SaveTextFileDialog1: TSaveTextFileDialog;
+
+ MainMenu1: TMainMenu;
+ File1: TMenuItem;
+ Open1: TMenuItem;
+
+ ListBox1: TListBox;
+ ListBox2: TListBox;
+
Button1: TButton;
Button2: TButton;
- ListBox1: TListBox;
- OpenDialog1: TOpenDialog;
- X: TBitBtn;
- C: TBitBtn;
- G: TBitBtn;
+
+ BitBtn1: TBitBtn;
+ BitBtn2: TBitBtn;
+ BitBtn3: TBitBtn;
+ Edit1: TEdit;
+ Label1: TLabel;
Memo1: TMemo;
Memo2: TMemo;
- T: TBitBtn;
+
+ procedure Open1Click(Sender: TObject); // процедура выбора файла =head=
procedure FormCreate(Sender: TObject);
+ procedure Button2Click(Sender: TObject); // переключатель
+ procedure ListBox1Click(Sender: TObject);// выбор обрабатываемого файла
+ procedure listfiles;// получение списка файлов в listbox
+ procedure progress; // парсинг текущего файла перевода
+ procedure parsing;// общий прогресс проверки перевода
+ procedure ListBox2Click(Sender: TObject);
+ procedure viewline;
+ procedure BitBtn1Click(Sender: TObject);
+ procedure BitBtn2Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
- procedure Button2Click(Sender: TObject);
- procedure ListBox1Click(Sender: TObject);
- procedure CClick(Sender: TObject);
- procedure XClick(Sender: TObject);
- procedure refresh;
- procedure read;
- procedure enter(Sender: TObject; var Key: Word; Shift: TShiftState);
- procedure GClick(Sender: TObject);
- procedure TClick(Sender: TObject);
-
-
+ procedure BitBtn3Click(Sender: TObject);
private
{ Private declarations }
+
public
{ Public declarations }
end;
@@ -44,249 +54,355 @@ type var
Form1: TForm1;
openDialog : TOpenDialog;
- full,ustring,tstring,fline: array [1..9999] of string;
- notranslate: array [1..9999] of integer;
- translate: textfile;
- bom, line:string;
- ii,i,it,ie:integer;
-implementation
+ openfile:textfile;
-{$R *.dfm}
-// Открытие файла
+ stmp: string; // название текущего файла перевода
+ lang: string; // выбранный перевод
+ sfull: array [0..6000] of string; // считывается выбранный перевод
+ ifull: integer; // строк в выбранном переводе
+ se: array [0..200,0..6000] of string; // английский файл перевода
+ st: array [0..200,0..6000] of string; // строки перевода
+ sfilter:array [1..30] of string; // названия файлов основного перевода
+ ifilter: integer; // количество файлов основного перевода
+ bfilter: boolean; // флаг файла основного перевода
+ n,t:integer; // всего строк/переведено строк
+ il,ii,iindex:integer; // счетчики
+ newlines:boolean;
+ adres: array [0..6000]of integer;
+ ilines: array [0..200] of integer; // строк в файле
+ nlines: array [0..200] of integer; // всего строк для перевода
+ tlines: array [0..200] of integer; // строк переведено
+ lineindex: array [0..2000] of integer;
+implementation
-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')
-then
- begin
- edit1.Text:=copy(openDialog.filename,
- length(ExtractFilePath(Application.ExeName))-4,
- length(openDialog.filename)-length(ExtractFilePath(Application.ExeName))+5);
- read;
- refresh;
- end;
-end;
+{$R *.dfm}
-// Процедура сохранения обработанного файла
-procedure TForm1.Button2Click(Sender: TObject);
+procedure TForm1.FormCreate(Sender: TObject);
begin
-refresh;
-memo2.Lines.Clear;
-assignfile(translate,opendialog.filename,CP_UTF8);
-rewrite(translate);
-writeLn(translate, bom);
- for i := 1 to ie do
- begin
- if copy(ustring[i],1,1)=';' then writeln(translate,ustring[i]);
- if (copy(ustring[i],1,1)='[') and (tstring[i]<>'')
- then begin
- writeln(translate,ustring[i]);
- writeln(translate,tstring[i]);
- end;
- end;
-closefile(translate);
-//
- read;
+ assignfile(openfile,ExtractFilePath(Application.ExeName)+
+ '\corebasic.txt',CP_UTF8);
+ reset(openfile);
+ readln(openfile);
+ ifilter:=0;
+ while not eof(openfile) do
+ begin
+ ifilter:=ifilter+1;
+ readln(openfile,sfilter[ifilter]);
+ end;
+ listfiles;
end;
-
-procedure TForm1.CClick(Sender: TObject);
+///////////////////////////////////////////////////////////////////////////////
+procedure TForm1.ListBox1Click(Sender: TObject);
begin
-memo2.Lines:=memo1.Lines;
+ iindex:=ListBox1.ItemIndex;
+ listbox2.Items.Clear;
+ memo1.Lines.Clear;
+ memo1.Lines.add('Plugin:'+listbox1.Items[iindex]);
+ memo1.Lines.add('Lines:'+inttostr(tlines[iindex])
+ +'/'+inttostr(nlines[iindex]));
+ memo1.Lines.add('Completed:'
+ +copy(floattostr(100*tlines[iindex]/nlines[iindex]),1,4)+'%');
+ il:=-1;
+ for ii:=0 to ilines[iindex] do
+ begin
+ if (copy(se[iindex,ii],1,1)='[') and (st[iindex,ii]='') then
+ begin
+ listbox2.Items.add(se[iindex,ii]);
+ adres[listbox2.items.Count-1]:=ii;
+ il:=il+1;
+ lineindex[il]:=ii;
+ end;
+ end;
end;
-
-procedure TForm1.XClick(Sender: TObject);
+///////////////////////////////////////////////////////////////////////////////
+procedure TForm1.ListBox2Click(Sender: TObject);
+var il,index:integer;
begin
+ index:=strtoint(label1.Caption)-1;
+ if index<>-1 then
+ begin
+ // запись строки
+ if memo2.Lines.Count=memo1.Lines.Count then
+ st[iindex,adres[index]]:='';
+ il:=0;
+ while il<memo2.Lines.Count do
+ begin
+ st[iindex,adres[index]]:=
+ st[iindex,adres[index]]+memo2.lines[il];
+ if il<>memo2.Lines.Count-1 then
+ st[iindex,adres[index]]:=
+ st[iindex,adres[index]]+'\n';
+ il:=il+1;
+ end;
+ end;
+ label1.Caption:=inttostr(listbox2.ItemIndex+1);
+ memo1.Lines.Clear;
memo2.Lines.Clear;
- tstring[notranslate[strtoint(label2.caption)]]:='';
- refresh;
+ viewline;
end;
-
-procedure TForm1.enter(Sender: TObject; var Key: Word;
- Shift: TShiftState);
+///////////////////////////////////////////////////////////////////////////////
+procedure TForm1.Open1Click(Sender: TObject);
begin
-case key of
- vk_down: if listbox1.ItemIndex<listbox1.Items.Count then
- begin listbox1.ItemIndex:=listbox1.ItemIndex+1; refresh; end;
- vk_up: if listbox1.ItemIndex>0 then
- begin listbox1.ItemIndex:=listbox1.ItemIndex-1; refresh; end;
+ chdir(ExtractFilePath(Application.ExeName));
+ opendialog:=TOpenDialog.Create(self);
+ opendialog.filter:='Langpack Head File|=HEAD=.txt';
+ opendialog.initialDir:=GetCurrentDir;
+ opendialog.options:=[ofFileMustExist];
+ if (opendialog.execute) then
+ begin
+ lang:=copy(openDialog.filename,
+ length(ExtractFilePath(Application.ExeName))+1,
+ length(openDialog.filename)-
+ length(ExtractFilePath(Application.ExeName))-11);
+ chdir(ExtractFilePath(openDialog.filename));
+ form1.Caption:='LangPackMgr: '+lang;
+ ListBox1.enabled:=true;
+ parsing;
+ end;
end;
+///////////////////////////////////////////////////////////////////////////////
+procedure tform1.parsing;
+begin
+ memo1.lines.clear;
+ listbox2.Items.clear;
+ n:=0;t:=0;
+ for iindex:=0 to listbox1.items.Count-1 do
+ progress;
+ if button2.Caption='Custom Plugins'
+ then memo1.Lines.Add('Language:'+lang+' (Standart Bulid)')
+ else memo1.Lines.Add('Language:'+lang+' (Custom Plugins)');
+ memo1.Lines.Add('Translated:'+copy(floattostr(100*t/n),1,4)+'%');
end;
-
-procedure TForm1.ListBox1Click(Sender: TObject);
+///////////////////////////////////////////////////////////////////////////////
+procedure tform1.progress;
begin
- refresh;
+ if copy(listbox1.Items[iindex],1,2)='=C' then
+ stmp:='=CORE=' else
+ if copy(listbox1.Items[iindex],1,2)='p|' then
+ stmp:='\plugins\'+copy(listbox1.Items[iindex],3,
+ length(listbox1.Items[iindex])-2) else
+ if copy(listbox1.Items[iindex],1,2)='w|' then
+ stmp:='\weather\'+copy(listbox1.Items[iindex],3,
+ length(listbox1.Items[iindex])-2);
+//
+ for ifull := 0 to 4000 do sfull[ifull]:='';
+ if fileexists(ExtractFilePath(Application.ExeName)
+ +'\'+lang+'\'+stmp+'.txt') then
+ begin
+ assignfile(openfile,ExtractFilePath(Application.ExeName)
+ +'\'+lang+'\'+stmp+'.txt',CP_UTF8);
+ reset(openfile);
+ ifull:=0;
+ while not Eof(openfile) do
+ begin
+ ifull:=ifull+1;
+ ReadLn(openfile,sfull[ifull]);
+ end;
+ closefile(openfile);
+ end;
+ for ii := 0 to 6000 do st[iindex,ii]:='';
+ assignfile(openfile,ExtractFilePath(Application.ExeName)
+ +'\english\'+stmp+'.txt',CP_UTF8);
+ reset(openfile);
+ ilines[iindex]:=-1;
+ nlines[iindex]:=0;
+ tlines[iindex]:=0;
+ while not Eof(openfile) do
+ begin
+ ilines[iindex]:=ilines[iindex]+1;
+ ReadLn(openfile,se[iindex,ilines[iindex]]);
+ if (copy(se[iindex,ilines[iindex]],1,1)='[') then
+ begin
+ nlines[iindex]:= nlines[iindex]+1;
+ for ii:=0 to ifull-1 do
+ if se[iindex,ilines[iindex]]=sfull[ii] then
+ if (copy(sfull[ii+1],1,1)<>';')
+ and(copy(sfull[ii+1],1,1)<>'[')
+ and(copy(sfull[ii+1],1,1)<>'')
+ then
+ begin
+ st[iindex,ilines[iindex]]:=sfull[ii+1];
+ tlines[iindex]:=tlines[iindex]+1;
+ end;
+ end;
+ end;
+ closefile(openfile);
+ n:=n+nlines[iindex];
+ t:=t+tlines[iindex];
end;
-
-procedure TForm1.FormCreate(Sender: TObject);
+///////////////////////////////////////////////////////////////////////////////
+procedure tform1.listfiles;
+Var
+ SR:TSearchRec;
+ Res:Integer;
+ i:integer;
begin
- KeyPreview := True;
+ n:=0;t:=0;
+ ListBox1.Items.Clear;
+ if button2.Caption='Custom Plugins' then
+ begin
+ Form1.ListBox1.Items.Add('=CORE=');
+ for i := 1 to ifilter do
+ Form1.ListBox1.Items.Add('p|'+sfilter[i]);
+ end else
+ begin
+ // plugins
+ Res:=FindFirst(ExtractFilePath(Application.ExeName)
+ +'\english\plugins\*.txt', faAnyFile, SR);
+ while Res = 0 do
+ begin
+ bfilter:=false;
+ for i:=1 to ifilter do
+ if sfilter[i]=copy(extractfilename(SR.Name),
+ 1,length(extractfilename(SR.Name))-4) then bfilter:=true;
+ if bfilter=false then
+ Form1.ListBox1.Items.Add('p|'+copy(extractfilename(SR.Name),
+ 1,length(extractfilename(SR.Name))-4));
+ Res:=FindNext(SR);
+ end;
+ FindClose(SR);
+ // weather
+ Res:=FindFirst(ExtractFilePath(Application.ExeName)
+ +'\english\weather\*.txt', faAnyFile, SR);
+ while Res = 0 do
+ begin
+ Form1.ListBox1.Items.Add('w|'+copy(extractfilename(SR.Name),
+ 1,length(extractfilename(SR.Name))-4));
+ Res:=FindNext(SR);
+ end;
+ end;
end;
-
-procedure TForm1.GClick(Sender: TObject);
-var str:string;
+// копирование шаблона/////////////////////////////////////////////////////////
+procedure TForm1.BitBtn1Click(Sender: TObject);
+begin
+memo2.Lines:=memo1.Lines;
+end;
+// гугл //////////////////////////////////////////////////////////
+procedure TForm1.BitBtn2Click(Sender: TObject);
+var str:string; i:integer;
begin
- str:='http://translate.google.com/?hl=&ie=&langpair=en&text=';
-for I := 0 to memo1.Lines.Count-1 do
+ str:='http://translate.google.com/?hl=&ie=&langpair=en#en/'+edit1.Text+'/';
+for i:=0 to memo1.Lines.Count-1 do
begin
str:=str+memo1.Lines[i];
if i<memo1.Lines.Count-1 then
str:=str+'+%0A+';
end;
+
ShellExecute(0, 'open',PChar(str), nil, nil, SW_SHOW);
end;
-procedure tform1.refresh;
-var m,n:integer;
-begin
-n:=strtoint(label2.caption);
-//
-if memo2.Lines.Count=memo1.Lines.Count then
-begin
-tstring[notranslate[n]]:='';
-for I := 0 to memo2.Lines.Count-1 do
+procedure TForm1.BitBtn3Click(Sender: TObject);
begin
-tstring[notranslate[n]]:=tstring[notranslate[n]]+memo2.Lines[i];
-if i<memo2.Lines.Count-1 then
-tstring[notranslate[n]]:=tstring[notranslate[n]]+'\n';
-end;
-end;
-memo1.Lines.Clear;
-////////////////////////////////////////////////////////////
-label2.Caption:=inttostr(ListBox1.ItemIndex+1);
-n:=strtoint(label2.caption);
-memo2.Lines.Clear;
-if tstring[notranslate[n]]<>'' then
-begin
-m:=1;
-for i := 1 to length(tstring[notranslate[n]])-1 do
-begin
- if copy(tstring[notranslate[n]],i,2)='\n' then
- begin
- memo2.Lines.Add(copy(tstring[notranslate[n]],m,i-m));
- m:=i+2;
- end;
-end;
- if m=1
- then memo2.Lines.Add(tstring[notranslate[n]])
- else memo2.Lines.Add(copy(tstring[notranslate[n]],
- m,length(tstring[notranslate[n]])-m+2));
-end;
-////////////////////////////////////////////////////////////
-m:=1;
-for i := 1 to length(copy(ustring[notranslate[n]],2,length(ustring[notranslate[n]])-2))-1 do
-begin
- if copy(copy(ustring[notranslate[n]],2,length(ustring[notranslate[n]])-2),i,2)='\n' then
- begin
- memo1.Lines.Add(copy(copy(ustring[notranslate[n]],2,length(ustring[notranslate[n]])-2),m,i-m));
- m:=i+2;
- end;
-end;
- if m=1 then memo1.Lines.Add(copy(ustring[notranslate[n]],2,length(ustring[notranslate[n]])-2))
- else memo1.Lines.Add(copy(copy(ustring[notranslate[n]],2,length(ustring[notranslate[n]])-2),
- m,length(copy(ustring[notranslate[n]],2,length(ustring[notranslate[n]])-2))-m+1));
-memo2.SetFocus;
+ memo1.Lines.Clear;
+ memo2.Lines.Clear;
+ st[iindex,adres[listbox2.ItemIndex]]:='';
+ viewline;
end;
+// флаг переключения //////////////////////////////////////////////////////////
-procedure TForm1.TClick(Sender: TObject);
+procedure TForm1.Button2Click(Sender: TObject);
begin
-if form1.formstyle=fsnormal
-then
- begin
-t.Hint:='Disable On Top';
-form1.formstyle:=fsstayontop;
- end
-else
- begin
-t.Hint:='Enable On Top';
-form1.formstyle:=fsnormal;
- end;
+ if button2.Caption='Custom Plugins'
+ then button2.Caption:='Core and basic'
+ else button2.Caption:='Custom Plugins';
+ listfiles;
+ if ListBox1.enabled=true then
+ parsing;
end;
-procedure tform1.read;
+procedure tform1.viewline;
+var im,m:integer;
+sse:string;
begin
- listbox1.Items.Clear;
- line:='';
- for i:= 1 to 9999 do
- begin
- full[i]:='';
- notranslate[i]:=0;
- ustring[i]:='';
- tstring[i]:='';
+ m:=1; sse:=copy(se[iindex,lineindex[listbox2.itemindex]],2,
+ length(se[iindex,lineindex[listbox2.itemindex]])-2);
+ for im := 1 to length(sse)-1 do
+ begin
+ if copy(sse,im,2)='\n' then
+ begin
+ memo1.Lines.Add(copy(sse,m,im-m));
+ m:=im+2;
+ end;
+ end;
+ if m=1 then memo1.Lines.Add(sse)
+ else memo1.Lines.Add(copy(sse,m,length(sse)-m+2));
+
+ if st[iindex,adres[listbox2.ItemIndex]]<>'' then
+ begin
+ m:=1;
+ for im := 1 to length(st[iindex,adres[listbox2.ItemIndex]])-1 do
+ begin
+ if copy(st[iindex,adres[listbox2.ItemIndex]],im,2)='\n' then
+ begin
+ memo2.Lines.Add(copy(st[iindex,adres[listbox2.ItemIndex]],m,im-m));
+ m:=im+2;
+ end;
+ end;
+ if m=1 then memo2.Lines.Add(st[iindex,adres[listbox2.ItemIndex]])
+ else memo2.Lines.Add(copy(st[iindex,adres[listbox2.ItemIndex]],m,
+ length(st[iindex,adres[listbox2.ItemIndex]])-m+2));
+ end;
+ memo2.SetFocus;
+end;
+///////////////////////////////////////////////////////////////////////////////
+///
+
+// Процедура сохранения обработанного файла
+procedure TForm1.Button1Click(Sender: TObject);
+var il,index:integer;
+begin
+ index:=strtoint(label1.Caption)-1;
+ if index<>-1 then
+ begin
+ // запись строки
+ if memo2.Lines.Count=memo1.Lines.Count then
+ st[iindex,adres[index]]:='';
+ il:=0;
+ while il<memo2.Lines.Count do
+ begin
+ st[iindex,adres[index]]:=
+ st[iindex,adres[index]]+memo2.lines[il];
+ if il<>memo2.Lines.Count-1 then
+ st[iindex,adres[index]]:=
+ st[iindex,adres[index]]+'\n';
+ il:=il+1;
+ end;
end;
-// Считывание выбранного файла в full[it]
- assignfile(translate,opendialog.filename,CP_UTF8);
- reset(translate);
- it:=0;
- while not Eof(translate) do
+memo1.Lines.Clear;
+memo2.Lines.Clear;
+ if copy(listbox1.Items[iindex],1,2)='=C' then
+ stmp:='=CORE=' else
+ if copy(listbox1.Items[iindex],1,2)='p|' then
+ stmp:='\plugins\'+copy(listbox1.Items[iindex],3,
+ length(listbox1.Items[iindex])-2) else
+ if copy(listbox1.Items[iindex],1,2)='w|' then
+ stmp:='\weather\'+copy(listbox1.Items[iindex],3,
+ length(listbox1.Items[iindex])-2);
+assignfile(openfile,ExtractFilePath(Application.ExeName)
+ +'\'+lang+'\'+stmp+'.txt',CP_UTF8);
+rewrite(openfile);
+writeLn(openfile,se[iindex,0]);
+ for ii := 1 to ilines[iindex] do
begin
- ReadLn(translate, line);
- if (copy(line,1,1)='[') and (not Eof(translate)) then
+ if copy(se[iindex,ii],1,1)=';' then writeln(openfile,se[iindex,ii]);
+ if (copy(se[iindex,ii],1,1)='[') and (st[iindex,ii]<>'')
+ 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;
+ writeln(openfile,se[iindex,ii]);
+ writeln(openfile,st[iindex,ii]);
end;
end;
-closefile(translate);
-
-if extractfilename(opendialog.filename)='=CORE=.txt' then
-assignfile(translate,ExtractFilePath(Application.ExeName)+
-'\..\english\'+extractfilename(opendialog.filename),CP_UTF8)
-else
- if fileexists(ExtractFilePath(Application.ExeName)+
-'\..\english\plugins\'+extractfilename(opendialog.filename)) then
-assignfile(translate,ExtractFilePath(Application.ExeName)+
-'\..\english\plugins\'+extractfilename(opendialog.filename),CP_UTF8)
-else
- if fileexists(ExtractFilePath(Application.ExeName)+
-'\..\english\weather\'+extractfilename(opendialog.filename)) then
-assignfile(translate,ExtractFilePath(Application.ExeName)+
-'\..\english\weather\'+extractfilename(opendialog.filename),CP_UTF8);
- reset(translate);
- ReadLn(translate, bom);
- ie:=0;
-while not Eof(translate) do
- begin
- ReadLn(translate, line);
- ie:=ie+1;
- ustring[ie]:=line;
- end;
- closefile(translate);
-for i := 1 to ie do
- for ii:= 1 to it-1 do
- if ustring[i]=full[ii]
- then tstring[i]:=full[ii+1];
-for i := 1 to ie do
-if (copy(ustring[i],1,1)='[') and (tstring[i]='') then
-begin
-listbox1.Items.Add(ustring[i]);
-notranslate[listbox1.Items.Count]:=i;
-end;
-label3.caption:=' of '+inttostr(listbox1.Items.Count)+' untranslate lines.';
-refresh;
+closefile(openfile);
+//
+ parsing;
end;
end.
diff --git a/tools/langpackmgr/langpackmgr.dpr b/tools/langpackmgr/langpackmgr.dpr index 69d75469eb..e112488cdd 100644 --- a/tools/langpackmgr/langpackmgr.dpr +++ b/tools/langpackmgr/langpackmgr.dpr @@ -1,4 +1,4 @@ -program langpackmgr;
+program LangPackMgr;
uses
Vcl.Forms,
diff --git a/tools/langpackmgr/langpackmgr.dproj b/tools/langpackmgr/langpackmgr.dproj index ae6d778f09..db9e5ea4d5 100644 --- a/tools/langpackmgr/langpackmgr.dproj +++ b/tools/langpackmgr/langpackmgr.dproj @@ -1,9 +1,9 @@ п»ї<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
- <ProjectGuid>{09EFF320-8309-4D4B-A78A-3B3997206B39}</ProjectGuid>
+ <ProjectGuid>{0EBDA2CA-166A-4A20-9D10-AC4E99A83991}</ProjectGuid>
<ProjectVersion>14.6</ProjectVersion>
<FrameworkType>VCL</FrameworkType>
- <MainSource>langpackmgr.dpr</MainSource>
+ <MainSource>LangPackMgr.dpr</MainSource>
<Base>True</Base>
<Config Condition="'$(Config)'==''">Release</Config>
<Platform Condition="'$(Platform)'==''">Win32</Platform>
@@ -18,11 +18,6 @@ <CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
- <PropertyGroup Condition="('$(Platform)'=='Win64' and '$(Base)'=='true') or '$(Base_Win64)'!=''">
- <Base_Win64>true</Base_Win64>
- <CfgParent>Base</CfgParent>
- <Base>true</Base>
- </PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_1)'!=''">
<Cfg_1>true</Cfg_1>
<CfgParent>Base</CfgParent>
@@ -46,8 +41,14 @@ <Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Base)'!=''">
- <Icon_MainIcon>langpackmgr.ico</Icon_MainIcon>
+ <VerInfo_MajorVer>2</VerInfo_MajorVer>
+ <VerInfo_Locale>2057</VerInfo_Locale>
+ <VerInfo_PreRelease>true</VerInfo_PreRelease>
+ <Manifest_File>None</Manifest_File>
+ <VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=2.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=2.0.0.0;Comments=</VerInfo_Keys>
+ <VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
<DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace)</DCC_Namespace>
+ <Icon_MainIcon>$(BDS)\bin\delphi_PROJECTICON.ico</Icon_MainIcon>
<DCC_DcuOutput>.\$(Platform)\$(Config)</DCC_DcuOutput>
<DCC_ExeOutput>.\$(Platform)\$(Config)</DCC_ExeOutput>
<DCC_E>false</DCC_E>
@@ -57,20 +58,12 @@ <DCC_K>false</DCC_K>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_Win32)'!=''">
- <VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
+ <DCC_UsePackage>bindcompfmx;DBXSqliteDriver;vcldbx;fmx;rtl;dbrtl;DbxClientDriver;IndySystem;TeeDB;bindcomp;inetdb;vclib;inetdbbde;DBXInterBaseDriver;DataSnapClient;DataSnapCommon;DBXOdbcDriver;DataSnapServer;Tee;DataSnapProviderClient;xmlrtl;svnui;ibxpress;DbxCommonDriver;DBXSybaseASEDriver;vclimg;IndyProtocols;dbxcds;DBXMySQLDriver;DatasnapConnectorsFreePascal;MetropolisUILiveTile;vclactnband;bindengine;vcldb;soaprtl;bindcompdbx;vcldsnap;bindcompvcl;FMXTee;TeeUI;vclie;vcltouch;DBXDb2Driver;websnap;DBXOracleDriver;CustomIPTransport;vclribbon;VclSmp;dsnap;IndyIPServer;DBXInformixDriver;Intraweb;IndyCore;vcl;DataSnapConnectors;IndyIPCommon;CloudService;DBXMSSQLDriver;dsnapcon;DBXFirebirdDriver;FmxTeeUI;inet;vclx;inetdbxpress;webdsnap;svn;DBXSybaseASADriver;bdertl;dbexpress;adortl;DataSnapIndy10ServerTransport;IndyIPClient;$(DCC_UsePackage)</DCC_UsePackage>
<Manifest_File>$(BDS)\bin\default_app.manifest</Manifest_File>
<DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace>
- <VerInfo_Locale>1033</VerInfo_Locale>
<VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
- <DCC_UsePackage>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</DCC_UsePackage>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Base_Win64)'!=''">
- <VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
- <Manifest_File>$(BDS)\bin\default_app.manifest</Manifest_File>
- <DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace)</DCC_Namespace>
<VerInfo_Locale>1033</VerInfo_Locale>
- <VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
- <DCC_UsePackage>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)</DCC_UsePackage>
+ <VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_1)'!=''">
<DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
@@ -81,9 +74,6 @@ <DCC_RemoteDebug>true</DCC_RemoteDebug>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_1_Win32)'!=''">
- <DCC_ExeOutput>D:\Delphi\langpacks\tool\</DCC_ExeOutput>
- <VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
- <VerInfo_Locale>1033</VerInfo_Locale>
<DCC_RemoteDebug>false</DCC_RemoteDebug>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2)'!=''">
@@ -93,14 +83,16 @@ <DCC_DebugInformation>false</DCC_DebugInformation>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2_Win32)'!=''">
- <VerInfo_MinorVer>1</VerInfo_MinorVer>
- <VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.1.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
+ <VerInfo_MajorVer>2</VerInfo_MajorVer>
<VerInfo_PreRelease>true</VerInfo_PreRelease>
- <Manifest_File>None</Manifest_File>
- <DCC_DcuOutput>.\</DCC_DcuOutput>
+ <VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=2.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=2.0.0.0;Comments=</VerInfo_Keys>
+ <DCC_ExeOutput>.\..\..\langpacks\</DCC_ExeOutput>
+ <DCC_DcuOutput>.\..\..\langpacks\</DCC_DcuOutput>
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
+ <Icon_MainIcon>langpackmgr.ico</Icon_MainIcon>
<VerInfo_Locale>1033</VerInfo_Locale>
- <DCC_ExeOutput>..\..\langpacks\tool\</DCC_ExeOutput>
+ <DCC_AssertionsAtRuntime>false</DCC_AssertionsAtRuntime>
+ <DCC_ImportedDataReferences>false</DCC_ImportedDataReferences>
</PropertyGroup>
<ItemGroup>
<DelphiCompile Include="$(MainSource)">
@@ -108,6 +100,7 @@ </DelphiCompile>
<DCCReference Include="Unit1.pas">
<Form>Form1</Form>
+ <FormType>dfm</FormType>
</DCCReference>
<BuildConfiguration Include="Release">
<Key>Cfg_2</Key>
@@ -154,21 +147,15 @@ <VersionInfoKeys Name="Comments"/>
<VersionInfoKeys Name="CFBundleName"/>
<VersionInfoKeys Name="CFBundleDisplayName"/>
- <VersionInfoKeys Name="UIDeviceFamily"/>
<VersionInfoKeys Name="CFBundleIdentifier"/>
<VersionInfoKeys Name="CFBundleVersion"/>
<VersionInfoKeys Name="CFBundlePackageType"/>
<VersionInfoKeys Name="CFBundleSignature"/>
<VersionInfoKeys Name="CFBundleAllowMixedLocalizations"/>
- <VersionInfoKeys Name="UISupportedInterfaceOrientations"/>
<VersionInfoKeys Name="CFBundleExecutable"/>
- <VersionInfoKeys Name="CFBundleResourceSpecification"/>
- <VersionInfoKeys Name="LSRequiresIPhoneOS"/>
- <VersionInfoKeys Name="CFBundleInfoDictionaryVersion"/>
- <VersionInfoKeys Name="CFBundleDevelopmentRegion"/>
</VersionInfoKeys>
<Source>
- <Source Name="MainSource">langpackmgr.dpr</Source>
+ <Source Name="MainSource">LangPackMgr.dpr</Source>
</Source>
<Excluded_Packages>
<Excluded_Packages Name="$(BDSBIN)\dcloffice2k180.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>
@@ -178,7 +165,6 @@ <Deployment/>
<Platforms>
<Platform value="Win32">True</Platform>
- <Platform value="Win64">False</Platform>
</Platforms>
</BorlandProject>
<ProjectFileVersion>12</ProjectFileVersion>
|