WPF Arabic Culture Problem

5 posts, 0 answers
  1. Davut
    Davut avatar
    1 posts
    Member since:
    Mar 2012

    Posted 11 Feb 2016 Link to this post

    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. 

  2. Nasko
    Admin
    Nasko avatar
    666 posts

    Posted 12 Feb 2016 Link to this post

    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
  3. Kasim
    Kasim avatar
    4 posts
    Member since:
    Feb 2016

    Posted 31 Jan in reply to Nasko Link to this post

    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.

  4. Kasim
    Kasim avatar
    4 posts
    Member since:
    Feb 2016

    Posted 31 Jan in reply to Kasim Link to this post

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

    1.ci.NumberFormat.DigitSubstitution = DigitShapes.NativeNational;
  5. Nasko
    Admin
    Nasko avatar
    666 posts

    Posted 03 Feb Link to this post

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