You've already forked lazarus-ccr
102 lines
2.5 KiB
ObjectPascal
102 lines
2.5 KiB
ObjectPascal
![]() |
unit tdmain;
|
||
|
|
||
|
{$mode objfpc}{$H+}
|
||
|
|
||
|
interface
|
||
|
|
||
|
uses
|
||
|
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
|
||
|
StdCtrls, ComCtrls, Menus,
|
||
|
Translations, LCLTranslator,
|
||
|
VpBaseDS, VpDayView, VpWeekView, VpTaskList, VpContactGrid, VpMonthView,
|
||
|
VpResEditDlg, VpContactButtons, VpIniDs;
|
||
|
|
||
|
type
|
||
|
|
||
|
{ TMainForm }
|
||
|
|
||
|
TMainForm = class(TForm)
|
||
|
PageControl1: TPageControl;
|
||
|
Panel2: TPanel;
|
||
|
PopupMenu1: TPopupMenu;
|
||
|
Splitter1: TSplitter;
|
||
|
Splitter2: TSplitter;
|
||
|
Splitter3: TSplitter;
|
||
|
TabSheet1: TTabSheet;
|
||
|
TabSheet2: TTabSheet;
|
||
|
VpContactButtonBar1: TVpContactButtonBar;
|
||
|
VpContactGrid1: TVpContactGrid;
|
||
|
VpControlLink1: TVpControlLink;
|
||
|
VpDayView1: TVpDayView;
|
||
|
VpIniDatastore1: TVpIniDatastore;
|
||
|
VpMonthView1: TVpMonthView;
|
||
|
VpResourceEditDialog1: TVpResourceEditDialog;
|
||
|
VpTaskList1: TVpTaskList;
|
||
|
VpWeekView1: TVpWeekView;
|
||
|
procedure FormCreate(Sender: TObject);
|
||
|
private
|
||
|
{ private declarations }
|
||
|
procedure SelectLanguage(ALang: String);
|
||
|
public
|
||
|
{ public declarations }
|
||
|
end;
|
||
|
|
||
|
var
|
||
|
MainForm: TMainForm;
|
||
|
|
||
|
implementation
|
||
|
|
||
|
{$R *.lfm}
|
||
|
|
||
|
uses
|
||
|
LazFileUtils,
|
||
|
VpData;
|
||
|
|
||
|
|
||
|
{ TMainForm }
|
||
|
|
||
|
// Load the last resource.
|
||
|
procedure TMainForm.FormCreate(Sender: TObject);
|
||
|
var
|
||
|
lastRes: TVpResource;
|
||
|
datastore: TVpCustomDatastore;
|
||
|
begin
|
||
|
datastore := VpControlLink1.Datastore;
|
||
|
if datastore.Resources.Count > 0 then
|
||
|
begin
|
||
|
lastRes := datastore.Resources.Items[datastore.Resources.Count-1];
|
||
|
datastore.ResourceID := lastRes.ResourceID;
|
||
|
end;
|
||
|
|
||
|
SelectLanguage('de');
|
||
|
end;
|
||
|
|
||
|
procedure TMainForm.SelectLanguage(ALang: String);
|
||
|
var
|
||
|
langDir: String;
|
||
|
begin
|
||
|
// Calculate the path to the directory with the translation files.
|
||
|
langDir := ExpandFileName(Application.Location + '../../languages/');
|
||
|
|
||
|
// Switch language of the application. This is a function in LCLTranslator.
|
||
|
SetDefaultLang(ALang, langDir);
|
||
|
|
||
|
// Translate all package string files needed.
|
||
|
// IMPORTANT: All these files must be copied from their original places into
|
||
|
// the "languages" directory of the application.
|
||
|
TranslateUnitResourceStrings('vpsr', langDir + 'vpsr.' + ALang + '.po');
|
||
|
TranslateUnitResourceStrings('lclstrconsts', langDir + 'lclstrconsts.' + ALang + '.po');
|
||
|
|
||
|
// We must call the method LoadLanguage of all visual TvPlanIt components
|
||
|
// in order to use the translated strings in the popup menus and other places
|
||
|
// not automatically handled by LCLTranslator.
|
||
|
VpDayView1.LoadLanguage;
|
||
|
VpWeekView1.LoadLanguage;
|
||
|
VpMonthView1.LoadLanguage;
|
||
|
VpTaskList1.LoadLanguage;
|
||
|
VpContactGrid1.LoadLanguage;
|
||
|
end;
|
||
|
|
||
|
end.
|
||
|
|