Localization of week days ?

4 posts, 0 answers
  1. Barry
    Barry avatar
    29 posts
    Member since:
    May 2016

    Posted 06 Sep Link to this post

    Hi,

    I'm using: 

    <telerikScheduleView:RadScheduleView x:Name="ScheduleView"...

     

    and we have the custom localization going for Swedish, but I can't find the resource keys for the individual week days that you can see in Week view mode.

     

                   case "Day":
                        return "Day[ENG]";
                    case "Week":
                        return "Week[ENG]";
                    case "Monday":
                        return "?????";

     

    ...in the end we need keys for ALL of the text strings, not just the subset as listed in:

    http://docs.telerik.com/devtools/wpf/controls/radscheduleview/localization#radscheduleview-resource-keys

     

    Thanks,

     

    Barry

  2. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 08 Sep Link to this post

    Hello Barry,

    Actually the days of the week and months are automatically localized by the DateTime class using the current culture settings of the application.  So, setting the CurrentCulture of the CurrentThread to the needed language will translate them automatically:

    public App()
    {
        Thread.CurrentThread.CurrentCulture = new CultureInfo("de");
        Thread.CurrentThread.CurrentUICulture = new CultureInfo("de");
    }

    Hope this will be helpful.

    Regards,
    Yana
    Telerik by Progress
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
  3. UI for WPF is Visual Studio 2017 Ready
  4. Barry
    Barry avatar
    29 posts
    Member since:
    May 2016

    Posted 08 Sep in reply to Yana Link to this post

    Yes, that would work for build in localization that Telerik supports, but not for languages it doesn't The one in question for me is Swedish, and when the language of our app was switched to that, most worked fine except for the days of the week mentioned above. If our current culture is English or French it'll work, but not for Swedish. To fix it I had to use a Translator:

     

                    <VM:CustomGroupHeaderContentTemplateSelector.HorizontalWeekTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding Name, Converter={StaticResource ScheduleDayOfWeekConverter}}" Height="Auto" Margin="4" HorizontalAlignment="Center" MinWidth="100" TextAlignment="Center"/>
                        </DataTemplate>
                    </VM:CustomGroupHeaderContentTemplateSelector.HorizontalWeekTemplate>

     

    .and:

     

       public class ScheduleDayOfWeekConverter : IValueConverter
        {

            public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
            {
                DateTime theDate = (DateTime)value;

                if (theDate.DayOfWeek.ToString().Equals("Monday"))
                {
                    return Resources.Scheduler_Label_Monday;
                }
                else if (theDate.DayOfWeek.ToString().Equals("Tuesday"))
                {
                    return Resources.Scheduler_Label_Tuesday;
                }

                etc. etc.

     

  5. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 13 Sep Link to this post

    Hi Barry,

    I am not sure why it didn't work as expected - in general, the names of the days and months should be translated to the language set as CurrentCulture even if it is not among the built-in languages.

    I've attached a short video to demonstrate how it worked at our side for Swedish language.

    Regards,
    Yana
    Telerik by Progress
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Back to Top