From cf88b7c7926c04d361d7e07d4e19d5b707637ad1 Mon Sep 17 00:00:00 2001 From: wp_xxyyzz Date: Tue, 12 Jul 2022 10:25:34 +0000 Subject: [PATCH] TvPlanIt: Fix translation issues in fulldemo. git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8345 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- .../tvplanit/examples/fulldemo/demomain.lfm | 27 ++++----- .../tvplanit/examples/fulldemo/demomain.pas | 60 +++++++------------ 2 files changed, 35 insertions(+), 52 deletions(-) diff --git a/components/tvplanit/examples/fulldemo/demomain.lfm b/components/tvplanit/examples/fulldemo/demomain.lfm index 9067597cc..d5be49d89 100644 --- a/components/tvplanit/examples/fulldemo/demomain.lfm +++ b/components/tvplanit/examples/fulldemo/demomain.lfm @@ -4,21 +4,20 @@ object MainForm: TMainForm Top = 134 Width = 959 Caption = 'Turbo Power VisualPlanIt Demo' - ClientHeight = 576 + ClientHeight = 596 ClientWidth = 959 Menu = MainMenu1 OnCloseQuery = FormCloseQuery OnCreate = FormCreate - LCLVersion = '2.3.0.0' object Panel1: TPanel Left = 125 - Height = 576 + Height = 596 Top = 0 Width = 834 Align = alClient AutoSize = True BevelOuter = bvNone - ClientHeight = 576 + ClientHeight = 596 ClientWidth = 834 TabOrder = 0 object HeaderPanel: TPanel @@ -56,7 +55,7 @@ object MainForm: TMainForm end object Notebook: TNotebook Left = 0 - Height = 528 + Height = 548 Top = 48 Width = 834 PageIndex = 0 @@ -66,18 +65,18 @@ object MainForm: TMainForm object Events: TPage object LeftPanel: TPanel Left = 0 - Height = 528 + Height = 548 Top = 0 Width = 357 Align = alLeft BevelOuter = bvNone - ClientHeight = 528 + ClientHeight = 548 ClientWidth = 357 TabOrder = 0 object VpMonthView1: TVpMonthView Left = 0 Height = 197 - Top = 331 + Top = 351 Width = 357 ShowHint = True ControlLink = VpControlLink1 @@ -112,14 +111,14 @@ object MainForm: TMainForm Cursor = crVSplit Left = 0 Height = 5 - Top = 326 + Top = 346 Width = 357 Align = alBottom ResizeAnchor = akBottom end object VpDayView1: TVpDayView Left = 0 - Height = 292 + Height = 312 Top = 34 Width = 357 ShowHint = True @@ -295,13 +294,13 @@ object MainForm: TMainForm end object Splitter3: TSplitter Left = 357 - Height = 528 + Height = 548 Top = 0 Width = 5 end object VpWeekView1: TVpWeekView Left = 362 - Height = 528 + Height = 548 Top = 0 Width = 472 ShowHint = True @@ -746,7 +745,7 @@ object MainForm: TMainForm end object VpNavBar1: TVpNavBar Left = 0 - Height = 576 + Height = 596 Top = 0 Width = 120 ActiveFolder = 0 @@ -847,7 +846,7 @@ object MainForm: TMainForm end object Splitter1: TSplitter Left = 120 - Height = 576 + Height = 596 Top = 0 Width = 5 end diff --git a/components/tvplanit/examples/fulldemo/demomain.pas b/components/tvplanit/examples/fulldemo/demomain.pas index 6c7ee4846..768e12917 100644 --- a/components/tvplanit/examples/fulldemo/demomain.pas +++ b/components/tvplanit/examples/fulldemo/demomain.pas @@ -973,46 +973,29 @@ begin langdir := AppendPathDelim(GetLanguageDir); // Select new language - if ALang = 'en' then - FLang := '' - else - FLang := ALang; + FLang := ALang; + + SetDefaultLang(FLang, langdir); - if FLang = '' then begin - // Translate VisualPlanIt strings. - TranslateUnitResourceStrings('vpsr', langdir + 'vpsr.po'); + // Translate VisualPlanIt strings. + TranslateUnitResourceStrings('vpsr', langdir + 'vpsr.' + FLang + '.po'); + + // Translate demo strings + TranslateUnitResourceStrings('demoMain', langDir + 'demo.' + FLang + '.po'); + + // Translate LCL strings (please copy lclstrconsts.* from Lazarus/lcl/langauges + // to tvplanit/languages. + TranslateUnitResourceStrings('lclstrconsts', langDir + 'lclstrconsts.' + FLang + '.po'); - { NOTE: Translation of app strings back to english not working } - - // Translate demo strings - TranslateUnitResourceStrings('demoMain', langDir + 'demo.po'); - - // Translate LCL strings (please copy lclstrconsts.* from Lazarus/lcl/langauges - // to tvplanit/languages. - TranslateUnitResourceStrings('lclstrconsts', langDir + 'lclstrconsts.po'); - - if FileExistsUTF8(langdir + 'demo.po') then begin - translator := TPOTranslator.Create(langdir + 'demo.po'); - if Assigned(LRSTranslator) then - LRSTranslator.Free; - LRSTranslator := translator; - for i := 0 to Screen.CustomFormCount-1 do - translator.UpdateTranslation(Screen.CustomForms[i]); - end; - end - else - begin - SetDefaultLang(FLang, langdir); - TranslateUnitResourceStrings('vpsr', langdir + 'vpsr.' + FLang + '.po'); + if FileExistsUTF8(langdir + 'demo.' + FLang + '.po') then begin + translator := TPOTranslator.Create(langdir + 'demo.' + FLang + '.po'); + if Assigned(LRSTranslator) then + LRSTranslator.Free; + LRSTranslator := translator; + for i := 0 to Screen.CustomFormCount-1 do + translator.UpdateTranslation(Screen.CustomForms[i]); end; - { - VpDayView1.LoadLanguage; - VpWeekView1.LoadLanguage; - VpMonthView1.LoadLanguage; - VpTaskList1.LoadLanguage; - VpContactGrid1.LoadLanguage; - //VpCalendar1.LoadLanguage; - } + // Select language in language combobox. if ALang = '' then ALang := 'en'; found := false; @@ -1069,7 +1052,7 @@ begin OpenDialog.Filter := rsXMLFiles + '|*.xml'; - // Next settings work correctly only for Windows. + // These settings work correctly only for Windows. {$IFDEF WINDOWS} UpdateFormatSettings(ALang); VpDayView1.DateLabelFormat := FormatSettings.LongDateFormat; @@ -1082,6 +1065,7 @@ begin VpWeekView1.TimeFormat := tfmt; VpMonthView1.TimeFormat := tfmt; {$ENDIF} + firstWeekDay := GetFirstDayofWeek(ALang); // not correct at the moment VpMonthView1.WeekStartsOn := firstWeekDay; VpWeekView1.WeekStartsOn := firstWeekDay;