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

Custom localization manager week days and months name string

10 Answers 257 Views
DateTimePicker
This is a migrated thread and some comments may be shown as answers.
Mateusz
Top achievements
Rank 1
Mateusz asked on 10 Jan 2018, 03:38 PM

Hi,

I'm creating a custom localization manager, because my Culture is not supported and my client want to have everything in native language. LocalizationManager with 

 

public override string GetStringOverride(string key)
        {
            switch (key)
            {
            }
 
         return base.GetStringOverride(key);
         }

 

is a great and simple tool to use. But I need some keys, which are not mentioned in telerik documentation. Currently I need those for week days and month names. Can you provide them please?

 

Best regards

10 Answers, 1 is accepted

Sort by
0
Mateusz
Top achievements
Rank 1
answered on 10 Jan 2018, 03:56 PM
It actually gets value from windows. Well, it's ok, but I still kinda want to know how to replace them :)
0
Dinko | Tech Support Engineer
Telerik team
answered on 15 Jan 2018, 12:58 PM
Hello Mateusz,

To change the mentioned strings you can set the Culture property of the RadDateTimePicker. Check the following code snippet.
public MainWindow()
    InitializeComponent();
    this.datePicker.Culture = new System.Globalization.CultureInfo("fr-FR");
}

Regards,
Dinko
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which you to write beautiful native mobile apps using a single shared C# codebase.
0
Mateusz
Top achievements
Rank 1
answered on 17 Jan 2018, 02:19 PM

Eh,

I will quote myself with bold now:

 

my Culture is not supported(...)

 

 

0
Dinko | Tech Support Engineer
Telerik team
answered on 19 Jan 2018, 01:22 PM
Hi Mateusz,

You can take a look at this MSDN help article which describes the supported cultures.

Regards,
Dinko
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which you to write beautiful native mobile apps using a single shared C# codebase.
0
Mateusz
Top achievements
Rank 1
answered on 22 Jan 2018, 09:40 AM

Hi Dinko,

 

Thank you for your answer, telerik documentation for Localization is quite different than msdn one, I'm familliar with both, does msdn affects datepicker only? Or there are more controlls in which I can base on msdn instead of telerik Culture property?

 

Regards

0
Dinko | Tech Support Engineer
Telerik team
answered on 24 Jan 2018, 03:42 PM
Hello Mateusz,

There are several controls in our UI for WPF suite which use windows Localization strings. If you want to change the week and months name you can set custom string arrays for the current culture. Check the following code snippet.
this.datePicker.Culture = new System.Globalization.CultureInfo("en-US");
this.datePicker.Culture.DateTimeFormat.AbbreviatedDayNames = new string[] { "111", "222", "33", "44", "555", "666", "777" };
this.datePicker.Culture.DateTimeFormat.AbbreviatedMonthNames = new string[] { "111", "222", "33", "44", "555", "666", "777", "888", "999", "1010", "1111", "12121", "13131" };
this.datePicker.Culture.DateTimeFormat.MonthNames = new string[] { "111", "222", "33", "44", "555", "666", "777", "888", "999", "1010", "1111", "12121", "13131" };

Give this approach a try and let me know if it works for you.

Regards,
Dinko
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
Mateusz
Top achievements
Rank 1
answered on 25 Jan 2018, 08:05 AM

Hi Dinko, 

I was so excited about this approach, but, sadly, it doesn't work for me. Placed this code after InitializeComponent(); and it changed nothing.

 

Regards

0
Accepted
Dinko | Tech Support Engineer
Telerik team
answered on 29 Jan 2018, 12:40 PM
Hello Mateusz,

I am attaching a sample project which demonstrates the approach explained in my previous approach. When you run the application open the drop-down content of the control. You can observe that the week names in the calendar are changed.

Regards,
Dinko
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
Mateusz
Top achievements
Rank 1
answered on 29 Jan 2018, 02:48 PM
Thank you very much Dinko, I'll try to make is done in my project.
0
Stefan Schmiedl
Top achievements
Rank 2
answered on 16 Apr 2021, 10:43 AM

Just in case somebody happens to end up here while searching for a way around the stupid single letter weekday abbreviations showing up with recent skins: There is also a ShortestDayNames attribute which can be reset to sensible names:

var ci = new CultureInfo("de-DE") {
    DateTimeFormat = {ShortestDayNames = new[] {"So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"}}
};
Calendar.Culture      = ci;
Tags
DateTimePicker
Asked by
Mateusz
Top achievements
Rank 1
Answers by
Mateusz
Top achievements
Rank 1
Dinko | Tech Support Engineer
Telerik team
Stefan Schmiedl
Top achievements
Rank 2
Share this question
or