summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorVadim Dashevskiy <watcherhd@gmail.com>2013-12-20 10:45:02 +0000
committerVadim Dashevskiy <watcherhd@gmail.com>2013-12-20 10:45:02 +0000
commit7acd60188e06cde1d82fa2c4774eba8e5dc7b000 (patch)
tree8d292ebc2543aaef4d88e72729d7702a180bb254 /tools
parentc658612fd057e86aa024e9b2de4353e15dbf5fe4 (diff)
LangPackMgr update (from Jebifor)
git-svn-id: http://svn.miranda-ng.org/main/trunk@7295 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'tools')
-rw-r--r--tools/langpackmgr/Unit1.pas284
-rw-r--r--tools/langpackmgr/langpackmgr.lpr4
-rw-r--r--tools/langpackmgr/langpackmgr.lps96
-rw-r--r--tools/langpackmgr/unit1.lfm16
4 files changed, 224 insertions, 176 deletions
diff --git a/tools/langpackmgr/Unit1.pas b/tools/langpackmgr/Unit1.pas
index 6de5df25fc..86a7dae5ed 100644
--- a/tools/langpackmgr/Unit1.pas
+++ b/tools/langpackmgr/Unit1.pas
@@ -15,7 +15,7 @@ type
button2: tbutton;
button3: tbutton;
button4: tbutton;
- CheckBox1: TCheckBox;
+ Label1: TLabel;
memo1: tmemo;
memo2: tmemo;
listbox: tlistbox;
@@ -43,7 +43,9 @@ type
var
form1: tform1;
- locale: string;
+
+ view,locale: string;
+ trlang,trline: TStringList;
z,j,i,l:integer;
sr:tsearchrec;
res:integer;
@@ -51,7 +53,7 @@ var
u:array[0..6000] of integer;
first:string;
filename:string;
- im,m:integer;
+ m:integer;
sse:string;
implementation
@@ -59,8 +61,37 @@ implementation
{ tform1 }
+procedure tform1.formcreate(sender: tobject);
+ var sr:tsearchrec; res:integer;
+begin
+view:='english';
+trlang:=TstringList.Create;
+trline:=TstringList.Create;
+ if (paramstr(1)='-r') then
+ begin
+ form1.caption:='Miranda NG Langpack Tools: Replacer';
+ end
+ else
+ 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)
+ and (fileexists(extractfilepath(application.exename)+
+ '/'+sr.name+'/=head=.txt')) and (sr.name<>'english') then
+ begin
+ ListBox.items.add(sr.name);
+ trlang.add(sr.name);
+ end;
+ res:=findnext(sr);
+ end;
+ SysUtils.FindClose(sr);
-
+ end;
+end;
procedure tform1.stringlist;
var llist:TStringList;
@@ -103,15 +134,17 @@ procedure tform1.stringlist;
procedure tform1.stringview;
begin
- sse:=copy(s[0,u[listbox.itemindex]],2,
- length(s[0,u[listbox.itemindex]])-2);
+ for i:=0 to combobox2.items.count-1 do
+ if view=combobox2.Items[i] then
+ combobox2.itemindex:=i;
+ sse:=trline[combobox2.ItemIndex];
m:=1;
- for im := 1 to length(sse)-1 do
+ for i := 1 to length(sse)-1 do
begin
- if copy(sse,im,2)='\n' then
+ if copy(sse,i,2)='\n' then
begin
- memo1.Lines.Add(copy(sse,m,im-m));
- m:=im+2;
+ memo1.Lines.Add(copy(sse,m,i-m));
+ m:=i+2;
end;
end;
memo2.Lines.Clear;
@@ -121,94 +154,73 @@ procedure tform1.stringview;
if s[1,u[listbox.itemindex]]<>'' then
begin
m:=1;
- for im := 1 to length(s[1,u[listbox.itemindex]])-1 do
+ for i := 1 to length(s[1,u[listbox.itemindex]])-1 do
begin
- if copy(s[1,u[listbox.itemindex]],im,2)='\n' then
+ if copy(s[1,u[listbox.itemindex]],i,2)='\n' then
begin
- memo2.Lines.Add(copy(s[1,u[listbox.itemindex]],m,im-m));
- m:=im+2;
+ memo2.Lines.Add(copy(s[1,u[listbox.itemindex]],m,i-m));
+ m:=i+2;
end;
end;
if m=1 then memo2.Lines.Add(s[1,u[listbox.itemindex]])
else memo2.Lines.Add(copy(s[1,u[listbox.itemindex]],m,
length(s[1,u[listbox.itemindex]])-m+2));
end;
- end;
+ end;
procedure tform1.savestring;
var sa:integer;
-begin
- s[1,u[l]]:='';
- for sa:=0 to memo2.Lines.Count-1 do
- begin
- s[1,u[l]]:=s[1,u[l]]+memo2.Lines[sa];
- if sa<>memo2.Lines.Count-1 then s[1,u[l]]:=s[1,u[l]]+'\n';
- end;
-end;
-
-procedure tform1.formcreate(sender: tobject);
- var
- sr:tsearchrec;
- res:integer;
-begin
- if (paramstr(1)='-r') then
- begin
- form1.caption:='Miranda NG Langpack Tools: Replacer';
-
- end else
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)
- and (fileexists(extractfilepath(application.exename)+
- '/'+sr.name+'/=head=.txt')) and (sr.name<>'english') then
- ListBox.items.add(sr.name);
- res:=findnext(sr);
- end;
- SysUtils.FindClose(sr);
-end;
-
-end;
+ s[1,u[l]]:='';
+ for sa:=0 to memo2.Lines.Count-1 do
+ begin
+ s[1,u[l]]:=s[1,u[l]]+memo2.Lines[sa];
+ if sa<>memo2.Lines.Count-1 then s[1,u[l]]:=s[1,u[l]]+'\n';
+ end;
+ end;
procedure tform1.combobox1change(sender: tobject);
- var
- f:textfile;
+ var f:textfile;
begin
if not FileExists(extractfilePath(application.exename)
+'/'+locale+'/'+combobox1.items[combobox1.itemindex]+'.txt')
- then
+ then
begin
- assignfile(f,extractfilePath(application.exename)
- +'/'+locale+'/'+combobox1.items[combobox1.itemindex]+'.txt');
- rewrite(f);
- closefile(f);
+ assignfile(f,extractfilePath(application.exename)
+ +'/'+locale+'/'+combobox1.items[combobox1.itemindex]+'.txt');
+ rewrite(f);
+ closefile(f);
end;
- stringlist;
- memo1.lines.clear;
- memo2.lines.clear;
+ stringlist;
+ memo1.lines.clear;
+ memo2.lines.clear;
end;
procedure tform1.ComboBox2Change(Sender: TObject);
begin
-
+ view:=combobox2.Text;
+ if (listbox.items.count>0) and (combobox1.items.count>0) then
+ begin
+ savestring;
+ memo1.lines.Clear;
+ memo2.lines.Clear;
+ stringview;
+ end;
end;
procedure tform1.Button1Click(Sender: TObject);
var sList:TStringList;
- begin
- savestring;
- sList:=TstringList.Create;
- sList.add(first);
- for i := 0 to j do
- begin
- if copy(s[0,i],1,1)=';' then
- sList.add(s[0,i]);
- if s[1,i]<>'' then
- begin
+begin
+ savestring;
+ memo1.lines.Clear;
+ memo2.lines.Clear;
+ sList:=TstringList.Create;
+ sList.add(first);
+ for i := 0 to j do
+ begin
+ if copy(s[0,i],1,1)=';' then sList.add(s[0,i]);
+ if s[1,i]<>'' then
+ begin
sList.add(s[0,i]);
sList.add(s[1,i]);
end
@@ -223,11 +235,32 @@ procedure tform1.Button1Click(Sender: TObject);
sList.SavetoFile(extractfilePath(application.exename)
+'/'+locale+'/'+filename+'.txt');
sList.free;
- stringview;
+ stringlist;
+end;
+
+procedure tform1.Button2Click(Sender: TObject);
+ var search:TStringList; q:integer;
+begin
+ search:=TstringList.Create;
+ search.LoadFromFile(extractfilePath(application.exename)+
+ '/'+locale+'/'+'Langpack_'+locale+'.txt');
+ for q := 0 to listbox.items.Count-1 do
+ for i := 1 to search.count-1 do
+ if (s[0,u[q]]=search[i])and(copy(search[i+1],1,1)<>'[')then
+ begin
+ s[1,u[q]]:=search[i+1];
+ break;
+ end;
+ search.free;
+end;
+
+procedure tform1.Button3Click(Sender: TObject);
+begin
+ memo2.lines:=memo1.lines;
end;
procedure tform1.Button4Click(Sender: TObject);
- var str:utf8string; i:integer;
+ var str:widestring; i:integer;
begin
str:='http://translate.google.com/?hl=&ie=yhgg#auto/';
if locale='belarusian' then str:=str+'be/';
@@ -253,52 +286,56 @@ procedure tform1.Button4Click(Sender: TObject);
if locale='ukrainian' then str:=str+'uk/';
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+';
+ 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.Button2Click(Sender: TObject);
- var search:TStringList;
-q:integer;
-begin
-search:=TstringList.Create;
-search.LoadFromFile(extractfilePath(application.exename)+
-'/'+locale+'/'+'Langpack_'+locale+'.txt');
-for q := 0 to listbox.items.Count-1 do
-for i := 1 to search.count-1 do
- if (s[0,u[q]]=search[i])and(copy(search[i+1],1,1)<>'[')then
- begin
- s[1,u[q]]:=search[i+1];
- break;
- end;
-search.free;
-end;
-
-procedure tform1.Button3Click(Sender: TObject);
-begin
-memo2.lines:=memo1.lines;
-end;
-
procedure tform1.ListBox1Click(sender: tobject);
+var search:TStringList; r:integer;
begin
if (form1.caption<>'Miranda NG Langpack Tools: Editor')
then
begin
savestring;
+ search:=tstringlist.Create;
+ combobox2.items.clear;
+ trline.Clear;
+ combobox2.items.add('english');
+ trline.add(copy(s[0,u[listbox.itemindex]],2,
+ length(s[0,u[listbox.itemindex]])-2));
+ for i:=0 to trlang.count-1 do
+ begin
+ if (fileexists(extractfilepath(application.exename)+
+ '/'+trlang[i]+'/'+filename+'.txt'))
+ and(trlang[i]<>locale) then
+ begin
+ search.LoadFromFile(extractfilepath(application.exename)+
+ '/'+trlang[i]+'/'+filename+'.txt');
+ for r:=1 to search.Count-2 do
+ if (search[r]=s[0,u[listbox.itemindex]])
+ and (search[r+1]<>'')
+ and (search[r+1]<>'[')
+ and (search[r+1]<>';')
+ then begin
+ combobox2.items.add(trlang[i]);
+ trline.add(search[r+1]);
+ break;
+ end;
+ end;
+ end;
+ search.free;
+ combobox2.itemindex:=0;
memo1.lines.clear;
memo2.lines.clear;
-{}
stringview;
end;
end;
procedure tform1.listbox2click(sender: tobject);
- var
- sr:tsearchrec;
- res:integer;
+ var sr:tsearchrec; res:integer;
begin
if form1.caption='Miranda NG Langpack Tools: Editor'
then
@@ -308,30 +345,29 @@ begin
ListBox.items.clear;
combobox1.items.add('=CORE=');
res:=findfirst(extractfilepath(application.exename)
- +'\english\plugins\*.txt', faanyfile, sr);
- while res = 0 do
- begin
- combobox1.items.add('plugins\'+copy(extractfilename(sr.name),1,
- length(extractfilename(sr.name))-4));
- res:=findnext(sr);
- end;
- SysUtils.FindClose(sr);
- res:=findfirst(extractfilepath(application.exename)
- +'\english\weather\*.txt', faanyfile, sr);
- while res = 0 do
- begin
- combobox1.items.add('weather\'+copy(extractfilename(sr.name),1,
- length(extractfilename(sr.name))-4));
- res:=findnext(sr);
- end;
- SysUtils.FindClose(sr);
+ +'\english\plugins\*.txt', faanyfile, sr);
+ while res = 0 do
+ begin
+ combobox1.items.add('plugins\'+copy(extractfilename(sr.name),1,
+ length(extractfilename(sr.name))-4));
+ res:=findnext(sr);
+ end;
+ SysUtils.FindClose(sr);
+ res:=findfirst(extractfilepath(application.exename)
+ +'\english\weather\*.txt', faanyfile, sr);
+ while res = 0 do
+ begin
+ combobox1.items.add('weather\'+copy(extractfilename(sr.name),1,
+ length(extractfilename(sr.name))-4));
+ res:=findnext(sr);
+ end;
+ SysUtils.FindClose(sr);
+ combobox1.itemindex:=0;
+ stringlist;
+ if (fileexists(extractfilePath(application.exename)+'/'+locale+'/'
+ +'Langpack_'+locale+'.txt')) then button2.Enabled:=true;
end;
- combobox1.itemindex:=0;
- stringlist;
- if (fileexists(extractfilePath(application.exename)+'/'+locale+'/'
- +'Langpack_'+locale+'.txt')) then button2.Enabled:=true;
-
end;
end.
diff --git a/tools/langpackmgr/langpackmgr.lpr b/tools/langpackmgr/langpackmgr.lpr
index 2de2b5decd..3e8e7cf2ea 100644
--- a/tools/langpackmgr/langpackmgr.lpr
+++ b/tools/langpackmgr/langpackmgr.lpr
@@ -7,8 +7,8 @@ uses
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
- Forms, unit1
- { you can add units after this };
+ Forms, unit1;
+
{$R *.res}
diff --git a/tools/langpackmgr/langpackmgr.lps b/tools/langpackmgr/langpackmgr.lps
index e6fe26509f..e478dbdbb6 100644
--- a/tools/langpackmgr/langpackmgr.lps
+++ b/tools/langpackmgr/langpackmgr.lps
@@ -4,17 +4,16 @@
<PathDelim Value="\"/>
<Version Value="9"/>
<BuildModes Active="Default"/>
- <Units Count="4">
+ <Units Count="5">
<Unit0>
<Filename Value="langpackmgr.lpr"/>
<IsPartOfProject Value="True"/>
<UnitName Value="langpackmgr"/>
- <IsVisibleTab Value="True"/>
<EditorIndex Value="0"/>
<WindowIndex Value="0"/>
<TopLine Value="1"/>
- <CursorPos X="1" Y="1"/>
- <UsageCount Value="29"/>
+ <CursorPos X="28" Y="18"/>
+ <UsageCount Value="33"/>
<Loaded Value="True"/>
</Unit0>
<Unit1>
@@ -24,148 +23,163 @@
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="unit1"/>
+ <IsVisibleTab Value="True"/>
<EditorIndex Value="1"/>
<WindowIndex Value="0"/>
- <TopLine Value="312"/>
- <CursorPos X="59" Y="333"/>
- <UsageCount Value="29"/>
+ <TopLine Value="150"/>
+ <CursorPos X="17" Y="162"/>
+ <UsageCount Value="33"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit1>
<Unit2>
+ <Filename Value="unit2.pas"/>
+ <UnitName Value="Unit2"/>
+ <WindowIndex Value="0"/>
+ <TopLine Value="30"/>
+ <CursorPos X="1" Y="3"/>
+ <UsageCount Value="21"/>
+ </Unit2>
+ <Unit3>
<Filename Value="E:\lazarus\lcl\interfaces\win32\win32int.pp"/>
<UnitName Value="Win32Int"/>
<WindowIndex Value="0"/>
<TopLine Value="85"/>
<CursorPos X="26" Y="27"/>
<UsageCount Value="10"/>
- </Unit2>
- <Unit3>
+ </Unit3>
+ <Unit4>
<Filename Value="E:\lazarus\lcl\interfaces\win32\win32listsl.inc"/>
- <EditorIndex Value="2"/>
<WindowIndex Value="0"/>
<TopLine Value="160"/>
<CursorPos X="1" Y="173"/>
<UsageCount Value="10"/>
- <Loaded Value="True"/>
- </Unit3>
+ </Unit4>
</Units>
<General>
<ActiveWindowIndexAtStart Value="0"/>
</General>
- <JumpHistory Count="28" HistoryIndex="27">
+ <JumpHistory Count="30" HistoryIndex="29">
<Position1>
<Filename Value="unit1.pas"/>
- <Caret Line="239" Column="7" TopLine="225"/>
+ <Caret Line="66" Column="29" TopLine="59"/>
</Position1>
<Position2>
<Filename Value="unit1.pas"/>
- <Caret Line="238" Column="20" TopLine="225"/>
+ <Caret Line="290" Column="2" TopLine="279"/>
</Position2>
<Position3>
<Filename Value="unit1.pas"/>
- <Caret Line="31" Column="25" TopLine="24"/>
+ <Caret Line="67" Column="37" TopLine="56"/>
</Position3>
<Position4>
<Filename Value="unit1.pas"/>
- <Caret Line="57" Column="28" TopLine="45"/>
+ <Caret Line="4" Column="45" TopLine="1"/>
</Position4>
<Position5>
<Filename Value="unit1.pas"/>
- <Caret Line="56" Column="14" TopLine="38"/>
+ <Caret Line="53" Column="8" TopLine="32"/>
</Position5>
<Position6>
<Filename Value="unit1.pas"/>
- <Caret Line="241" Column="12" TopLine="237"/>
+ <Caret Line="74" Column="24" TopLine="53"/>
</Position6>
<Position7>
<Filename Value="unit1.pas"/>
- <Caret Line="233" Column="1" TopLine="232"/>
+ <Caret Line="202" Column="34" TopLine="182"/>
</Position7>
<Position8>
<Filename Value="unit1.pas"/>
- <Caret Line="275" Column="15" TopLine="259"/>
+ <Caret Line="309" Column="57" TopLine="288"/>
</Position8>
<Position9>
<Filename Value="unit1.pas"/>
- <Caret Line="187" Column="4" TopLine="46"/>
+ <Caret Line="303" Column="35" TopLine="291"/>
</Position9>
<Position10>
<Filename Value="unit1.pas"/>
- <Caret Line="217" Column="14" TopLine="193"/>
+ <Caret Line="304" Column="28" TopLine="292"/>
</Position10>
<Position11>
<Filename Value="unit1.pas"/>
- <Caret Line="323" Column="14" TopLine="304"/>
+ <Caret Line="303" Column="56" TopLine="292"/>
</Position11>
<Position12>
<Filename Value="unit1.pas"/>
- <Caret Line="104" Column="16" TopLine="95"/>
+ <Caret Line="306" Column="12" TopLine="303"/>
</Position12>
<Position13>
<Filename Value="unit1.pas"/>
- <Caret Line="323" Column="3" TopLine="304"/>
+ <Caret Line="312" Column="66" TopLine="173"/>
</Position13>
<Position14>
<Filename Value="unit1.pas"/>
- <Caret Line="92" Column="41" TopLine="78"/>
+ <Caret Line="199" Column="17" TopLine="182"/>
</Position14>
<Position15>
<Filename Value="unit1.pas"/>
- <Caret Line="282" Column="4" TopLine="276"/>
+ <Caret Line="196" Column="17" TopLine="184"/>
</Position15>
<Position16>
<Filename Value="unit1.pas"/>
- <Caret Line="283" Column="4" TopLine="277"/>
+ <Caret Line="287" Column="30" TopLine="269"/>
</Position16>
<Position17>
<Filename Value="unit1.pas"/>
- <Caret Line="282" Column="4" TopLine="276"/>
+ <Caret Line="259" Column="30" TopLine="248"/>
</Position17>
<Position18>
<Filename Value="unit1.pas"/>
- <Caret Line="321" Column="35" TopLine="75"/>
+ <Caret Line="260" Column="54" TopLine="248"/>
</Position18>
<Position19>
<Filename Value="unit1.pas"/>
- <Caret Line="64" Column="28" TopLine="48"/>
+ <Caret Line="279" Column="52" TopLine="265"/>
</Position19>
<Position20>
<Filename Value="unit1.pas"/>
- <Caret Line="323" Column="14" TopLine="301"/>
+ <Caret Line="259" Column="57" TopLine="248"/>
</Position20>
<Position21>
<Filename Value="unit1.pas"/>
- <Caret Line="322" Column="14" TopLine="300"/>
+ <Caret Line="285" Column="35" TopLine="271"/>
</Position21>
<Position22>
<Filename Value="unit1.pas"/>
- <Caret Line="329" Column="14" TopLine="307"/>
+ <Caret Line="284" Column="35" TopLine="270"/>
</Position22>
<Position23>
<Filename Value="unit1.pas"/>
- <Caret Line="105" Column="9" TopLine="89"/>
+ <Caret Line="67" Column="8" TopLine="55"/>
</Position23>
<Position24>
<Filename Value="unit1.pas"/>
- <Caret Line="293" Column="2" TopLine="42"/>
+ <Caret Line="328" Column="28" TopLine="296"/>
</Position24>
<Position25>
<Filename Value="unit1.pas"/>
- <Caret Line="31" Column="26" TopLine="19"/>
+ <Caret Line="203" Column="26" TopLine="195"/>
</Position25>
<Position26>
<Filename Value="unit1.pas"/>
- <Caret Line="29" Column="31" TopLine="17"/>
+ <Caret Line="204" Column="26" TopLine="196"/>
</Position26>
<Position27>
<Filename Value="unit1.pas"/>
- <Caret Line="32" Column="29" TopLine="20"/>
+ <Caret Line="34" Column="15" TopLine="73"/>
</Position27>
<Position28>
<Filename Value="unit1.pas"/>
- <Caret Line="33" Column="29" TopLine="21"/>
+ <Caret Line="56" Column="3" TopLine="35"/>
</Position28>
+ <Position29>
+ <Filename Value="unit1.pas"/>
+ <Caret Line="143" Column="59" TopLine="126"/>
+ </Position29>
+ <Position30>
+ <Filename Value="unit1.pas"/>
+ <Caret Line="137" Column="42" TopLine="125"/>
+ </Position30>
</JumpHistory>
</ProjectSession>
</CONFIG>
diff --git a/tools/langpackmgr/unit1.lfm b/tools/langpackmgr/unit1.lfm
index 1f572fc5f7..cf741b9ecd 100644
--- a/tools/langpackmgr/unit1.lfm
+++ b/tools/langpackmgr/unit1.lfm
@@ -57,7 +57,6 @@ object Form1: TForm1
Height = 21
Top = 8
Width = 72
- Enabled = False
ItemHeight = 13
ItemIndex = 0
Items.Strings = (
@@ -130,13 +129,12 @@ object Form1: TForm1
)
TabOrder = 9
end
- object CheckBox1: TCheckBox
- Left = 400
- Height = 17
- Top = 12
- Width = 104
- Caption = 'Other languages:'
- Enabled = False
- TabOrder = 10
+ object Label1: TLabel
+ Left = 448
+ Height = 14
+ Top = 15
+ Width = 61
+ Caption = 'Other langs:'
+ ParentColor = False
end
end