From 4a4b816398add26a704f13af1aa2ff5023df01af Mon Sep 17 00:00:00 2001 From: Vadim Dashevskiy Date: Thu, 24 Oct 2013 14:21:35 +0000 Subject: langpackmgr update, belarusian langpack update (by Jebifor) git-svn-id: http://svn.miranda-ng.org/main/trunk@6607 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- tools/langpackmgr/Unit1.dfm | 228 ++++++++------ tools/langpackmgr/Unit1.pas | 594 ++++++++++++++++------------------- tools/langpackmgr/Unit2.dfm | 79 +++++ tools/langpackmgr/Unit2.pas | 89 ++++++ tools/langpackmgr/lpmanager.dpr | 21 ++ tools/langpackmgr/lpmanager.dproj | 196 ++++++++++++ tools/langpackmgr/lpmanager_Icon.ico | Bin 0 -> 5430 bytes 7 files changed, 782 insertions(+), 425 deletions(-) create mode 100644 tools/langpackmgr/Unit2.dfm create mode 100644 tools/langpackmgr/Unit2.pas create mode 100644 tools/langpackmgr/lpmanager.dpr create mode 100644 tools/langpackmgr/lpmanager.dproj create mode 100644 tools/langpackmgr/lpmanager_Icon.ico (limited to 'tools') diff --git a/tools/langpackmgr/Unit1.dfm b/tools/langpackmgr/Unit1.dfm index 81f4a341d7..90dba5b17b 100644 --- a/tools/langpackmgr/Unit1.dfm +++ b/tools/langpackmgr/Unit1.dfm @@ -1,134 +1,160 @@ object Form1: TForm1 Left = 0 Top = 0 - Caption = 'LangPackMgr' - ClientHeight = 342 - ClientWidth = 785 + BorderIcons = [biSystemMenu, biMinimize] + BorderStyle = bsSingle + Caption = 'Miranda Langpack Manager' + ClientHeight = 286 + ClientWidth = 630 Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'Tahoma' Font.Style = [] - Menu = MainMenu1 OldCreateOrder = False OnCreate = FormCreate PixelsPerInch = 96 TextHeight = 13 object Label1: TLabel - Left = 514 - Top = 320 - Width = 6 + Left = 192 + Top = 16 + Width = 37 Height = 13 - Caption = '0' + Caption = 'Strings:' end - object Button1: TButton - Left = 631 - Top = 308 - Width = 146 - Height = 25 - Caption = 'Save and refresh' + object Label2: TLabel + Left = 192 + Top = 35 + Width = 60 + Height = 13 + Caption = 'Untranslate:' + end + object Label3: TLabel + Left = 192 + Top = 54 + Width = 46 + Height = 13 + Caption = 'Changes:' + end + object Memo1: TMemo + Left = 168 + Top = 88 + Width = 449 + Height = 80 + Font.Charset = RUSSIAN_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Verdana' + Font.Style = [] + ParentFont = False + ScrollBars = ssHorizontal TabOrder = 0 - TabStop = False - OnClick = Button1Click end - object Button2: TButton - Left = 8 - Top = 308 - Width = 146 - Height = 25 - Caption = 'Custom Plugins' + object RadioGroup1: TRadioGroup + Left = 360 + Top = 9 + Width = 257 + Height = 73 + Caption = 'Available translations' + Columns = 2 + Font.Charset = RUSSIAN_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Verdana' + Font.Style = [] + ParentFont = False TabOrder = 1 - TabStop = False - OnClick = Button2Click + OnClick = RadioGroup1Click end - object BitBtn1: TBitBtn - Left = 160 - Top = 308 - Width = 41 - Height = 25 - Caption = 'Copy' + object ComboBox1: TComboBox + Left = 8 + Top = 8 + Width = 154 + Height = 21 + Style = csDropDownList TabOrder = 2 - TabStop = False - OnClick = BitBtn1Click + OnChange = ComboBox1Change end - object BitBtn2: TBitBtn - Left = 207 - Top = 308 - Width = 42 - Height = 25 - Caption = 'Google:' + object Memo2: TMemo + Left = 168 + Top = 176 + Width = 449 + Height = 80 + Font.Charset = RUSSIAN_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Verdana' + Font.Style = [] + ParentFont = False + ScrollBars = ssHorizontal TabOrder = 3 - TabStop = False - OnClick = BitBtn2Click end - object BitBtn3: TBitBtn - Left = 279 - Top = 308 - Width = 50 - Height = 25 - Caption = 'Clear' + object StringGrid1: TStringGrid + Left = 8 + Top = 35 + Width = 154 + Height = 247 + ColCount = 1 + DefaultColWidth = 150 + DefaultRowHeight = 14 + FixedCols = 0 + RowCount = 1 + FixedRows = 0 + Font.Charset = RUSSIAN_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Verdana' + Font.Style = [] + ParentFont = False + ScrollBars = ssVertical TabOrder = 4 - TabStop = False - OnClick = BitBtn3Click + OnClick = Click + OnDrawCell = Draw end - object ListBox1: TListBox - Left = 8 - Top = 8 - Width = 146 - Height = 294 - TabStop = False - Enabled = False - ItemHeight = 13 + object Button2: TButton + Left = 239 + Top = 262 + Width = 58 + Height = 20 + Caption = 'Google' + Font.Charset = RUSSIAN_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Verdana' + Font.Style = [] + ParentFont = False TabOrder = 5 - OnClick = ListBox1Click + OnClick = Button2Click end - object ListBox2: TListBox - Left = 631 - Top = 8 - Width = 146 - Height = 294 - ItemHeight = 13 + object Button3: TButton + Left = 559 + Top = 262 + Width = 58 + Height = 20 + Caption = 'Save' + Font.Charset = RUSSIAN_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Verdana' + Font.Style = [] + ParentFont = False TabOrder = 6 - OnClick = ListBox2Click + OnClick = Button3Click end - object Edit1: TEdit - Left = 255 - Top = 312 - Width = 18 - Height = 21 + object Button1: TButton + Left = 168 + Top = 262 + Width = 58 + Height = 20 + Caption = 'Copy' + Font.Charset = RUSSIAN_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Verdana' + Font.Style = [] + ParentFont = False TabOrder = 7 - Text = 'be' - end - object Memo1: TMemo - Left = 160 - Top = 8 - Width = 465 - Height = 144 - ScrollBars = ssHorizontal - TabOrder = 8 - end - object Memo2: TMemo - Left = 160 - Top = 158 - Width = 465 - Height = 144 - ScrollBars = ssHorizontal - TabOrder = 9 - end - 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 + OnClick = Button1Click end end diff --git a/tools/langpackmgr/Unit1.pas b/tools/langpackmgr/Unit1.pas index a0083263d2..5267e27673 100644 --- a/tools/langpackmgr/Unit1.pas +++ b/tools/langpackmgr/Unit1.pas @@ -4,327 +4,177 @@ interface uses 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; + System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, + Vcl.StdCtrls, Vcl.ExtCtrls, Vcl.Grids, ShellApi; type TForm1 = class(TForm) - - SaveTextFileDialog1: TSaveTextFileDialog; - - MainMenu1: TMainMenu; - File1: TMenuItem; - Open1: TMenuItem; - - ListBox1: TListBox; - ListBox2: TListBox; - Button1: TButton; Button2: TButton; - - BitBtn1: TBitBtn; - BitBtn2: TBitBtn; - BitBtn3: TBitBtn; - Edit1: TEdit; + Button3: TButton; Label1: TLabel; + Label2: TLabel; + Label3: TLabel; Memo1: TMemo; Memo2: TMemo; + RadioGroup1: TRadioGroup; + ComboBox1: TComboBox; + StringGrid1: TStringGrid; - 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 Click(Sender: TObject); procedure Button1Click(Sender: TObject); - procedure BitBtn3Click(Sender: TObject); + procedure Button2Click(Sender: TObject); + procedure Button3Click(Sender: TObject); + procedure viewline; + procedure RadioGroup1Click(Sender: TObject); + procedure ComboBox1Change(Sender: TObject); + procedure Draw(Sender: TObject; ACol, ARow: Integer; Rect: TRect; + State: TGridDrawState); + + private { Private declarations } - public { Public declarations } end; var Form1: TForm1; - openDialog : TOpenDialog; openfile:textfile; + lang,stmp: string; + str: array [0..40,0..6000] of string; + ffile:array [0..6000] of string; + core: array [0..30] of string; + l:array [0..6000] of integer; + ns:array [0..6000] of boolean; + ii,i,n:integer; - 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 {$R *.dfm} procedure TForm1.FormCreate(Sender: TObject); -begin - 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.ListBox1Click(Sender: TObject); -begin - 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.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 ilmemo2.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; - viewline; -end; -/////////////////////////////////////////////////////////////////////////////// -procedure TForm1.Open1Click(Sender: TObject); -begin - 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.progress; -begin - 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.listfiles; -Var +var SR:TSearchRec; Res:Integer; - i:integer; begin - 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 + combobox1.Items.Clear; + combobox1.Items.Add('=CORE='); + 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); + Form1.comboBox1.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 + FindClose(SR); + + 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); + Form1.comboBox1.Items.Add('w|'+copy(extractfilename(SR.Name), + 1,length(extractfilename(SR.Name))-4)); + Res:=FindNext(SR); end; - end; -end; -// копирование шаблона///////////////////////////////////////////////////////// -procedure TForm1.BitBtn1Click(Sender: TObject); -begin -memo2.Lines:=memo1.Lines; -end; -// гугл ////////////////////////////////////////////////////////// -procedure TForm1.BitBtn2Click(Sender: TObject); + FindClose(SR); + end; + + + +procedure TForm1.Button2Click(Sender: TObject); + var str:string; i:integer; begin - 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'') then + begin + writeln(openfile, str[0,fi]); + writeln(openfile, str[1,fi]); + end; + end; + CloseFile(openfile); end; -procedure TForm1.BitBtn3Click(Sender: TObject); +procedure TForm1.Button1Click(Sender: TObject); begin - memo1.Lines.Clear; - memo2.Lines.Clear; - st[iindex,adres[listbox2.ItemIndex]]:=''; - viewline; + memo2.Lines:=memo1.Lines; end; -// флаг переключения ////////////////////////////////////////////////////////// - - -procedure TForm1.Button2Click(Sender: TObject); +procedure TForm1.Click(Sender: TObject); +var sa:integer; da:string; begin - if button2.Caption='Custom Plugins' - then button2.Caption:='Core and basic' - else button2.Caption:='Custom Plugins'; - listfiles; - if ListBox1.enabled=true then - parsing; + da:=str[1,l[ii]]; + str[1,l[ii]]:=''; + for sa:=0 to memo2.Lines.Count-1 do +begin + str[1,l[ii]]:=str[1,l[ii]]+memo2.Lines[sa]; + if sa<>memo2.Lines.Count-1 then str[1,l[ii]]:=str[1,l[ii]]+'\n'; +end; + if str[1,l[ii]]<>da then ns[ii]:=true; +memo1.Lines.clear; +memo2.Lines.clear; +viewline; +ii:=stringgrid1.Row; +stringgrid1.rowcount:=stringgrid1.rowcount+1; +stringgrid1.rowcount:=stringgrid1.rowcount-1; end; + procedure tform1.viewline; var im,m:integer; +untranslate,changes: integer; sse:string; begin - m:=1; sse:=copy(se[iindex,lineindex[listbox2.itemindex]],2, - length(se[iindex,lineindex[listbox2.itemindex]])-2); + m:=1; + if RadioGroup1.itemindex=0 + then + sse:=copy(str[0,l[stringgrid1.row]],2, length(str[0,l[stringgrid1.row]])-2) + else + sse:=str[2,l[stringgrid1.row]]; for im := 1 to length(sse)-1 do begin if copy(sse,im,2)='\n' then @@ -335,74 +185,170 @@ begin 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 + if str[1,l[stringgrid1.row]]<>'' then begin m:=1; - for im := 1 to length(st[iindex,adres[listbox2.ItemIndex]])-1 do + for im := 1 to length(str[1,l[stringgrid1.row]])-1 do begin - if copy(st[iindex,adres[listbox2.ItemIndex]],im,2)='\n' then + if copy(str[1,l[stringgrid1.row]],im,2)='\n' then begin - memo2.Lines.Add(copy(st[iindex,adres[listbox2.ItemIndex]],m,im-m)); + memo2.Lines.Add(copy(str[1,l[stringgrid1.row]],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)); + if m=1 then memo2.Lines.Add(str[1,l[stringgrid1.row]]) + else memo2.Lines.Add(copy(str[1,l[stringgrid1.row]],m, + length(str[1,l[stringgrid1.row]])-m+2)); end; - memo2.SetFocus; + + changes:=0; + for im:= 0 to stringgrid1.rowcount-1 do + if ns[im]=true then changes:=changes+1; + label2.Caption:='Changes:'+inttostr(changes); + untranslate:=0; + for im:= 0 to stringgrid1.rowcount-1 do + if str[1,l[im]]='' then untranslate:=untranslate+1; + label3.Caption:='Untranslate:'+inttostr(untranslate); + end; -/////////////////////////////////////////////////////////////////////////////// -/// -// Процедура сохранения обработанного файла -procedure TForm1.Button1Click(Sender: TObject); -var il,index:integer; + +procedure TForm1.ComboBox1Change(Sender: TObject); + 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 ilmemo2.Lines.Count-1 then - st[iindex,adres[index]]:= - st[iindex,adres[index]]+'\n'; - il:=il+1; + for n:=0 to 40 do str[n,i]:=''; + l[i]:=0; + ns[i]:=false; + memo1.Lines.Clear; + memo2.Lines.Clear; end; + if ComboBox1.Text='=CORE=' then + assignfile(openfile,ExtractFilePath(Application.ExeName)+ + '\english\=CORE=.txt',CP_UTF8); + if copy(ComboBox1.Text,1,2)='w|' then + assignfile(openfile,ExtractFilePath(Application.ExeName)+ + '\english\weather\'+copy(ComboBox1.Text,3,length(ComboBox1.Text)-2)+'.txt',CP_UTF8); + if copy(ComboBox1.Text,1,2)='p|' then + assignfile(openfile,ExtractFilePath(Application.ExeName)+ + '\english\plugins\'+copy(ComboBox1.Text,3,length(ComboBox1.Text)-2)+'.txt',CP_UTF8); + reset(openfile); + readln(openfile,stmp); + str[0,0]:=stmp; + stringgrid1.Rowcount:=0; + n:=0; +while not eof(openfile) do +begin + n:=n+1; + readln(openfile,stmp); + str[0,n]:=stmp; + if copy(stmp,1,1)='[' then + begin + l[stringgrid1.Rowcount-1]:=n; + stringgrid1.Cells[0,stringgrid1.Rowcount-1]:=stmp; + stringgrid1.Rowcount:=stringgrid1.Rowcount+1; end; +end; +////////////////////////////////////////////////////////// + +if RadioGroup1.Items.Count=2 then +begin + if ComboBox1.Text='=CORE=' then + assignfile(openfile,ExtractFilePath(Application.ExeName)+ + '\'+RadioGroup1.Items[1]+'\=CORE=.txt',CP_UTF8); + if copy(ComboBox1.Text,1,2)='w|' then + assignfile(openfile,ExtractFilePath(Application.ExeName)+'\' + +RadioGroup1.Items[1]+ + '\weather\'+copy(ComboBox1.Text,3,length(ComboBox1.Text)-2)+'.txt',CP_UTF8); + if copy(ComboBox1.Text,1,2)='p|' then + assignfile(openfile,ExtractFilePath(Application.ExeName)+'\' + +RadioGroup1.Items[1]+ + '\plugins\'+copy(ComboBox1.Text,3,length(ComboBox1.Text)-2)+'.txt',CP_UTF8); + reset(openfile); + readln(openfile); + n:=0; + while not eof(openfile) do +begin + readln(openfile,ffile[n]); + n:=n+1; +end; +for i := 0 to stringgrid1.Rowcount do +for ii := 0 to n-1 do +if ffile[ii]=stringgrid1.cells[0,i] then +str[2,l[i]]:=ffile[ii+1]; +end; +/////////////////////////////////////// +////////////////////////////////////////////////////////// + if ComboBox1.Text='=CORE=' then + assignfile(openfile,ExtractFilePath(Application.ExeName)+ + '\'+form1.Caption+'\=CORE=.txt',CP_UTF8); + if copy(ComboBox1.Text,1,2)='w|' then + assignfile(openfile,ExtractFilePath(Application.ExeName)+'\'+form1.Caption+ + '\weather\'+copy(ComboBox1.Text,3,length(ComboBox1.Text)-2)+'.txt',CP_UTF8); + if copy(ComboBox1.Text,1,2)='p|' then + assignfile(openfile,ExtractFilePath(Application.ExeName)+'\'+form1.Caption+ + '\plugins\'+copy(ComboBox1.Text,3,length(ComboBox1.Text)-2)+'.txt',CP_UTF8); + reset(openfile); + readln(openfile); + n:=0; + while not eof(openfile) do +begin + readln(openfile,ffile[n]); + n:=n+1; +end; +for i := 0 to stringgrid1.Rowcount do +for ii := 0 to n-1 do +if ffile[ii]=stringgrid1.cells[0,i] then +str[1,l[i]]:=ffile[ii+1]; +//////////////////////////////////////////////////////////////// + + +stringgrid1.Rowcount:=stringgrid1.Rowcount-1; +label1.Caption:='Strings:'+inttostr(stringgrid1.Rowcount); + +ii:=0; +viewline; +end; + +procedure TForm1.Draw(Sender: TObject; ACol, ARow: Integer; Rect: TRect; + State: TGridDrawState); +Var + StringGrid: TStringGrid; + Can: TCanvas; +begin + StringGrid := Sender as TStringGrid; + Can := StringGrid.Canvas; Can.Font := StringGrid.Font; + if (ARow >= StringGrid.FixedRows) and (ACol >= StringGrid.FixedCols) + then Can.Brush.Color := StringGrid.Color + else Can.Brush.Color := StringGrid.FixedColor; + if str[1,l[ARow]]='' then Can.Brush.Color:=clRed; + if ns[arow]=true then Can.Brush.Color:=clGreen; + Can.FillRect(Rect); + Can.TextOut(Rect.Left+2,Rect.Top+2, StringGrid.Cells[ACol, ARow]); +end; + +procedure TForm1.RadioGroup1Click(Sender: TObject); +var m,im:integer; +sse:string; +begin 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 - if copy(se[iindex,ii],1,1)=';' then writeln(openfile,se[iindex,ii]); - if (copy(se[iindex,ii],1,1)='[') and (st[iindex,ii]<>'') + m:=1; + if RadioGroup1.itemindex=0 then - begin - writeln(openfile,se[iindex,ii]); - writeln(openfile,st[iindex,ii]); - end; - end; -closefile(openfile); -// - parsing; + sse:=copy(str[0,l[stringgrid1.row]],2, length(str[0,l[stringgrid1.row]])-2) + else + sse:=str[2,l[stringgrid1.row]]; + 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)); end; + end. diff --git a/tools/langpackmgr/Unit2.dfm b/tools/langpackmgr/Unit2.dfm new file mode 100644 index 0000000000..1f6cb2313f --- /dev/null +++ b/tools/langpackmgr/Unit2.dfm @@ -0,0 +1,79 @@ +object Form2: TForm2 + Left = 0 + Top = 0 + BorderIcons = [] + Caption = 'Select the language' + ClientHeight = 151 + ClientWidth = 205 + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Tahoma' + Font.Style = [] + OldCreateOrder = False + OnCreate = FormCreate + PixelsPerInch = 96 + TextHeight = 13 + object Label1: TLabel + Left = 8 + Top = 8 + Width = 89 + Height = 13 + Caption = 'Editable language:' + end + object Label2: TLabel + Left = 8 + Top = 62 + Width = 113 + Height = 13 + Caption = 'Languages to compare:' + end + object ComboBox1: TComboBox + Left = 8 + Top = 27 + Width = 185 + Height = 22 + Style = csOwnerDrawFixed + TabOrder = 0 + OnChange = ComboBox1Change + end + object CheckBox1: TCheckBox + Left = 137 + Top = 61 + Width = 56 + Height = 17 + Caption = 'english' + Checked = True + Enabled = False + State = cbChecked + TabOrder = 1 + end + object Button1: TButton + Left = 103 + Top = 118 + Width = 89 + Height = 25 + Caption = 'Start' + Enabled = False + TabOrder = 2 + OnClick = Button1Click + end + object Button2: TButton + Left = 8 + Top = 118 + Width = 89 + Height = 25 + Caption = 'Cancel' + TabOrder = 3 + OnClick = Button2Click + end + object ComboBox2: TComboBox + Left = 8 + Top = 84 + Width = 185 + Height = 22 + Style = csOwnerDrawFixed + TabOrder = 4 + end +end diff --git a/tools/langpackmgr/Unit2.pas b/tools/langpackmgr/Unit2.pas new file mode 100644 index 0000000000..b71163e1aa --- /dev/null +++ b/tools/langpackmgr/Unit2.pas @@ -0,0 +1,89 @@ +unit Unit2; + +interface + +uses + Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, + Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.CheckLst, unit1; + +type + TForm2 = class(TForm) + ComboBox1: TComboBox; + CheckBox1: TCheckBox; + Button1: TButton; + Label1: TLabel; + Label2: TLabel; + Button2: TButton; + ComboBox2: TComboBox; + procedure Button1Click(Sender: TObject); + procedure FormCreate(Sender: TObject); + procedure ComboBox1Change(Sender: TObject); + procedure Button2Click(Sender: TObject); + private + { Private declarations } + public + { Public declarations } + end; + +var + Form2: TForm2; + n:integer; +implementation + +{$R *.dfm} + +procedure TForm2.Button1Click(Sender: TObject); +begin +form1.caption:=ComboBox1.text; +form1.RadioGroup1.Items.Add('english'); +if combobox2.text<>'' then +form1.RadioGroup1.Items.Add(combobox2.text); +form1.RadioGroup1.ItemIndex:=0; +form1.showmodal; +form2.Close; +end; + +procedure TForm2.Button2Click(Sender: TObject); +begin +form2.Close; +end; + +procedure TForm2.ComboBox1Change(Sender: TObject); +var i:integer; +begin + combobox2.Items.Clear; + for i :=0 to combobox1.ItemHeight+5 do // не понял зачем +5 + if i<>combobox1.ItemIndex then + combobox2.Items.Add(combobox1.Items[i]); + button1.Enabled:=true; +end; + +procedure TForm2.FormCreate(Sender: TObject); +var + SR:TSearchRec; + Res:Integer; +begin + +Res:=FindFirst(ExtractFilePath(Application.ExeName)+'*', faAnyFile, SR); +while Res = 0 do +begin +if ((SR.Attr and faDirectory)=faDirectory) and ((SR.Name='.')or(SR.Name='..')) then +begin +Res:=FindNext(SR); +Continue; +end; +if ((SR.Attr and faDirectory)=faDirectory) then +begin +if (fileexists(ExtractFilePath(Application.ExeName)+'/'+SR.Name+'/=HEAD=.txt')) +and (sr.Name<>'english') then +begin +Form2.combobox1.Items.Add(SR.Name); + +end; +end; +Res:=FindNext(SR); +end; +FindClose(SR); +end; + +end. diff --git a/tools/langpackmgr/lpmanager.dpr b/tools/langpackmgr/lpmanager.dpr new file mode 100644 index 0000000000..876548f6f7 --- /dev/null +++ b/tools/langpackmgr/lpmanager.dpr @@ -0,0 +1,21 @@ +program lpmanager; + +uses + Vcl.Forms, + Unit1 in 'Unit1.pas' {Form1}, + Unit2 in 'Unit2.pas' {Form2}; + +{ 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(TForm2, Form2); + Application.CreateForm(TForm1, Form1); + Application.Run; +end. diff --git a/tools/langpackmgr/lpmanager.dproj b/tools/langpackmgr/lpmanager.dproj new file mode 100644 index 0000000000..4125de70fd --- /dev/null +++ b/tools/langpackmgr/lpmanager.dproj @@ -0,0 +1,196 @@ +п»ї + + {2DD0A017-C6BD-47BC-89F3-19A1F4372290} + 14.6 + VCL + lpmanager.dpr + True + Release + Win32 + 3 + Application + + + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + true + Cfg_1 + true + true + + + true + Base + true + + + true + Cfg_2 + true + true + + + 1049 + CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= + None + $(BDS)\bin\delphi_PROJECTICON.ico + System;Xml;Data;Datasnap;Web;Soap;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace) + .\$(Platform)\$(Config) + .\..\..\langpacks + false + false + false + false + false + + + 1033 + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) + $(BDS)\bin\default_app.manifest + CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= + true + bindcompfmx;DBXSqliteDriver;vcldbx;rtl;dbrtl;DbxClientDriver;IndySystem;bindcomp;inetdb;inetdbbde;DBXInterBaseDriver;DataSnapClient;DataSnapCommon;DBXOdbcDriver;DataSnapServer;DataSnapProviderClient;xmlrtl;svnui;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;svn;DBXSybaseASADriver;bdertl;dbexpress;adortl;DataSnapIndy10ServerTransport;IndyIPClient;$(DCC_UsePackage) + + + 1033 + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) + $(BDS)\bin\default_app.manifest + CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= + true + 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 + + + 1033 + true + false + + + RELEASE;$(DCC_Define) + 0 + false + + + CompanyName=;FileDescription=;FileVersion=0.0.1.1;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= + $(BDS)\bin\default_app.manifest + true + 1 + true + 1 + 0 + 1059 + true + lpmanager_Icon.ico + + + + MainSource + + +
Form1
+ dfm +
+ +
Form2
+ dfm +
+ + 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 + + + + + + + + + + + + + + + + + + lpmanager.dpr + + + Microsoft Office 2000 Sample Automation Server Wrapper Components + Microsoft Office XP Sample Automation Server Wrapper Components + + + + + True + True + + + 12 + + + +
diff --git a/tools/langpackmgr/lpmanager_Icon.ico b/tools/langpackmgr/lpmanager_Icon.ico new file mode 100644 index 0000000000..297ce84a9f Binary files /dev/null and b/tools/langpackmgr/lpmanager_Icon.ico differ -- cgit v1.2.3