Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# Forms localization , +
I am trying to control whether digits get displayed as native digits on systems having an arabic culture.
To be precise, I try to avoid using native digits, because the display string contains a value that is identifying a radio access technology: 3G.
 
But the DigitSubstitution property provided by NumberFormatInfo in the System.Globalization namespace doesn't have any effect.
These are the values the property can take:
Context - The digit shape depends on the previous text in the same output. European digits follow Latin scripts; Arabic-Indic digits follow Arabic text; and Thai digits follow Thai text.
None - The digit shape is not changed. Full Unicode compatibility is maintained.
NativeNational - The digit shape is the native equivalent of the digits from 0 through 9. ASCII digits from 0 through 9 are replaced by equivalent native national digits.
 
The following example illustrates this:
// use arabic-Egypt culture
CultureInfo ci = new CultureInfo("ar-EG");
// set digit substitution to avoid substitution
ci.NumberFormat.DigitSubstitution = DigitShapes.None;
Thread.CurrentThread.CurrentCulture = ci;
Thread.CurrentThread.CurrentUICulture = ci;
// arabic text can be "{0} فقط"
textBox1.Text = string.Format(arabicText, "3G");
 
Further, it behaves differently when system being used was not installed with an arabic display language, although the characters are available.
 
I would appreciate any help here.
 
Best regards,
Michael
Posted 8-Dec-11 3:30am
Edited 8-Dec-11 18:32pm
v3
Comments
Eduard Lu at 8-Dec-11 23:32pm
   
EDIT: added code blocks

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 350
1 Jochen Arndt 150
2 PIEBALDconsult 110
3 Richard MacCutchan 105
4 Sergey Alexandrovich Kryukov 104
0 OriginalGriff 6,055
1 DamithSL 4,621
2 Maciej Los 4,087
3 Kornfeld Eliyahu Peter 3,500
4 Sergey Alexandrovich Kryukov 3,294


Advertise | Privacy | Mobile
Web01 | 2.8.141220.1 | Last Updated 8 Dec 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100