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

WPF Arabic Culture Problem

4 Answers 462 Views
DatePicker
This is a migrated thread and some comments may be shown as answers.
Davut
Top achievements
Rank 1
Davut asked on 11 Feb 2016, 10:10 PM

Hello, I'm trying RadDatePicker WPF (2016.1.112.45), but the day numerals are not shown in "Arabic Numerals".
And also there is another problem, when I'm selecting the day from popup, its been converted to hicri date on the top side.

The startup code : (App.xaml.cs)

1.Thread.CurrentThread.CurrentCulture = new CultureInfo("ar-SA");
2.Thread.CurrentThread.CurrentUICulture = new CultureInfo("ar-SA"); 

 

What am i doing wrong?

 

Note :

I'm trying this on Visual Studo 2013, win7(64bit) Turkish. 

4 Answers, 1 is accepted

Sort by
0
Nasko
Telerik team
answered on 12 Feb 2016, 08:21 AM
Hi Davut,

In order to present the dates into the desired format you need to set the NumberFormat of the CultureInfo to the NativeNational DigitShape:
var culture = new CultureInfo("ar-SA") { NumberFormat = { DigitSubstitution = DigitShapes.NativeNational } };
Thread.CurrentThread.CurrentCulture = culture;
Thread.CurrentThread.CurrentUICulture = culture;

As for your second question, RadDateTimePicker does not support the Hijri calendar only the Gregorian- it uses different algorithm for generating the days. Because of that the dates should be generated by the Gregorian calendar.We have a feature request logged in our Feedback portal for providing support for Hijri calendar - you could find the item on the following link where you could vote for it:
http://feedback.telerik.com/Project/143/Feedback/Details/113416-add-support-for-displaying-hijri-calendar

We hope this will help you.

Regards,
Nasko
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Kasim
Top achievements
Rank 2
answered on 01 Feb 2017, 03:48 AM

Hi Nasko,

I just want Arabic date string with arabic digits. I tried following code:

1.DateTime date = DateTime.Now;
2.CultureInfo ci = CultureInfo.CreateSpecificCulture("ar-AE");
3.ci.NumberFormat.DigitSubstitution = DigitShapes.Context;
4.ci.DateTimeFormat.Calendar = ci.OptionalCalendars.Where(cal => GetCalendarName(cal).Contains("Hijri")).First();
5. 
6.HijriDate= date.ToString("dd - MMMM - yyyy", ci);

 

Month name I am getting in Arabic but the date and year digits are coming in English. Please suggest some solution.

0
Kasim
Top achievements
Rank 2
answered on 01 Feb 2017, 03:54 AM

I also tried setting DigitSubstitution to NativeNational but with no change in result.

1.ci.NumberFormat.DigitSubstitution = DigitShapes.NativeNational;
0
Nasko
Telerik team
answered on 03 Feb 2017, 09:42 AM
Hi Kasim,

From the provided description of your scenario it seems you need the ToString method to return all digits in the "ar-AE" culture. However, the method does not support formatting the digits to the desired culture - this is a behavior built-in the Framework and is not related to the DatePicker control.

You could check the following forum post the provides a solution how to get the desired string representation of the date:
http://stackoverflow.com/questions/8926792/converting-numbers-from-western-arabic-digits-1-2-3-to-eastern-arabic-digit

Hope the provided information will be helpful for you.

Regards,
Nasko
Telerik by Progress
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.
Tags
DatePicker
Asked by
Davut
Top achievements
Rank 1
Answers by
Nasko
Telerik team
Kasim
Top achievements
Rank 2
Share this question
or