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

Localization of week days ?

3 Answers 141 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
Barry
Top achievements
Rank 1
Barry asked on 06 Sep 2016, 06:46 PM

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

3 Answers, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 08 Sep 2016, 10:01 AM
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.
0
Barry
Top achievements
Rank 1
answered on 08 Sep 2016, 01:03 PM

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.

 

0
Yana
Telerik team
answered on 13 Sep 2016, 08:37 AM
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.
Tags
ScheduleView
Asked by
Barry
Top achievements
Rank 1
Answers by
Yana
Telerik team
Barry
Top achievements
Rank 1
Share this question
or