Cultures and localizations in RadDatePicker

1 Answer 286 Views
DatePicker Localization MonthYearPicker
Cloud9 Software
Top achievements
Rank 1
Cloud9 Software asked on 29 Sep 2022, 12:30 PM

Hello,

We have an application that is used by clients from different countries in multiple languages. The date and number formats have to be the same for all clients in a certain country, the language can be selected by the user.

This works well by specifying the Thread.CurrentThread.CurrentCulture for the date and number formats and the Thread.CurrentThread.CurrentUICulture for the culture of the user's language.

When formatting dates, the names of the days and months are taken from the CurrentCulture. To make sure these names match the UICulture, we copy the names from the UICulture to the Culture. This works fine in most situations (for example in the DateTime.Format() function).

The behaviour of the RadDatePicker and RadMonthYearPicker seems a bit off though. In the picker (popup) the day and month names are correctly taken from the culture as we set them. In the input field however, the original day and month names are used. This seems wrong to me. Are we doing something wrong, or is this a bug in how the date pickers use the culture settings?


            var uiCulture = CultureInfo.CreateSpecificCulture("nl-NL");

            var customCulture = CultureInfo.CreateSpecificCulture("en-US");
            customCulture.DateTimeFormat.AbbreviatedDayNames = uiCulture.DateTimeFormat.AbbreviatedDayNames;
            customCulture.DateTimeFormat.DayNames = uiCulture.DateTimeFormat.DayNames;
            customCulture.DateTimeFormat.AbbreviatedMonthGenitiveNames = uiCulture.DateTimeFormat.AbbreviatedMonthNames;
            customCulture.DateTimeFormat.AbbreviatedMonthNames = uiCulture.DateTimeFormat.AbbreviatedMonthNames;
            customCulture.DateTimeFormat.MonthNames = uiCulture.DateTimeFormat.MonthNames;
            customCulture.DateTimeFormat.MonthGenitiveNames = uiCulture.DateTimeFormat.MonthGenitiveNames;
            customCulture.DateTimeFormat.ShortestDayNames = uiCulture.DateTimeFormat.ShortestDayNames;


            Thread.CurrentThread.CurrentCulture = customCulture;
            Thread.CurrentThread.CurrentUICulture = uiCulture;

 


The day and month names of the picker are localized, the input field is not.

 

Thanks for any suggestions,
Cloud9Software.

1 Answer, 1 is accepted

Sort by
0
MC
Top achievements
Rank 1
Iron
answered on 19 Jun 2023, 10:15 AM | edited on 19 Jun 2023, 10:16 AM

What I found out for my app (using only month), the datetimepicker is using the "CurrentCulture" for the language of "panel inside", the rest of  the application is using "CurrentUICulture". This was really hard for me to make the middle part (see picture below) in the same language as the rest...

 

Tags
DatePicker Localization MonthYearPicker
Asked by
Cloud9 Software
Top achievements
Rank 1
Answers by
MC
Top achievements
Rank 1
Iron
Share this question
or