Changeset 6 for tools/Lazarus translator/UMainForm.pas
- Timestamp:
- Jan 14, 2009, 8:20:25 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tools/Lazarus translator/UMainForm.pas
r4 r6 7 7 uses 8 8 Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs, 9 ComCtrls, UItemTranslationForm, UTextFileStream ;9 ComCtrls, UItemTranslationForm, UTextFileStream, StdCtrls; 10 10 11 11 const 12 TranslationF ileName: string = '../../trunk/lazaruside.cz.po';12 TranslationFolder: string = '../../trunk/'; 13 13 TranslationMergeFileName: string = '../../tags/0.9.25/lazaruside.cz.po'; 14 14 … … 23 23 24 24 TMainForm = class(TForm) 25 ComboBox1: TComboBox; 25 26 ListView1: TListView; 26 27 ProgressBar1: TProgressBar; 28 procedure Button1Click(Sender: TObject); 29 procedure ComboBox1Change(Sender: TObject); 27 30 procedure FormShow(Sender: TObject); 28 31 procedure FormDestroy(Sender: TObject); 29 32 procedure FormCreate(Sender: TObject); 33 procedure ListView1Compare(Sender: TObject; Item1, Item2: TListItem; 34 Data: Integer; var Compare: Integer); 30 35 procedure ListView1DblClick(Sender: TObject); 31 36 procedure ListView1KeyPress(Sender: TObject; var Key: Char); 32 37 procedure ListView1ColumnClick(Sender: TObject; Column: TListColumn); 33 38 private 39 LastFileName: string; 34 40 procedure MergeListFromFile; 35 41 public … … 71 77 NewItem := Add; 72 78 NewItem.Data := StringList[I]; 73 NewItem.Caption := Identification;79 NewItem.Caption := OriginalText; 74 80 with NewItem.SubItems do begin 75 Add(OriginalText);76 81 Add(TranslatedText); 82 Add(Identification); 77 83 if TranslatedText <> '' then Inc(CompletedCount); 78 84 end; … … 89 95 LastSortedColumn := -1; 90 96 Ascending := True; 97 end; 98 99 procedure TMainForm.ListView1Compare(Sender: TObject; Item1, Item2: TListItem; 100 Data: Integer; var Compare: Integer); 101 begin 102 Compare := AnsiCompareText(Item1.SubItems[0], 103 Item2.SubItems[0]); 104 if not Ascending then Compare := -Compare; 91 105 end; 92 106 … … 106 120 //MergeListFromFile; 107 121 FillList; 108 //ListView1.CustomSort(@SortByColumn, 1); 122 end; 123 124 procedure TMainForm.Button1Click(Sender: TObject); 125 begin 126 ListView1.SortColumn := 1; 127 ListView1.SortType := stData; 128 ListView1.Refresh; 129 ListView1.Invalidate; 130 end; 131 132 procedure TMainForm.ComboBox1Change(Sender: TObject); 133 begin 134 SaveListToFile; 135 LoadListFromFile; 136 FillList; 109 137 end; 110 138 … … 128 156 TranslatedText := Copy(Memo2.Text, 1, Length(Memo2.Text) - 2); 129 157 130 ListView1.Selected.SubItems[ 1] := TranslatedText;158 ListView1.Selected.SubItems[0] := TranslatedText; 131 159 SaveListToFile; 132 160 end; … … 145 173 I: Integer; 146 174 begin 175 StringList.Clear; 176 LastFileName := TranslationFolder + ComboBox1.Text; 147 177 NewItem := nil; 148 Source := TTextFileStream.Create( TranslationFileName, fmOpenRead);178 Source := TTextFileStream.Create(LastFileName, fmOpenRead); 149 179 try 150 180 for I := 0 to 10 do Row := Source.ReadLn; // Skip leading info lines … … 175 205 I: Integer; 176 206 begin 177 Source := TTextFileStream.Create( TranslationFileName, fmOpenWrite);207 Source := TTextFileStream.Create(LastFileName, fmOpenWrite); 178 208 with Source do 179 209 try … … 184 214 WriteLn('"PO-Revision-Date: 2009-01-07 19:03+0100\n"'); 185 215 WriteLn('"Last-Translator: Chronos <robie@centrum.cz>\n"'); 216 WriteLn('"Translation-Source: http://tv.zdechov.net/svn/lazarus_czech/\n"'); 186 217 WriteLn('"Language-Team: \n"'); 187 218 WriteLn('"MIME-Version: 1.0\n"'); 188 WriteLn('"Content-Type: text/plain; charset= windows-1250\n"');219 WriteLn('"Content-Type: text/plain; charset=UTF-8\n"'); 189 220 WriteLn('"Content-Transfer-Encoding: 8bit\n"'); 190 221 WriteLn('');
Note:
See TracChangeset
for help on using the changeset viewer.