source: trunk/Packages/CoolTranslator/Demo/UMainForm.pas

Last change on this file was 37, checked in by chronos, 7 years ago
  • Added: Multi-lingual support.
File size: 1.3 KB
Line 
1unit UMainForm;
2
3{$mode objfpc}{$H+}
4
5interface
6
7uses
8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
9 UCoolTranslator, ULanguages;
10
11type
12
13 { TMainForm }
14
15 TMainForm = class(TForm)
16 Button1: TButton;
17 CoolTranslator1: TCoolTranslator;
18 Label1: TLabel;
19 Label2: TLabel;
20 Label3: TLabel;
21 Label4: TLabel;
22 ListBox1: TListBox;
23 ListBox2: TListBox;
24 procedure Button1Click(Sender: TObject);
25 procedure FormCreate(Sender: TObject);
26 procedure ListBox1SelectionChange(Sender: TObject; User: boolean);
27 private
28 { private declarations }
29 public
30 { public declarations }
31 end;
32
33var
34 MainForm: TMainForm;
35
36implementation
37
38resourcestring
39 STranslatedText = 'Text stored in resourcestring';
40
41{$R *.lfm}
42
43{ TMainForm }
44
45procedure TMainForm.FormCreate(Sender: TObject);
46begin
47 CoolTranslator1.LanguageListToStrings(ListBox1.Items);
48 CoolTranslator1.ComponentExcludes.DumpToStrings(ListBox2.Items);
49end;
50
51procedure TMainForm.Button1Click(Sender: TObject);
52begin
53 ShowMessage(MainForm.Name);
54end;
55
56procedure TMainForm.ListBox1SelectionChange(Sender: TObject; User: boolean);
57begin
58 if ListBox1.ItemIndex <> - 1 then
59 with CoolTranslator1 do
60 Language := TLanguage(ListBox1.Items.Objects[ListBox1.ItemIndex]);
61end;
62
63end.
64
Note: See TracBrowser for help on using the repository browser.