Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
15
How can I change the display text of UltraCalendarCombo in another language?
posted

I have to change the language for UltraCalendarCombo. 

I do this by (i.e. French):

cmb.CalendarInfo.DaysOfWeek[DayOfWeekEnum.Monday].ShortDescription = "Lu.";
cmb.CalendarInfo.DaysOfWeek[DayOfWeekEnum.Tuesday].ShortDescription = "Ma.";
cmb.CalendarInfo.DaysOfWeek[DayOfWeekEnum.Wednesday].ShortDescription = "Me.";
cmb.CalendarInfo.DaysOfWeek[DayOfWeekEnum.Thursday].ShortDescription = "Je.";
cmb.CalendarInfo.DaysOfWeek[DayOfWeekEnum.Friday].ShortDescription = "Ve.";
cmb.CalendarInfo.DaysOfWeek[DayOfWeekEnum.Saturday].ShortDescription = "Sa.";
cmb.CalendarInfo.DaysOfWeek[DayOfWeekEnum.Sunday].ShortDescription = "Di.";

cmb.CalendarInfo.DaysOfWeek[DayOfWeekEnum.Monday].LongDescription = "Lundi";
cmb.CalendarInfo.DaysOfWeek[DayOfWeekEnum.Tuesday].LongDescription = "Mardi";
cmb.CalendarInfo.DaysOfWeek[DayOfWeekEnum.Wednesday].LongDescription = "Mercredi";
cmb.CalendarInfo.DaysOfWeek[DayOfWeekEnum.Thursday].LongDescription = "Jeudi";
cmb.CalendarInfo.DaysOfWeek[DayOfWeekEnum.Friday].LongDescription = "Vendredi";
cmb.CalendarInfo.DaysOfWeek[DayOfWeekEnum.Saturday].LongDescription = "Samedi";
cmb.CalendarInfo.DaysOfWeek[DayOfWeekEnum.Sunday].LongDescription = "Dimanche";

cmb.CalendarInfo.MonthsOfYear[YearMonthEnum.January].LongDescription = "Janvier";
cmb.CalendarInfo.MonthsOfYear[YearMonthEnum.February].LongDescription = "Février";
cmb.CalendarInfo.MonthsOfYear[YearMonthEnum.March].LongDescription = "Mars";
cmb.CalendarInfo.MonthsOfYear[YearMonthEnum.April].LongDescription = "Avril";
cmb.CalendarInfo.MonthsOfYear[YearMonthEnum.May].LongDescription = "Mai";
cmb.CalendarInfo.MonthsOfYear[YearMonthEnum.June].LongDescription = "Juin";
cmb.CalendarInfo.MonthsOfYear[YearMonthEnum.July].LongDescription = "Juillet";
cmb.CalendarInfo.MonthsOfYear[YearMonthEnum.August].LongDescription = "Août";
cmb.CalendarInfo.MonthsOfYear[YearMonthEnum.September].LongDescription = "Septembre";
cmb.CalendarInfo.MonthsOfYear[YearMonthEnum.October].LongDescription = "Octobre";
cmb.CalendarInfo.MonthsOfYear[YearMonthEnum.November].LongDescription = "Novembre";
cmb.CalendarInfo.MonthsOfYear[YearMonthEnum.December].LongDescription = "Décembre";

In the dropdown calendar the months and day names are shown correctly.

But after setting a value by code the display is shown in another language, i.e. German: "Montag, 13.11.2021".

The Format is i.e. set to "dddd dd.MM.yyyy". I use version "Infagistics 20.2 Win CLR4x".

How can I change the display to "Lundi, 13.11.2021".

Parents
  • 34430
    Verified Answer
    Offline posted

    Hello Rolf,

    I have been investigating into the behavior you are seeing, and at the moment, the ShortDescription/LongDescription properties for the CalendarInfo’s DaysOfWeek and MonthsOfYear collections are only used within the actual “calendar” portion of the UltraCalendarCombo. If your value is showing in a German format, I am under the impression that your machine is likely in a German localization, as by default, we use the formatting information from the machine along with the Format property of the control to determine the displayed text of the combo.

    This can be changed of course, in that you can change the DateTimeFormatInfo of the control by defining your own System.Globalization.DateTimeFormatInfo for this property and filling out its various string[] properties. For example, the property that I believe you are looking to fill out in this case is the DayNames property on the DateTimeFormatInfo element, starting with the value for “Sunday.” The code for this could look something like the following:

    DateTimeFormatInfo dtInfo = new DateTimeFormatInfo();
    dtInfo.DayNames = new string[] { "Dimanche", "Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi" };

    cmb.DateTimeFormatInfo = dtInfo;

    Please let me know if you have any other questions or concerns on this matter.

Reply Children
No Data