diff --git a/components/tvplanit/examples/fulldemo/demomain.pas b/components/tvplanit/examples/fulldemo/demomain.pas index d634be126..379441182 100644 --- a/components/tvplanit/examples/fulldemo/demomain.pas +++ b/components/tvplanit/examples/fulldemo/demomain.pas @@ -125,12 +125,15 @@ type FActiveView: Integer; FVisibleDays: Integer; FResID: Integer; + FLanguageDir: String; procedure CreateResourceGroup; + function GetlanguageDir: String; procedure PopulateLanguages; procedure PositionControls; procedure SetActiveView(AValue: Integer); procedure SetLanguage(ALang: String); overload; procedure SetLanguage(AIndex: Integer); overload; + procedure SetLanguageDir(const AValue: String); procedure ShowAllEvents; procedure ShowContacts; procedure ShowEventsPerDay; @@ -144,6 +147,7 @@ type procedure WriteIni; public { public declarations } + property LanguageDir: String read GetLanguageDir write SetLanguageDir; end; var @@ -503,6 +507,17 @@ begin Caption := Application.Title; end; +function TMainForm.GetLanguageDir: String; +begin + if FLanguageDir = '' then + Result := ExpandFileName(AppendPathDelim(Application.Location) + LANGUAGE_DIR) + else + if FilenameIsAbsolute(FLanguageDir) then + Result := FLanguageDir + else + Result := ExpandFileName(AppendPathDelim(Application.Location) + FLanguageDir); +end; + procedure TMainForm.MnuAboutClick(Sender: TObject); var F: TfrmAbout; @@ -641,7 +656,7 @@ begin L := TStringList.Create; po := TStringList.Create; try - langdir := ExpandFileName(AppendPathDelim(Application.Location) + LANGUAGE_DIR); + langdir := AppendPathDelim(GetLanguageDir); FindAllFiles(L, langdir, '*.po'); po.Sorted := true; po.Duplicates := dupIgnore; @@ -882,7 +897,7 @@ var translator: TUpdateTranslator; nf: TVpNavFolder; begin - langdir := ExpandFileName(AppendPathDelim(Application.Location) + LANGUAGE_DIR); + langdir := AppendPathDelim(GetLanguageDir); // Select new language if ALang = 'en' then @@ -1000,6 +1015,12 @@ begin Invalidate; end; +procedure TMainForm.SetLanguageDir(const AValue: String); +begin + FLanguageDir := AValue; + PopulateLanguages; +end; + procedure TMainForm.ShowAllEvents; begin Notebook.PageIndex := 0; diff --git a/components/tvplanit/examples/mormot/fulldemo/mormotdemo.lpi b/components/tvplanit/examples/mormot/fulldemo/demo.lpi similarity index 83% rename from components/tvplanit/examples/mormot/fulldemo/mormotdemo.lpi rename to components/tvplanit/examples/mormot/fulldemo/demo.lpi index e1df65da2..3c791779e 100644 --- a/components/tvplanit/examples/mormot/fulldemo/mormotdemo.lpi +++ b/components/tvplanit/examples/mormot/fulldemo/demo.lpi @@ -12,7 +12,7 @@ - + @@ -39,66 +39,50 @@ - + - + - - - - - - - - - - - - - - - - - - - - - + + - - + + + - - + + + + - - + + - - + + - + - + diff --git a/components/tvplanit/examples/mormot/fulldemo/mormotdemo.lpr b/components/tvplanit/examples/mormot/fulldemo/demo.lpr similarity index 72% rename from components/tvplanit/examples/mormot/fulldemo/mormotdemo.lpr rename to components/tvplanit/examples/mormot/fulldemo/demo.lpr index a92d78e18..37d52f3f8 100644 --- a/components/tvplanit/examples/mormot/fulldemo/mormotdemo.lpr +++ b/components/tvplanit/examples/mormot/fulldemo/demo.lpr @@ -1,4 +1,4 @@ -program mormotdemo; +program demo; { IMPORTANT NOTE: If compilation aborts with an error that libkernel32a, libgcc.a and libmsvcrt.a @@ -30,6 +30,14 @@ begin Application.Initialize; Application.CreateForm(TDemoDM, DemoDM); Application.CreateForm(TMainForm, MainForm); + + // Fix the location of the localization and language files - their relative + // path is different here from those in the other "fulldemo". + MainForm.VpControlLink1.LocalizationFile := '../../../source/vplocalize.xml'; + MainForm.LanguageDir := '../../../languages'; + // ... and expand the form caption + MainForm.Caption := 'TurboPower VisualPlanIt & mORMot Demo'; + Application.Run; end.