RadDateTimePicker does not completely display in machine culture

4 posts, 0 answers
  1. Tony
    Tony avatar
    111 posts
    Member since:
    May 2011

    Posted 09 Dec 2013 Link to this post

    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?

  2. Kalin
    Admin
    Kalin avatar
    1207 posts

    Posted 11 Dec 2013 Link to this post

    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 >>
  3. UI for WPF is Visual Studio 2017 Ready
  4. Tony
    Tony avatar
    111 posts
    Member since:
    May 2011

    Posted 11 Dec 2013 Link to this post

    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







  5. Kalin
    Admin
    Kalin avatar
    1207 posts

    Posted 13 Dec 2013 Link to this post

    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 >>
Back to Top