Search code examples
delphidelphi-2007monthcalendar

How to localize "Today" in the Delphi TMonthCalendar?


I have an issue with the default month calendar control on Windows and Delphi 2007.

By default, my dev environnemet is in French.

I need to translate the texts into Flemish:

  • Dutch (Belgium), nl-BE, $0813

No worries, I use the “Localizer” tool and it’s ok.

On the other hand, with the TMonthCalendar component, I have the character string “aujourd'hui” which is not displayed in Flemish; remaining in French as picture below :

screen capture in nl-BE

If you already noticed these behaviour, how did you fix the problem?


Solution

  • Control TMonthCalendar is just a wrapper for Windows Month Calendar Control.

    While it is possible to translate most of its elements using Localizer tool some of them still remain in the default Windows UI language. In order to change this you will have to change the current thread UI language by calling SetThreadUILanguage API function.

    You can read more on this in Delphi 7 application not loading STRINGTABLE resources on Windows 10

    PS: You need to change Thread UI Language before TMonthCalendar is created otherwise this will not work.