FNCPlanner Month Translation

Is there a way to tell the TTMSFNCPlanner to display months in English instead of the System language?

With the following code:

uses
  DateUtils;

procedure TForm1.TMSFNCPlanner1GetPositionText(Sender: TObject;
  APosition: Integer; AKind: TTMSFNCPlannerCacheItemKind; var AText: string);
var
  dt: TDateTime;
begin
  case aKind of
    ikPositionTop:
    begin
      dt := TMSFNCPlanner1.PositionToDateTime(APosition);
      case MonthOf(dt) of
        1: AText := 'January';
        2: AText := 'February';
        3: AText := 'March';
        4: AText := 'April';
        5: AText := 'May';
        6: AText := 'June';
        7: AText := 'July';
        8: AText := 'August';
        9: AText := 'September';
        10: AText := 'October';
        11: AText := 'November';
        12: AText := 'December';
      end;
    end;
  end;
end;

1 Like

Hello Pieter,

This works perfectly. Thanks for the quick support :)

is there a similar solution for the TTMSFMXCalendar. I think it´s language is corresponding to the system setting as well. I would like to set the language of that control corresponding to the language i have defined in my application.

I have an old project which still has the FMX-Components. I don´t have the time right now to rebuild that project.

Due to incompatibility with the woll2woll TwwRecordViewPanel. I can unfortunately not use the TTMSFNCCalendarPicker (Isn´t descending from TStyledControl).

If you have a solution for either of the two problems it would be very helpful.

Thank you for your help so far
Max

Hi,

Yes, you can do this with the following code

procedure TForm1.FormCreate(Sender: TObject);
var
  I, idx: Integer;
begin
  TMSFMXCalendar1.NeedStyleLookup;
  TMSFMXCalendar1.ApplyStyleLookup;
  idx := TMSFMXCalendar1.MonthsPopup.ItemIndex;
  TMSFMXCalendar1.MonthsPopup.Items.Clear;
  for I := 1 to 12 do
   TMSFMXCalendar1.MonthsPopup.Items.Add(I.ToString);
  TMSFMXCalendar1.MonthsPopup.ItemIndex := idx;
end;

Can i also make this work when the Calendar is the PopupControl of a TTMSFMXCalendarPicker?

It doesn´t seem to work in this case. See the following example:
Test_FMXCalendar.zip (8.4 KB)

Hmm, indeed you are correct. But perhaps because it's using system dates, you can override the Formatsettings. That will ofcourse mean that all date-time related month display labels will be altered.

FormatSettings.LongMonthNames[1] := 'This is January';

image

Setting the month labels this way will also apply for both the calendar & the calendar picker.