Arabic Digits in RadRichTextEditor

1 Answer 21 Views
RichTextBox
Emin Sadigov
Top achievements
Rank 2
Iron
Iron
Iron
Emin Sadigov asked on 17 Mar 2025, 11:21 AM

Hey Telerik Team,

I'm working with the RadRichTextEditor in WPF and ran into a little issue. When I switch my keyboard to Arabic, I was expecting to see Arabic digits (٠١٢٣٤٥), but instead, it still shows the standard Western numbers.

Is there a way to enable Arabic digits when typing in Arabic? I’ve looked around but haven’t had much luck so far. If there's a setting or a workaround that could help, I’d really appreciate any pointers!


using System.Globalization;

Console.OutputEncoding = System.Text.Encoding.UTF8;

CultureInfo arabicCulture = new CultureInfo("ar-AE");
arabicCulture.NumberFormat.DigitSubstitution = DigitShapes.NativeNational;
arabicCulture.NumberFormat.NativeDigits = ["٠", "١", "٢", "٣", "٤", "٥", "٦", "٧", "٨", "٩"];
//arabicCulture.CultureTypes = CultureTypes.
Thread.CurrentThread.CurrentCulture = arabicCulture;
Thread.CurrentThread.CurrentUICulture = arabicCulture;


int number = 12345;
Console.WriteLine(number.ToString(CultureInfo.CurrentCulture));

1 Answer, 1 is accepted

Sort by
0
Stenly
Telerik team
answered on 20 Mar 2025, 09:32 AM

Hello Emin,

I tested the provided code snippet, however, the RadRichTextBox correctly displays the Arabic digits on my end. The following image showcases the produced result when pressing the digit keys on the keyboard:

The following code snippets showcase the setup on my end:

public partial class MainWindow : Window
{
    public MainWindow()
    {
        CultureInfo arabicCulture = new CultureInfo("ar-AE");
        arabicCulture.NumberFormat.DigitSubstitution = DigitShapes.NativeNational;
        arabicCulture.NumberFormat.NativeDigits = ["٠", "١", "٢", "٣", "٤", "٥", "٦", "٧", "٨", "٩"];
        Thread.CurrentThread.CurrentCulture = arabicCulture;
        Thread.CurrentThread.CurrentUICulture = arabicCulture;

        InitializeComponent();
    }
}
<Grid>
    <telerik:RadRichTextBox x:Name="radRichTextBox" />
</Grid>

With this being said, I attached a sample project for you to test, so, could you give it a try and let me know how it goes?

Regards,
Stenly
Progress Telerik

Enjoyed our products? Share your experience on G2 and receive a $25 Amazon gift card for a limited time!

Tags
RichTextBox
Asked by
Emin Sadigov
Top achievements
Rank 2
Iron
Iron
Iron
Answers by
Stenly
Telerik team
Share this question
or