Can I change English numbers to Arabic/Persian representations when a control is being rendered?
c#, wpf
Solution
I use a simple code which i write:
private string toPersianNumber(string input)
{
string[] persian = new string[10] { "۰", "۱", "۲", "۳", "۴", "۵", "۶", "۷", "۸", "۹" };
for (int j=0; j<persian.Length; j++)
input = input.Replace(j.ToString(), persian[j]);
return input;
}
Problem
English numbers (12345678) and some other symbols like decimal are different in Persian (۱۲۳۴۵۶۷۸۹۰) or (۳/۱ instead of 3.1). I want the language to be optional in my controls. For example, when I set the TextProperty of a TextBlock to "2345", I want it to be shown both "2345" and "۲۳۴۵", optionally. Can I change a specific font when controls are being rendered? I mean I override render or some other methods and for example add: ``` if (char=='5') { char='۵'; } ``` or is there any other way? thanks;