source: cprs/branches/tmg-cprs/dklang-package-3.01/Examples/Resource/Main.pas@ 1176

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

CPRS v1.0.26.76

File size: 2.1 KB
RevLine 
[468]1//**********************************************************************************************************************
2// $Id: Main.pas,v 1.4 2006/08/11 12:15:51 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, TntForms,
13 Dialogs, DKLang, StdCtrls, TntStdCtrls;
14
15type
16 TfMain = class(TTntForm)
17 bCancel: TTntButton;
18 cbLanguage: TTntComboBox;
19 lcMain: TDKLanguageController;
20 lSampleMessage: TTntLabel;
21 procedure cbLanguageChange(Sender: TObject);
22 procedure FormCreate(Sender: TObject);
23 end;
24
25var
26 fMain: TfMain;
27
28implementation
29{$R *.dfm}
30uses TntSystem, TntSysUtils;
31
32{$R LangFiles.res} // Notice this resource inclusion!
33
34 procedure TfMain.cbLanguageChange(Sender: TObject);
35 var iIndex: Integer;
36 begin
37 iIndex := cbLanguage.ItemIndex;
38 if iIndex<0 then iIndex := 0; // When there's no valid selection in cbLanguage we use the default language (Index=0)
39 LangManager.LanguageID := LangManager.LanguageIDs[iIndex];
40 end;
41
42 procedure TfMain.FormCreate(Sender: TObject);
43 var i: Integer;
44 begin
45 // Fill in the 'statically included' languages
46 LangManager.RegisterLangResource(HInstance, 'LNG_RUSSIAN', 1049);
47 LangManager.RegisterLangResource(HInstance, 'LNG_GERMAN', 1031);
48 // Additionally, you can scan for language files in the app directory, uncomment the next line to do this
49 //LangManager.ScanForLangFiles(WideExtractFileDir(WideParamStr(0)), '*.lng', False);
50 // Fill cbLanguage with available languages
51 for i := 0 to LangManager.LanguageCount-1 do cbLanguage.Items.Add(LangManager.LanguageNames[i]);
52 // Index=0 always means the default language
53 cbLanguage.ItemIndex := 0;
54 end;
55
56end.
Note: See TracBrowser for help on using the repository browser.