This is a migrated thread and some comments may be shown as answers.

RadDateTimePicker does not completely display in machine culture

3 Answers 154 Views
DateTimePicker
This is a migrated thread and some comments may be shown as answers.
Tony
Top achievements
Rank 1
Tony asked on 09 Dec 2013, 09:20 PM

I have a WPF application that uses the Rad Controls for WPF.  On one of the windows, there is a RadDateTimePicker:


   

<telerik:RadDateTimePicker FontSize="{x:Static res:Car.Common_DataEntryFontSize}"
                                           FontWeight="Bold"
                                           Grid.Column="1"
                                           Grid.Row="2"
                                           Height="35"
                                           Margin="5,5,30,5"
                                           Name="BeginDatePicker"
                                           SelectedValue="{Binding Converter={StaticResource DateConverterForPicker}, Mode=TwoWay, Path=LocalBeginDate, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}"
                                           SelectionChanged="BeginDatePicker_SelectionChanged"
                                           TabIndex="4"
                                           Validation.ErrorTemplate="{StaticResource InputErrorTemplate}"
                                           VerticalAlignment="Center"
                                           Visibility="{Binding Path=CanModify, Converter={StaticResource BoolToVisibility}}" />


Everything works fine when the machine's culture is set to en-US.  However, when I change my machine's culture to es-CL (Chile), the text "Enter Date" that appears in the control when it is empty does not get translated to Spanish.  I still see "Enter Date".



When a date is displayed in the control, it's in the proper format for that region.  How do I get the "Enter Date" to display in Spanish?

3 Answers, 1 is accepted

Sort by
0
Kalin
Telerik team
answered on 11 Dec 2013, 01:45 PM
Hi Tony,

The reason for this is that the DateTimePicker Localization depends on the CurrentUICulture and when you are changing the machine culture - it only changes the CurrentCulture. In order to achieve the desired you would need to do the following in the code behind:
Thread.CurrentThread.CurrentCulture = new CultureInfo("es-CL");
Thread.CurrentThread.CurrentUICulture = new CultureInfo("es-CL");

Or you can use our LocalizationManager to set the desired culture at once as shown below:
LocalizationManager.DefaultCulture = new CultureInfo("es-CL");

You can also check the Localization article from our online help documentation.

Hope this helps.

Regards,
Kalin
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Tony
Top achievements
Rank 1
answered on 11 Dec 2013, 01:51 PM

Kalin:


I have checked the values stored in the Thread.CurrentThread.CurrentCulture and Thread.CurrentThread.CurrentUICulture properties on the main thread.  The CurrentCulture property is es-CL, but the CurrentUICulture property is es-ES.  While the two are different, the RadDateTimePicker should still be in Spanish.

Incidentally, in addition to the "Enter Date" string not following the CurrentUICulture, when you expand the date & time selector by clicking on the button on the control's right, all of the dates are in the correct format, but the word "Clock" is in English and not Spanish.

Further, changing the culture in the code-behind is not a possibility for us.  The software has to run properly in default system culture, whatever that is.  When I test the program, I reboot my machine in Chile.  I don't understand why the CurrentCulture is es-CL, which is correct, and the CurrentUICulture is es-ES, but the language is correct in any event.


Tony







0
Kalin
Telerik team
answered on 13 Dec 2013, 03:10 PM
Hello Tony,

Actually there was some issue with localization of the strings in the input field and the close button. Which is already fixed and will be available for download in the next internal build on Monday. So what I can suggest you is to try using the next internal build to set the LocalizationManager.DefaultCulture the following way:

LocalizationManager.DefaultCulture = Thread.CurrentThread.CurrentCulture;

Please try that and let me know if this works for you.

Regards,
Kalin
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
DateTimePicker
Asked by
Tony
Top achievements
Rank 1
Answers by
Kalin
Telerik team
Tony
Top achievements
Rank 1
Share this question
or