I want to convert a numeric value to a string, displaying culture-specific digits. For example, the Dari language used in Afghanistan (culture name "prs-AF") uses Eastern-Arabic numerals instead of the Arabic numerals used in most Western cultures (0,1,2,3,4,5,6,7,8,9
).
When examining the CultureInfo class built into the Framework, it lists the correct native digits (screenshot taken from output in LinqPad):
CultureInfo.CreateSpecificCulture("prs-AF").NumberFormat.NativeDigits
However, when trying to convert a number to a string to display in that culture, I am not getting the native digits:
var number = 123.5;
var culture = CultureInfo.CreateSpecificCulture("prs-AF");
Thread.CurrentThread.CurrentUICulture = culture;
Thread.CurrentThread.CurrentCulture = culture;
var text = number.ToString(culture);
Console.WriteLine(text);
Can anyone tell me how to display the native digits?
Thread.CurrentThread.CurrentCulture = New CultureInfo("prs-AF");
?? – MasculineDigitSubstitution
for the culture "prs-AF" isNativeNational
. – VestavestalDigitSubstitution
property ofCultures
, I'd like to refer to the useful article "Bidirectional Features in WPF Overview" on this topic. – Martamartaban