source: cprs/branches/tmg-cprs/dklang-package-3.01/Examples/Ansi/Main.pas@ 1119

Last change on this file since 1119 was 468, checked in by Kevin Toppenberg, 16 years ago

CPRS v1.0.26.76

File size: 1.8 KB
RevLine 
[468]1//**********************************************************************************************************************
2// $Id: Main.pas,v 1.2 2006/08/11 07:00:08 dale Exp $
3//----------------------------------------------------------------------------------------------------------------------
4// DKLang Localization Package
5// Copyright (c)DK Software, http://www.dk-soft.org/
6//**********************************************************************************************************************
7unit Main;
8
9interface
10
11uses
12 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs,
13 DKLang, StdCtrls, TntStdCtrls;
14
15type
16 TfMain = class(TForm)
17 bCancel: TButton;
18 cbLanguage: TComboBox;
19 lcMain: TDKLanguageController;
20 lSampleMessage: TLabel;
21 procedure cbLanguageChange(Sender: TObject);
22 procedure FormCreate(Sender: TObject);
23 end;
24
25var
26 fMain: TfMain;
27
28implementation
29{$R *.dfm}
30
31 procedure TfMain.cbLanguageChange(Sender: TObject);
32 var iIndex: Integer;
33 begin
34 iIndex := cbLanguage.ItemIndex;
35 if iIndex<0 then iIndex := 0; // When there's no valid selection in cbLanguage we use the default language (Index=0)
36 LangManager.LanguageID := LangManager.LanguageIDs[iIndex];
37 end;
38
39 procedure TfMain.FormCreate(Sender: TObject);
40 var i: Integer;
41 begin
42 // Scan for language files in the app directory and register them in the LangManager object
43 LangManager.ScanForLangFiles(ExtractFileDir(ParamStr(0)), '*.lng', False);
44 // Fill cbLanguage with available languages. Notice that implicit Unicode-to-ANSI conversion will take place here
45 for i := 0 to LangManager.LanguageCount-1 do cbLanguage.Items.Add(LangManager.LanguageNames[i]);
46 // Index=0 always means the default language
47 cbLanguage.ItemIndex := 0;
48 end;
49
50end.
Note: See TracBrowser for help on using the repository browser.