Hi,
In my application, I have an UltraTabControl with 3 tabs: an UltraDayView, an UltraMonthViewSingle and an UltreTimeLineView. They all use a common UltraCalendarInfo object. In this object, I modified the days of the week and months of the year names to have them in french. It works fine with the UltraDayView and the UltraMonthViewSingle controls, but the UltraTimeLineView seems to ignore them although other UltraCalendarInfo elements are taken into account as expected. Is there a special setting I have to do to make it work? If not, is there a way around?
I am working with the UltraTimeLineView of the WinForms library v14.2.
Thank you
Hello Real,
The easiest way to make all the week day and month names to show in French, or any other language, is to set the CurentCulture and CurentUICulture of your application to French CultureInfo. To do so add these two rows in the very beginning of your application’s Main method:
Thread.CurrentThread.CurrentCulture = new CultureInfo("fr-FR");Thread.CurrentThread.CurrentUICulture = new CultureInfo("fr-FR");
You may check this article in MSDN for additional information “How to: Set the Culture and UI Culture for Windows Forms Globalization”. I am not sure what you have changed in your UltraCalendarInfo, but this should be enough to force your application to show each localizable string in French.
If you need to change the way strings are shown in UltraTimeLineView header you may set HeaderTextFormat like this:
this.ultraTimelineView1.PrimaryInterval.HeaderTextFormat = "dddd, MMMM d, yyyy";
Attached is a small sample project showing how to localize you application.
Please check my sample and let me know if you have any additional questions.
Thank you for the suggestion. This application is large and complex. I am extremely reluctent to systematically change the culture for the whole application. Based on what you told me, here is what I did:
This works but is no silver bullet as the window is not modal and could be opened while the user works with other windows, but it is the best I could come up with. Do you have any other suggestion?
Thank you for the prompt answer
Reading back to your first post, how were you changing the days of week and other strings without changing the culture?
In the CalendarInfo, there are properties called "DaysOfWeek" and "MonthsOfYear". These properties allow us to change the names for days and months. When I associate the CalendarInfo with an UltraDayView or a UltraMonthViewSingle thay are taken into account just fine. Not so with the UltraTimeLineView which seems to completely ignore them.
This seems to me like an inconsistency.
Regards,
Hi Real,
We have investigated this further and this seems to be expected behavior. LongDescription and ShortDescription properties are not supposed to affect the TimeLine headers. They are for cases where the control displays the names by itself. The headers of the TimeLineView format a particular DateTime. To format the headers you may handle ColumnHeaderInitializing event. In this event you can set the header text like this:
private CultureInfo fr = new CultureInfo("fr-FR"); private void UltraTimelineView1_ColumnHeaderInitializing(object sender, ColumnHeaderInitializingEventArgs e){ e.Text = e.DateTimeRange.StartDateTime.ToString("dddd, MMMM d, yyyy", this.fr);}
private void UltraTimelineView1_ColumnHeaderInitializing(object sender, ColumnHeaderInitializingEventArgs e){ e.Text = e.DateTimeRange.StartDateTime.ToString("dddd, MMMM d, yyyy", this.fr);}
Attached is a small sample project showing how you can format header's text by the help of this event.
Please let me know if any additional questions arise.
Thank you. This provides an excellent solution to my problem. You mayclose the case.